diff --git a/suite-native/app/e2e/pageObjects/alertSheetActions.ts b/suite-native/app/e2e/pageObjects/alertSheetActions.ts index b7ddc79050e5..36379b5cb619 100644 --- a/suite-native/app/e2e/pageObjects/alertSheetActions.ts +++ b/suite-native/app/e2e/pageObjects/alertSheetActions.ts @@ -12,6 +12,13 @@ class AlertSheetActions { await waitFor(secondaryButtonElement).toBeVisible().withTimeout(10000); await secondaryButtonElement.tap(); } + + async skipViewOnlyMode() { + await waitFor(element(by.id('@home/alert/view-only'))) + .toBeVisible() + .withTimeout(20000); + await this.tapSecondaryButton(); + } } export const onAlertSheet = new AlertSheetActions(); diff --git a/suite-native/app/e2e/pageObjects/bottomSheetActions.ts b/suite-native/app/e2e/pageObjects/bottomSheetActions.ts deleted file mode 100644 index 87cda6d188df..000000000000 --- a/suite-native/app/e2e/pageObjects/bottomSheetActions.ts +++ /dev/null @@ -1,10 +0,0 @@ -class BottomSheetActions { - async skipViewOnlyMode() { - const skipViewOnlyModeButton = element(by.id('skip-view-only-mode')); - - await waitFor(skipViewOnlyModeButton).toBeVisible().withTimeout(20000); - await skipViewOnlyModeButton.tap(); - } -} - -export const onBottomSheet = new BottomSheetActions(); diff --git a/suite-native/app/e2e/tests/deeplinkPopup.test.ts b/suite-native/app/e2e/tests/deeplinkPopup.test.ts index 57a5aa906893..2d2da1e46b97 100644 --- a/suite-native/app/e2e/tests/deeplinkPopup.test.ts +++ b/suite-native/app/e2e/tests/deeplinkPopup.test.ts @@ -5,6 +5,7 @@ import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link'; import TrezorConnect from '@trezor/connect-mobile'; import { conditionalDescribe } from '@suite-common/test-utils'; +import { onAlertSheet } from '../pageObjects/alertSheetActions'; import { onConnectingDevice } from '../pageObjects/connectingDevice'; import { appIsFullyLoaded, @@ -16,7 +17,6 @@ import { import { onOnboarding } from '../pageObjects/onboardingActions'; import { onCoinEnablingInit } from '../pageObjects/coinEnablingActions'; import { onHome } from '../pageObjects/homeActions'; -import { onBottomSheet } from '../pageObjects/bottomSheetActions'; const SERVER_PORT = 8080; const SERVER_URL = `http://localhost:${SERVER_PORT}`; @@ -66,7 +66,7 @@ conditionalDescribe(device.getPlatform() !== 'android', 'Deeplink connect popup. await onCoinEnablingInit.enableNetwork('regtest'); await onCoinEnablingInit.clickOnConfirmButton(); - await onBottomSheet.skipViewOnlyMode(); + await onAlertSheet.skipViewOnlyMode(); // This `TrezorConnect` instance here is pretending to be the integrator or @trezor/connect-mobile await TrezorConnect.init({ diff --git a/suite-native/app/e2e/tests/deviceSettings.test.ts b/suite-native/app/e2e/tests/deviceSettings.test.ts index 448778da1515..161c71aa8306 100644 --- a/suite-native/app/e2e/tests/deviceSettings.test.ts +++ b/suite-native/app/e2e/tests/deviceSettings.test.ts @@ -2,7 +2,6 @@ import { conditionalDescribe } from '@suite-common/test-utils'; import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link'; import { onAlertSheet } from '../pageObjects/alertSheetActions'; -import { onBottomSheet } from '../pageObjects/bottomSheetActions'; import { onCoinEnablingInit } from '../pageObjects/coinEnablingActions'; import { onConnectingDevice } from '../pageObjects/connectingDevice'; import { onDeviceAuthenticitySummary } from '../pageObjects/deviceAuthenticitySummary'; @@ -28,7 +27,7 @@ conditionalDescribe(device.getPlatform() !== 'android', 'Device settings', () => await onCoinEnablingInit.enableNetwork('btc'); await onCoinEnablingInit.clickOnConfirmButton(); - await onBottomSheet.skipViewOnlyMode(); + await onAlertSheet.skipViewOnlyMode(); }); beforeEach(async () => { diff --git a/suite-native/app/e2e/tests/onboardAndConnect.test.ts b/suite-native/app/e2e/tests/onboardAndConnect.test.ts index d42525b9e40b..389adc0d1755 100644 --- a/suite-native/app/e2e/tests/onboardAndConnect.test.ts +++ b/suite-native/app/e2e/tests/onboardAndConnect.test.ts @@ -1,7 +1,7 @@ // `expect` keyword is already used by jest. import { expect as detoxExpect } from 'detox'; -import { onBottomSheet } from '../pageObjects/bottomSheetActions'; +import { onAlertSheet } from '../pageObjects/alertSheetActions'; import { disconnectTrezorUserEnv, openApp, prepareTrezorEmulator } from '../utils'; import { onOnboarding } from '../pageObjects/onboardingActions'; import { onCoinEnablingInit } from '../pageObjects/coinEnablingActions'; @@ -35,7 +35,7 @@ describe('Go through onboarding and connect Trezor.', () => { await onCoinEnablingInit.clickOnConfirmButton(); - await onBottomSheet.skipViewOnlyMode(); + await onAlertSheet.skipViewOnlyMode(); await detoxExpect(element(by.id('@home/portfolio/header'))); } else { diff --git a/suite-native/app/e2e/tests/send.test.ts b/suite-native/app/e2e/tests/send.test.ts index 1f98a43e003e..91a42cb342b5 100644 --- a/suite-native/app/e2e/tests/send.test.ts +++ b/suite-native/app/e2e/tests/send.test.ts @@ -3,7 +3,6 @@ import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link'; import { onAccountDetail } from '../pageObjects/accountDetailActions'; import { onAlertSheet } from '../pageObjects/alertSheetActions'; -import { onBottomSheet } from '../pageObjects/bottomSheetActions'; import { onCoinEnablingInit } from '../pageObjects/coinEnablingActions'; import { onConnectingDevice } from '../pageObjects/connectingDevice'; import { onHome } from '../pageObjects/homeActions'; @@ -82,7 +81,7 @@ conditionalDescribe(device.getPlatform() !== 'android', 'Send transaction flow.' await onCoinEnablingInit.enableNetwork('regtest'); await onCoinEnablingInit.clickOnConfirmButton(); - await onBottomSheet.skipViewOnlyMode(); + await onAlertSheet.skipViewOnlyMode(); }); beforeEach(async () => { diff --git a/suite-native/module-home/src/screens/HomeScreen/useShowViewOnlyAlert.tsx b/suite-native/module-home/src/screens/HomeScreen/useShowViewOnlyAlert.tsx index 747143f7bcd2..77b523fa2cfb 100644 --- a/suite-native/module-home/src/screens/HomeScreen/useShowViewOnlyAlert.tsx +++ b/suite-native/module-home/src/screens/HomeScreen/useShowViewOnlyAlert.tsx @@ -96,6 +96,7 @@ export const useShowViewOnlyAlert = () => { /> ), + testID: '@home/alert/view-only', }); }, [showAlert, handleEnable, handleCancel]);