Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions suite-native/app/e2e/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,19 @@ export const inputTextToElement = async (element: Detox.IndexableNativeElement,
await element.typeText(text);
}
};

// Use this method in absolute necessity only! Try-catch in tests is discouraged because it may hide real issues.
export const isElementVisible = async (
elementOrMatcher: Detox.IndexableNativeElement | Detox.NativeMatcher,
): Promise<boolean> => {
const target = isIndexableNativeElement(elementOrMatcher)
? elementOrMatcher
: element(elementOrMatcher);
try {
await waitFor(target).toBeVisible().withTimeout(5_000);

return true;
} catch {
return false;
}
};
19 changes: 14 additions & 5 deletions suite-native/app/e2e/tests/deviceOnboarding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@ import {
preparePreloadedReduxState,
prepareTrezorEmulator,
} from '../support/setup';
import { wait } from '../support/utils';
import { isElementVisible, wait } from '../support/utils';

const proceedToCreateOrRecoverCrossroads = async (options?: { skipFirmwareUpdate?: boolean }) => {
const proceedToCreateOrRecoverCrossroads = async () => {
await onDeviceOnboarding.waitForUninitializedDeviceLanding();
await onDeviceOnboarding.dismissTheUninitializedDeviceLanding();
if (options?.skipFirmwareUpdate) {
// During our release process, the TrezorUserEnv might not have the latest firmware version.
// In such cases, the firmware update screen appears here.
// We want to skip the update in e2e tests as it is not supported.
const isFirmwareUpdateScreenPresent = await isElementVisible(
by.id('@device-firmware/update-button'),
);
if (isFirmwareUpdateScreenPresent) {
await onDeviceOnboarding.skipFirmwareUpdate();
console.warn(
'SKIPPING FIRMWARE UPDATE: Firmware update was displayed, make sure it was only due to TrezorUserEnv not having latest firmware version.',
);
}

await TrezorUserEnvLink.pressYes();
Expand Down Expand Up @@ -58,7 +67,7 @@ conditionalDescribe(device.getPlatform() === 'android', 'Device onboarding [@fix
await proceedToCreateOrRecoverCrossroads();
});

it.skip('Create Wallet', async () => {
it('Create Wallet', async () => {
await onDeviceOnboarding.selectCreateWalletOption();

await onDeviceOnboarding.waitForCreateWalletLoadingScreen();
Expand Down Expand Up @@ -94,7 +103,7 @@ conditionalDescribe(device.getPlatform() === 'android', 'Device onboarding [@fix
await finishOnboardingFlow();
});

it.skip('Recover Wallet', async () => {
it('Recover Wallet', async () => {
await onDeviceOnboarding.selectRecoverWalletOption();
await onDeviceOnboarding.confirmRecoveryInstructions();

Expand Down
Loading