Files
iNaturalistReactNative/e2e/sharedFlows/deleteObservation.js
Johannes Klein 5c8e3be12c test AI camera in e2e (#2188)
* 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
2024-11-01 10:38:37 -07:00

31 lines
1.2 KiB
JavaScript

import {
by, element, expect, waitFor
} from "detox";
// Start this on ObsEdit or ObsDetails via uploaded = false / true
export default async function deleteObservation( options = { uploaded: false } ) {
if ( options.uploaded ) {
const editButton = element( by.id( "ObsDetail.editButton" ) );
await waitFor( editButton ).toBeVisible().withTimeout( 10000 );
// Navigate to the edit screen
await editButton.tap();
}
// Check that the edit screen is visible
await waitFor( element( by.text( "EVIDENCE" ) ) )
.toBeVisible()
.withTimeout( 10000 );
// Press header kebab menu
const headerKebabMenu = element( by.id( "KebabMenu.Button" ) );
await expect( headerKebabMenu ).toBeVisible();
await headerKebabMenu.tap();
// Press delete observation
const deleteObservationMenuItem = element( by.id( "Header.delete-observation" ) );
await waitFor( deleteObservationMenuItem ).toBeVisible().withTimeout( 10000 );
await deleteObservationMenuItem.tap();
// Check that the delete button is visible
const deleteObservationButton = element( by.text( "DELETE" ) );
await waitFor( deleteObservationButton ).toBeVisible().withTimeout( 10000 );
// Press delete observation
await deleteObservationButton.tap();
}