mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -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
51 lines
2.1 KiB
JavaScript
51 lines
2.1 KiB
JavaScript
import {
|
|
by, element, expect, waitFor
|
|
} from "detox";
|
|
import Config from "react-native-config-node";
|
|
|
|
import dismissAnnouncements from "./dismissAnnouncements";
|
|
import switchPowerMode from "./switchPowerMode";
|
|
|
|
const TIMEOUT = 10_000;
|
|
|
|
export default async function signIn() {
|
|
/*
|
|
Switch UI to power user mode
|
|
*/
|
|
await switchPowerMode();
|
|
// Find the Menu item from tabs
|
|
const openDrawerMenuItem = element( by.id( "OPEN_DRAWER" ) );
|
|
await waitFor( openDrawerMenuItem ).toBeVisible().withTimeout( TIMEOUT );
|
|
await expect( openDrawerMenuItem ).toBeVisible();
|
|
await element( by.id( "OPEN_DRAWER" ) ).tap( { x: 0, y: 0 } );
|
|
// Tap the Log-In menu item
|
|
// TODO: consider this a temporary solution as it only checks for the drawer-top-banner
|
|
// which can be a login prompt or the logged in user's details. If the user is already
|
|
// logged in, this should fail instead.
|
|
const loginMenuItem = element( by.id( "drawer-top-banner" ) );
|
|
await waitFor( loginMenuItem ).toBeVisible().withTimeout( TIMEOUT );
|
|
await expect( loginMenuItem ).toBeVisible();
|
|
await element( by.id( "drawer-top-banner" ) ).tap();
|
|
const usernameInput = element( by.id( "Login.email" ) );
|
|
await waitFor( usernameInput ).toBeVisible().withTimeout( TIMEOUT );
|
|
await expect( usernameInput ).toBeVisible();
|
|
await element( by.id( "Login.email" ) ).tap();
|
|
await element( by.id( "Login.email" ) ).typeText( Config.E2E_TEST_USERNAME );
|
|
const passwordInput = element( by.id( "Login.password" ) );
|
|
await expect( passwordInput ).toBeVisible();
|
|
await element( by.id( "Login.password" ) ).tap();
|
|
await element( by.id( "Login.password" ) ).typeText( Config.E2E_TEST_PASSWORD );
|
|
const loginButton = element( by.id( "Login.loginButton" ) );
|
|
await expect( loginButton ).toBeVisible();
|
|
await element( by.id( "Login.loginButton" ) ).tap();
|
|
const username = element( by.text( `${Config.E2E_TEST_USERNAME}` ) ).atIndex( 1 );
|
|
await waitFor( username ).toBeVisible().withTimeout( TIMEOUT );
|
|
await expect( username ).toBeVisible();
|
|
|
|
/*
|
|
Dismiss announcements if they're blocking the UI
|
|
*/
|
|
await dismissAnnouncements();
|
|
return username;
|
|
}
|