mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-01-02 02:48:33 -05:00
* Add a cameraZoomRange default * Small detox version bump * Add a mocked camera with a take photo button * An e2e mock for the computer vision plugin predicting a frame * Mock taking a photo by loading the first photo from the CameraRoll Closes #1981
31 lines
1.2 KiB
JavaScript
31 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";
|
|
|
|
// 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( 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 )}.*` );
|
|
const locationText = element( by.text( pattern ) );
|
|
await waitFor( locationText ).toBeVisible().withTimeout( 10000 );
|
|
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();
|
|
}
|
|
}
|