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
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class DashboardPage {
readonly openUnusedWalletButton2: Locator;
readonly buyButton = (networkSymbol: NetworkSymbol): Locator =>
this.page.getByTestId(`@dashboard/asset/${networkSymbol}/buy-button`);
readonly walletReady: Locator;

constructor(
private readonly page: Page,
Expand Down Expand Up @@ -80,6 +81,7 @@ export class DashboardPage {
this.openUnusedWalletButton2 = this.page.getByTestId(
'@passphrase-confirmation/step2-button',
);
this.walletReady = this.page.getByTestId('@dashboard/wallet-ready');
}

@step()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export class TrezorInput {
@step()
async enterPinOnBlindMatrix(pinEntryNumber: string) {
await test.step('Find number on blind matrix and click it', async () => {
await this.page.waitForTimeout(500); // try to prevent race condition, that happens with t1b1 with node bridge
// try to prevent race condition, that happens with t1b1 with node bridge
await this.page.waitForTimeout(500);

const state = await TrezorUserEnvLinkProxy.getDebugState();
const index = state.matrix.indexOf(pinEntryNumber) + 1;
await this.pinInput(index).click();
for (const number of pinEntryNumber) {
const index = state.matrix.indexOf(number) + 1;
await this.pinInput(index).click();
}
await this.pinSubmitButton.click();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ test.describe(
priority: TestPriority.Critical,
}),
},
async ({ analyticsSection, onboardingPage, devicePrompt, trezorUserEnvLink, page }) => {
async ({
page,
analyticsSection,
onboardingPage,
settingsPage,
dashboardPage,
devicePrompt,
trezorInput,
trezorUserEnvLink,
}) => {
await test.step('Pass through analytics and firmware steps', async () => {
await analyticsSection.passThroughAnalytics();
await onboardingPage.firmware.continueThroughFirmware();
Expand All @@ -41,10 +50,6 @@ test.describe(
await trezorUserEnvLink.pressYes();
});

await test.step('Skip backup, It is possible to leave onboarding now', async () => {
await expect(onboardingPage.backup.skipBackupButton).toBeVisible();
});

await test.step('Start backup process', async () => {
await onboardingPage.createBackupButton.click();
});
Expand All @@ -54,6 +59,7 @@ test.describe(
await onboardingPage.backup.madeNoDigitalCopyCheckbox.click();
await onboardingPage.backup.willHideSeedCheckbox.click();
await devicePrompt.confirmOnDevicePromptIsHidden();

await onboardingPage.backup.startButton.click();
await devicePrompt.confirmOnDevicePromptIsShown();

Expand All @@ -66,33 +72,29 @@ test.describe(
await onboardingPage.backup.closeButton.click();
});

await test.step('Proceed to PIN setup, Now we are in PIN step, skip button is available', async () => {
await expect(onboardingPage.pin.skipButton).toBeVisible();
});

await test.step('Lets set PIN', async () => {
const pin = '12345';

await onboardingPage.pin.setPinButton.click();
await devicePrompt.confirmOnDevicePromptIsShown();
await trezorUserEnvLink.pressYes();
// enter the PIN
await trezorInput.enterPinOnBlindMatrix(pin);
// re-enter the PIN
await trezorInput.enterPinOnBlindMatrix(pin);
});

await test.step('Simulate PIN mismatch', async () => {
await onboardingPage.pin.pinButton(1).click();
await onboardingPage.pin.submitButton.click();
await onboardingPage.pin.pinButton(1).click();
await onboardingPage.pin.pinButton(1).click();
await onboardingPage.pin.submitButton.click();
await expect(onboardingPage.pin.pinMismatch).toBeVisible();
await onboardingPage.pin.tryAgainButton.click();
});

await test.step('Retry PIN setup', async () => {
await devicePrompt.confirmOnDevicePromptIsShown();
await trezorUserEnvLink.pressYes();
await test.step('Activate assets & continue setup', async () => {
await expect(settingsPage.coins.networkButton('btc')).toBeEnabledCoin();
await expect(settingsPage.coins.networkButton('eth')).toBeDisabledCoin();
await settingsPage.coins.enableNetwork('eth');
await onboardingPage.continueCoinsButton.click();
});

await test.step('Pin matrix appears again', async () => {
await expect(onboardingPage.pin.pinButton(1)).toBeVisible();
await test.step('Finish wallet creation', async () => {
await expect(onboardingPage.finalTitle).toBeVisible();
await onboardingPage.onboardingContinueButton.click();
await expect(dashboardPage.walletReady).toBeVisible();
});
},
);
Expand Down