mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-22 06:28:42 -04:00
Note that offsetting the onboarding images ended up being a bit hard. We're mostly doing so with a cropped version of one of the images. Closes #1906 Also tried to de-flake some tests: * Use fake timers when possible * Ensure time travel helper doesn't un-fake our timers * Wait for time travel helper to finish so changes don't happen outside of act * Stop mocking useCurrentUser in integration tests; that's app code and should not be mocked when integrating all parts of the app; instead use signIn / signOut helpers * Remove unnecessary direct uses of act() * Mocked some inatjs calls to prevent React Query complaints about undefined query return values * Close onboarding before all e2e tests --------- Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
22 lines
667 B
JavaScript
22 lines
667 B
JavaScript
import {
|
|
by,
|
|
element,
|
|
waitFor
|
|
} from "detox";
|
|
|
|
const VISIBILITY_TIMEOUT = 10_000;
|
|
|
|
export default async function closeOnboarding( ) {
|
|
const loginText = element( by.id( "log-in-to-iNaturalist-button.text" ) );
|
|
await waitFor( loginText ).toExist().withTimeout( VISIBILITY_TIMEOUT );
|
|
// If we can see MyObs, we don't need to close the onboarding
|
|
if ( loginText.visible ) {
|
|
return Promise.resolve( );
|
|
}
|
|
const closeOnboardingButton = element(
|
|
by.label( "Close" ).withAncestor( by.id( "OnboardingCarousel" ) )
|
|
);
|
|
await waitFor( closeOnboardingButton ).toBeVisible( ).withTimeout( VISIBILITY_TIMEOUT );
|
|
return closeOnboardingButton.tap( );
|
|
}
|