-
-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): Migrated rest of t1b1 onboarding tests (#16067)
- Loading branch information
1 parent
c0bdf14
commit 6365662
Showing
10 changed files
with
219 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/suite-desktop-core/e2e/support/pageActions/recoverActions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export class RecoverActions { | ||
readonly selectBasicRecoveryButton: Locator; | ||
|
||
constructor(private page: Page) { | ||
this.selectBasicRecoveryButton = page.getByTestId('@recover/select-type/basic'); | ||
} | ||
|
||
async selectWordCount(number: number) { | ||
await this.page.getByTestId(`@recover/select-count/${number}`).click(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/suite-desktop-core/e2e/support/pageActions/wordInputActions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link'; | ||
|
||
export class WordInputActions { | ||
readonly wordSelectInput: Locator; | ||
|
||
constructor(private page: Page) { | ||
this.wordSelectInput = page.getByTestId('@word-input-select/input'); | ||
} | ||
|
||
async inputWord(word: string) { | ||
await this.wordSelectInput.type(word); | ||
await this.page.getByTestId(`@word-input-select/option/${word}`).click(); | ||
} | ||
|
||
async inputMnemonicT1B1(mnemonic: string[]) { | ||
for (let i = 0; i < 24; i++) { | ||
await this.page.waitForTimeout(400); | ||
const state = await TrezorUserEnvLink.getDebugState(); | ||
const position = state.recovery_word_pos - 1; | ||
await this.inputWord(mnemonic[position]); | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
packages/suite-desktop-core/e2e/tests/onboarding/t1b1/t1b1-recovery-advanced.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { test, expect } from '../../../support/fixtures'; | ||
|
||
test.describe('Onboarding - recover wallet T1B1', { tag: ['@group=device-management'] }, () => { | ||
test.use({ | ||
emulatorStartConf: { model: 'T1B1', version: '1-latest', wipe: true }, | ||
setupEmulator: false, | ||
}); | ||
|
||
test.beforeEach(async ({ onboardingPage }) => { | ||
await onboardingPage.disableFirmwareHashCheck(); | ||
}); | ||
|
||
test('Incomplete run of advanced recovery', async ({ | ||
onboardingPage, | ||
analyticsPage, | ||
devicePrompt, | ||
page, | ||
trezorUserEnvLink, | ||
}) => { | ||
// Navigate through onboarding steps | ||
await analyticsPage.passThroughAnalytics(); | ||
await onboardingPage.firmwareContinueButton.click(); | ||
await onboardingPage.recoverWalletButton.click(); | ||
|
||
// Select advanced recovery | ||
await page.getByTestId('@recover/select-count/24').click(); | ||
await page.getByTestId('@recover/select-type/advanced').click(); | ||
await page.getByTestId('@onboarding/confirm-on-device').waitFor({ state: 'visible' }); | ||
await trezorUserEnvLink.pressYes(); | ||
|
||
// Simulate user input | ||
for (let i = 0; i <= 4; i++) { | ||
await page.getByTestId('@recovery/word-input-advanced/1').click({ force: true }); | ||
} | ||
|
||
// Simulate device disconnection due to lack of cancel button | ||
await page.waitForTimeout(501); | ||
await trezorUserEnvLink.stopEmu(); | ||
await devicePrompt.confirmOnDevicePromptIsShown(); | ||
|
||
// Restart emulator | ||
await trezorUserEnvLink.startEmu({ model: 'T1B1', version: '1-latest' }); | ||
|
||
// Retry recovery with basic type | ||
await onboardingPage.retryRecoveryButton.click(); | ||
await page.getByTestId('@recover/select-count/12').click(); | ||
await page.getByTestId('@recover/select-type/basic').click(); | ||
|
||
// Confirm on device | ||
await page.getByTestId('@onboarding/confirm-on-device').waitFor({ state: 'visible' }); | ||
await trezorUserEnvLink.pressYes(); | ||
|
||
// Ensure input field for basic recovery is visible | ||
await expect(page.getByTestId('@word-input-select/input')).toBeVisible(); | ||
|
||
// Note: Completion of reading device data requires support in trezor-user-env | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
packages/suite-desktop-core/e2e/tests/onboarding/t1b1/t1b1-recovery-fail.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { test } from '../../../support/fixtures'; | ||
|
||
test.describe('Onboarding - recover wallet T1B1', { tag: ['@group=device-management'] }, () => { | ||
test.use({ | ||
emulatorStartConf: { model: 'T1B1', version: '1-latest', wipe: true }, | ||
setupEmulator: false, | ||
}); | ||
|
||
test.beforeEach(async ({ onboardingPage }) => { | ||
await onboardingPage.disableFirmwareHashCheck(); | ||
}); | ||
|
||
test('Device disconnected during recovery offers retry', async ({ | ||
onboardingPage, | ||
analyticsPage, | ||
recoverPage, | ||
devicePrompt, | ||
trezorUserEnvLink, | ||
}) => { | ||
await analyticsPage.passThroughAnalytics(); | ||
|
||
// Start wallet recovery process | ||
await onboardingPage.firmwareContinueButton.click(); | ||
await onboardingPage.recoverWalletButton.click(); | ||
await recoverPage.selectWordCount(24); | ||
await recoverPage.selectBasicRecoveryButton.click(); | ||
await devicePrompt.confirmOnDevicePromptIsShown(); | ||
await trezorUserEnvLink.pressYes(); | ||
|
||
// Disconnect the device | ||
await trezorUserEnvLink.stopEmu(); | ||
await devicePrompt.connectDevicePromptIsShown(); | ||
await trezorUserEnvLink.startEmu({ model: 'T1B1', version: '1-latest', wipe: false }); | ||
|
||
// Retry recovery process | ||
await onboardingPage.retryRecoveryButton.click(); | ||
await recoverPage.selectWordCount(24); | ||
await recoverPage.selectBasicRecoveryButton.click(); | ||
await devicePrompt.confirmOnDevicePromptIsShown(); | ||
}); | ||
}); |
70 changes: 70 additions & 0 deletions
70
packages/suite-desktop-core/e2e/tests/onboarding/t1b1/t1b1-recovery-success.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { test, expect } from '../../../support/fixtures'; | ||
|
||
const mnemonic = [ | ||
'nasty', | ||
'answer', | ||
'gentle', | ||
'inform', | ||
'unaware', | ||
'abandon', | ||
'regret', | ||
'supreme', | ||
'dragon', | ||
'gravity', | ||
'behind', | ||
'lava', | ||
'dose', | ||
'pilot', | ||
'garden', | ||
'into', | ||
'dynamic', | ||
'outer', | ||
'hard', | ||
'speed', | ||
'luxury', | ||
'run', | ||
'truly', | ||
'armed', | ||
]; | ||
|
||
test.describe('Onboarding - recover wallet T1B1', { tag: ['@group=device-management'] }, () => { | ||
test.use({ | ||
emulatorStartConf: { model: 'T1B1', version: '1-latest', wipe: true }, | ||
setupEmulator: false, | ||
}); | ||
|
||
test.beforeEach(async ({ onboardingPage }) => { | ||
await onboardingPage.disableFirmwareHashCheck(); | ||
}); | ||
|
||
test('Successfully recovers wallet from mnemonic', async ({ | ||
page, | ||
onboardingPage, | ||
analyticsPage, | ||
devicePrompt, | ||
recoverPage, | ||
wordInputPage, | ||
trezorUserEnvLink, | ||
}) => { | ||
await analyticsPage.passThroughAnalytics(); | ||
|
||
// Start wallet recovery process | ||
await onboardingPage.firmwareContinueButton.click(); | ||
await onboardingPage.recoverWalletButton.click(); | ||
await recoverPage.selectWordCount(24); | ||
await recoverPage.selectBasicRecoveryButton.click(); | ||
await devicePrompt.confirmOnDevicePromptIsShown(); | ||
await page.waitForTimeout(1000); | ||
await trezorUserEnvLink.pressYes(); | ||
|
||
// Input mnemonic | ||
await wordInputPage.inputMnemonicT1B1(mnemonic); | ||
|
||
// Finalize recovery, skip pin, and verify success | ||
await onboardingPage.continueRecoveryButton.click(); | ||
await onboardingPage.skipPin(); | ||
await onboardingPage.continueCoinsButton.click(); | ||
await expect(onboardingPage.finalTitle).toBeVisible(); | ||
await expect(onboardingPage.finalTitle).toContainText('Setup complete!'); | ||
}); | ||
}); |
71 changes: 0 additions & 71 deletions
71
packages/suite-web/e2e/tests/onboarding/t1b1/t1b1-create-wallet.test.ts
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
packages/suite-web/e2e/tests/onboarding/t1b1/t1b1-recovery-advanced.test.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.