mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
e2e mock for Geolocation.watchPosition to deflake tests (#1842)
This commit is contained in:
@@ -3,6 +3,8 @@ import {
|
||||
} from "detox";
|
||||
import Config from "react-native-config-node";
|
||||
|
||||
// This needs to be a relative path for the e2e-mock version to be used
|
||||
import { CHUCKS_PAD } from "../src/appConstants/e2e";
|
||||
import { iNatE2eBeforeAll, iNatE2eBeforeEach } from "./helpers";
|
||||
|
||||
describe( "Signed in user", () => {
|
||||
@@ -24,6 +26,12 @@ describe( "Signed in user", () => {
|
||||
await waitFor( element( by.id( "new-observation-text" ) ) )
|
||||
.toBeVisible()
|
||||
.withTimeout( 10000 );
|
||||
// Ensure the location from the e2e-mock is being used so we don't end up
|
||||
// with tests flaking out due to time zone issues
|
||||
const pattern = new RegExp( `.*${CHUCKS_PAD.latitude.toFixed( 4 )}.*` );
|
||||
await waitFor( element( by.text( pattern ) ) )
|
||||
.toBeVisible()
|
||||
.withTimeout( 10000 );
|
||||
if ( options.upload ) {
|
||||
// Press Upload now button
|
||||
const uploadNowButton = element( by.id( "ObsEdit.uploadButton" ) );
|
||||
|
||||
Reference in New Issue
Block a user