mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-01-05 12:28:08 -05:00
* Update gradle.properties * Update Podfile * Update react-native-mmkv * Update Podfile.lock * Delete useObservationsUpdatesWhenFocused.test.js * Update closeOnboarding.js * Fix failing button tap in e2e tests * Create react-native-sensitive-info+6.0.0-alpha.9.patch * Update bottom-sheets * Refactor e2e timeout to file-wide const * Remove check that fails * Check for entire list item instead of comments count * Longer delay to wait for observation deletion to make UI disappear
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import {
|
|
by, element, expect, waitFor
|
|
} from "detox";
|
|
|
|
// This needs to be a relative path for the e2e-mock version to be used
|
|
import { CHUCKS_PAD } from "../../src/appConstants/e2e";
|
|
|
|
const TIMEOUT = 10_000;
|
|
|
|
// Upload or save an observation
|
|
export default async function uploadObservation( options = { upload: false } ) {
|
|
// Start this on ObsEdit
|
|
// Check that the new observation screen is visible
|
|
const newObservationText = element( by.id( "new-observation-text" ) );
|
|
await waitFor( newObservationText ).toBeVisible().withTimeout( TIMEOUT );
|
|
// 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 )}.*` );
|
|
const locationText = element( by.text( pattern ) );
|
|
await waitFor( locationText ).toBeVisible().withTimeout( TIMEOUT );
|
|
if ( options.upload ) {
|
|
// Press Upload now button
|
|
const uploadNowButton = element( by.id( "ObsEdit.uploadButton" ) );
|
|
await expect( uploadNowButton ).toBeVisible();
|
|
await uploadNowButton.tap();
|
|
} else {
|
|
// Press Save button
|
|
const saveButton = element( by.id( "ObsEdit.saveButton" ) );
|
|
await expect( saveButton ).toBeVisible();
|
|
await saveButton.tap();
|
|
}
|
|
}
|