-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(e2e): Fixed T1B1 recovery fail and success
- Loading branch information
1 parent
0b3dc63
commit bef8f3c
Showing
15 changed files
with
311 additions
and
112 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/suite-web/e2e/support/pageObjects/analyticsObject.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,9 @@ | ||
/// <reference types="cypress" /> | ||
|
||
class AnalyticsPage { | ||
continue() { | ||
cy.getTestElement('@analytics/continue-button').click(); | ||
} | ||
} | ||
|
||
export const onAnalyticsPage = new AnalyticsPage(); |
9 changes: 9 additions & 0 deletions
9
packages/suite-web/e2e/support/pageObjects/connectDeviceObject.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,9 @@ | ||
/// <reference types="cypress" /> | ||
|
||
class ConnectDevicePrompt { | ||
waitForConnectDevicePrompt() { | ||
cy.getTestElement('@connect-device-prompt', { timeout: 20000 }).should('be.visible'); | ||
} | ||
} | ||
|
||
export const onConnectDevicePrompt = new ConnectDevicePrompt(); |
46 changes: 46 additions & 0 deletions
46
packages/suite-web/e2e/support/pageObjects/onboardingObject.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,46 @@ | ||
/// <reference types="cypress" /> | ||
|
||
class OnboardingPage { | ||
waitForConfirmationOnDevice() { | ||
cy.getTestElement('@onboarding/confirm-on-device').should('be.visible'); | ||
} | ||
|
||
recoverWallet() { | ||
cy.getTestElement('@onboarding/path-recovery-button').click(); | ||
} | ||
|
||
continueRecovery() { | ||
cy.getTestElement('@onboarding/recovery/continue-button').click(); | ||
} | ||
|
||
continueCoins() { | ||
cy.getTestElement('@onboarding/coins/continue-button').click(); | ||
} | ||
|
||
continueFirmware() { | ||
cy.getTestElement('@firmware/continue-button').click(); | ||
} | ||
|
||
startRecovery() { | ||
cy.getTestElement('@onboarding/recovery/start-button').click(); | ||
} | ||
|
||
retryRecovery() { | ||
cy.getTestElement('@onboarding/recovery/retry-button').click(); | ||
} | ||
|
||
skipFirmware() { | ||
cy.getTestElement('@firmware/skip-button').click(); | ||
} | ||
|
||
skipPin() { | ||
cy.getTestElement('@onboarding/skip-button').click(); | ||
cy.getTestElement('@onboarding/skip-button-confirm').click(); | ||
} | ||
|
||
checkOnboardingSuccess() { | ||
cy.getTestElement('@onboarding/final').should('be.visible').contains('Setup complete!'); | ||
} | ||
} | ||
|
||
export const onOnboardingPage = new OnboardingPage(); |
13 changes: 13 additions & 0 deletions
13
packages/suite-web/e2e/support/pageObjects/recoverObject.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 @@ | ||
/// <reference types="cypress" /> | ||
|
||
class RecoverPage { | ||
selectWordCount(number: number) { | ||
cy.getTestElement(`@recover/select-count/${number}`).click(); | ||
} | ||
|
||
selectBasicRecovery() { | ||
cy.getTestElement('@recover/select-type/basic').click(); | ||
} | ||
} | ||
|
||
export const onRecoverPage = new RecoverPage(); |
10 changes: 10 additions & 0 deletions
10
packages/suite-web/e2e/support/pageObjects/wordInputObject.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,10 @@ | ||
/// <reference types="cypress" /> | ||
|
||
class WordInputPage { | ||
inputWord(word: string) { | ||
cy.getTestElement('@word-input-select/input').type(word); | ||
cy.getTestElement(`@word-input-select/option/${word}`).click(); | ||
} | ||
} | ||
|
||
export const onWordInputPage = new WordInputPage(); |
46 changes: 0 additions & 46 deletions
46
packages/suite-web/e2e/tests/onboarding/t1b1-recovery-basic.test.ts
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions
51
packages/suite-web/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,51 @@ | ||
// @group_device-management | ||
// @retry=2 | ||
|
||
import { onOnboardingPage } from '../../../support/pageObjects/onboardingObject'; | ||
import { onAnalyticsPage } from '../../../support/pageObjects/analyticsObject'; | ||
import { onRecoverPage } from '../../../support/pageObjects/recoverObject'; | ||
import { onConnectDevicePrompt } from '../../../support/pageObjects/connectDeviceObject'; | ||
|
||
describe('Onboarding - recover wallet T1B1', () => { | ||
beforeEach(() => { | ||
cy.task('startBridge'); | ||
cy.task('startEmu', { model: 'T1B1', version: '1-latest', wipe: true }); | ||
cy.viewport(1440, 2560).resetDb(); | ||
cy.prefixedVisit('/'); | ||
cy.disableFirmwareHashCheck(); | ||
|
||
cy.step('Go through analytics and confirm firmware', () => { | ||
onAnalyticsPage.continue(); | ||
onAnalyticsPage.continue(); | ||
}); | ||
}); | ||
|
||
it('Device disconnected during recovery offers retry', () => { | ||
cy.step('Start wallet recovery process and confirm on device', () => { | ||
onOnboardingPage.continueFirmware(); | ||
onOnboardingPage.recoverWallet(); | ||
onRecoverPage.selectWordCount(24); | ||
onRecoverPage.selectBasicRecovery(); | ||
onOnboardingPage.waitForConfirmationOnDevice(); | ||
cy.wait(1000); | ||
cy.task('pressYes'); | ||
cy.wait(1000); | ||
}); | ||
|
||
cy.step('Disconnect device', () => { | ||
cy.task('stopEmu'); | ||
cy.wait(500); | ||
onConnectDevicePrompt.waitForConnectDevicePrompt(); | ||
cy.task('startEmu', { model: 'T1B1', version: '1-latest', wipe: false }); | ||
}); | ||
|
||
cy.step('Check that you can retry', () => { | ||
onOnboardingPage.retryRecovery(); | ||
onRecoverPage.selectWordCount(24); | ||
onRecoverPage.selectBasicRecovery(); | ||
onOnboardingPage.waitForConfirmationOnDevice(); | ||
}); | ||
}); | ||
}); | ||
|
||
export {}; |
82 changes: 82 additions & 0 deletions
82
packages/suite-web/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,82 @@ | ||
// @group_device-management | ||
// @retry=2 | ||
|
||
import { onOnboardingPage } from '../../../support/pageObjects/onboardingObject'; | ||
import { onWordInputPage } from '../../../support/pageObjects/wordInputObject'; | ||
import { onAnalyticsPage } from '../../../support/pageObjects/analyticsObject'; | ||
import { onRecoverPage } from '../../../support/pageObjects/recoverObject'; | ||
|
||
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', | ||
]; | ||
|
||
describe('Onboarding - recover wallet T1B1', () => { | ||
beforeEach(() => { | ||
cy.task('startBridge'); | ||
cy.task('startEmu', { model: 'T1B1', version: '1-latest', wipe: true }); | ||
cy.viewport(1440, 2560).resetDb(); | ||
cy.prefixedVisit('/'); | ||
cy.disableFirmwareHashCheck(); | ||
|
||
cy.step('Go through analytics and confirm firmware', () => { | ||
onAnalyticsPage.continue(); | ||
onAnalyticsPage.continue(); | ||
}); | ||
}); | ||
|
||
it('Successfully recovers wallet from mnemonic', () => { | ||
cy.step('Start wallet recovery process and confirm on device', () => { | ||
onOnboardingPage.continueFirmware(); | ||
onOnboardingPage.recoverWallet(); | ||
onRecoverPage.selectWordCount(24); | ||
onRecoverPage.selectBasicRecovery(); | ||
onOnboardingPage.waitForConfirmationOnDevice(); | ||
cy.wait(2000); | ||
cy.task('pressYes'); | ||
}); | ||
|
||
cy.step('Input mnemonic', () => { | ||
for (let i = 0; i < 24; i++) { | ||
cy.task('getDebugState').then(state => { | ||
// @ts-expect-error | ||
const position = state.recovery_word_pos - 1; | ||
onWordInputPage.inputWord(mnemonic[position]); | ||
}); | ||
|
||
cy.wait(500); | ||
} | ||
}); | ||
|
||
cy.step('Finalize recovery, skip pin and check success', () => { | ||
onOnboardingPage.continueRecovery(); | ||
onOnboardingPage.skipPin(); | ||
onOnboardingPage.continueCoins(); | ||
onOnboardingPage.checkOnboardingSuccess(); | ||
}); | ||
}); | ||
}); | ||
|
||
export {}; |
46 changes: 0 additions & 46 deletions
46
packages/suite-web/e2e/tests/onboarding/t2t1-recovery-success.test.ts
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
Oops, something went wrong.