Files
iNaturalistReactNative/e2e/addObservationWithoutData.e2e.js
Amanda Bullington bbc5b9d67d MyObservations refactor (#510)
* WIP: very rough start at pulling state up into a container for MyObservations

I made a parallel MyObservations component and container so ObservationViews
can still be used as a working reference, but the ultimate goal here is to
focus MyObservations on presentation, and pull state and other business logic
up into a container component. This should make MyObservations a bit more
testable and clean up a very large and confusing file.

I'm also trying to move away from a generalized representation of observations
on all screens, which is why I want to name it MyObservations and not
ObservationViews. MyObservations has a lot of unique functionality that we
won't need elsewhere, and we can modularize stuff when we need to use it in
multiple places.

* UI updates for header, toolbar, empty component

* Add pressable component and login sheet

* UI improvements; get infinite scroll working

* UI improvements & additions for empty screen & bottom sheet

* Show login sheet when a user presses sync but is not logged in

* Fix backdrop close for AddObsModal

* Move UI elements to MyObservations

* Fix unit tests for MyObservations

* Fix for login sheet

* Set header height to a different height on Android to account for safe area

* Fix failing tests & rerender of user icon in navbar

* Remove scientific name from DisplayTaxonName to match Figma UI

* Set height above toolbar dynamically for sticky toolbar

* Add prop to display or hide second name in DisplayTaxonName

* Use RN styling to style grid view for MyObs flatlist

* Fix failing project obs test

* Create separate ToolbarContainer to separate presentation from logic; fix upload count

* Merge main and show onboarding based on user's total obs count

* Fix display taxon name styling and remove header fade on iOS

* Add header text for 0 observations, logged out state

* Update infinite scroll to 50 obs at a time; make loading wheel show faster

* Add uploaded status to toolbar

* Apply bandaid fix to stop Android from crashing on start

* Start adding new icons to MyObs

* Add circular progress; show upload icons at correct times during upload

* Add disabled props for accessibility state

* Fix tests; update snapshots

* Code cleanup

* Code cleanup & add inaturalist icon

* Fix merge conflict and add icon

* Add inaturalist icon

* Fix navigation to obs list and toolbar status when upload completes

* Move showLoginSheet code to MyObsContainer

* Fix toolbar status text

* Sync toolbar with upload status progress

* Clear toolbar after nav

* Tests passing

* Update e2e test

* Target login button in e2e tests

* Fix failing e2e tests with new testID for login button

* Update button snapshot to include new testID

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-03-14 10:54:33 -07:00

47 lines
1.6 KiB
JavaScript

import {
by,
device,
element,
expect,
waitFor
} from "detox";
describe( "Add observation without evidence", () => {
beforeAll( async () => {
await device.launchApp( {
newInstance: true,
permissions: { location: "always" }
} );
} );
beforeEach( async () => {
// device.launchApp is preferred for an app of our complexity. It does work locally for both,
// but on CI for Android it does not work. So we use reloadReactNative for Android.
if ( device.getPlatform( ) === "android" ) {
await device.reloadReactNative( );
} else {
await device.launchApp( {
newInstance: true,
permissions: { location: "always" }
} );
}
} );
it( "should open app with the observation list screen", async () => {
const loginText = element( by.id( "log-in-to-iNaturalist-button.text" ) );
await waitFor( loginText ).toBeVisible( ).withTimeout( 10000 );
await expect( loginText ).toBeVisible( );
} );
it( "should navigate to observation add screen on add evidence button pressed", async () => {
const addObsButton = element( by.id( "add-obs-button" ) );
await waitFor( addObsButton ).toBeVisible( ).withTimeout( 10000 );
await addObsButton.tap( );
await expect( element( by.id( "evidence-text" ) ) ).toBeVisible( );
const obsWithoutEvidenceButton = element( by.id( "observe-without-evidence-button" ) );
await expect( obsWithoutEvidenceButton ).toBeVisible( );
await obsWithoutEvidenceButton.tap( );
await waitFor( element( by.id( "new-observation-text" ) ) ).toBeVisible( ).withTimeout( 10000 );
} );
} );