Skip to content

Commit 84bd8f5

Browse files
HajekOndrejmroz22
authored andcommitted
fix(e2e): Fixed and updated t1b1 seed check test
1 parent b45a147 commit 84bd8f5

File tree

6 files changed

+91
-24
lines changed

6 files changed

+91
-24
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export enum SeedCheckType {
2+
Advanced = 'advanced',
3+
Standard = 'basic',
4+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference types="cypress" />
2+
3+
import { SeedCheckType } from '../enums/seedCheckType';
4+
5+
class CheckSeedPage {
6+
initCheck(type: SeedCheckType, numOfWords: 12 | 24): void {
7+
cy.getTestElement('@recovery/user-understands-checkbox').click();
8+
cy.getTestElement('@recovery/start-button').click();
9+
cy.getTestElement(`@recover/select-count/${numOfWords}`).click();
10+
cy.getTestElement(`@recover/select-type/${type}`).click();
11+
}
12+
13+
verifyCheckSuccessful(): void {
14+
cy.getTestElement('@recovery/success-title').should('be.visible');
15+
}
16+
}
17+
18+
export const onCheckSeedPage = new CheckSeedPage();

packages/suite-web/e2e/support/pageObjects/settings/settingsDeviceObject.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/// <reference types="cypress" />
22

33
class SettingsDevicePage {
4+
openSeedCheck(): void {
5+
cy.getTestElement('@settings/device/check-seed-button').click();
6+
}
7+
48
openCreateMultiShareBackup(): void {
59
cy.getTestElement('@settings/device/create-multi-share-backup-button')
610
.should('be.visible')

packages/suite-web/e2e/support/pageObjects/wordInputObject.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ class WordInputPage {
55
cy.getTestElement('@word-input-select/input').type(word);
66
cy.getTestElement(`@word-input-select/option/${word}`).click();
77
}
8+
9+
inputMnemonicT1B1(mnemonic: string[]) {
10+
cy.step('Input mnemonic', () => {
11+
for (let i = 0; i < 24; i++) {
12+
cy.task('getDebugState').then(state => {
13+
// @ts-expect-error
14+
const position = state.recovery_word_pos - 1;
15+
this.inputWord(mnemonic[position]);
16+
});
17+
18+
cy.wait(500);
19+
}
20+
});
21+
}
822
}
923

1024
export const onWordInputPage = new WordInputPage();

packages/suite-web/e2e/tests/onboarding/t1b1/t1b1-recovery-success.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,7 @@ describe('Onboarding - recover wallet T1B1', () => {
5858
cy.task('pressYes');
5959
});
6060

61-
cy.step('Input mnemonic', () => {
62-
for (let i = 0; i < 24; i++) {
63-
cy.task('getDebugState').then(state => {
64-
// @ts-expect-error
65-
const position = state.recovery_word_pos - 1;
66-
onWordInputPage.inputWord(mnemonic[position]);
67-
});
68-
69-
cy.wait(500);
70-
}
71-
});
61+
onWordInputPage.inputMnemonicT1B1(mnemonic);
7262

7363
cy.step('Finalize recovery, skip pin and check success', () => {
7464
onOnboardingPage.continueRecovery();
Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,63 @@
11
// @group_device-management
22

3-
describe.skip('Recovery - dry run', () => {
3+
import { SeedCheckType } from '../../support/enums/seedCheckType';
4+
import { onCheckSeedPage } from '../../support/pageObjects/checkSeedObject';
5+
import { onSettingsDevicePage } from '../../support/pageObjects/settings/settingsDeviceObject';
6+
import { onSettingsMenu } from '../../support/pageObjects/settings/settingsMenuObject';
7+
import { onNavBar } from '../../support/pageObjects/topBarObject';
8+
import { onWordInputPage } from '../../support/pageObjects/wordInputObject';
9+
10+
const mnemonic = [
11+
'nasty',
12+
'answer',
13+
'gentle',
14+
'inform',
15+
'unaware',
16+
'abandon',
17+
'regret',
18+
'supreme',
19+
'dragon',
20+
'gravity',
21+
'behind',
22+
'lava',
23+
'dose',
24+
'pilot',
25+
'garden',
26+
'into',
27+
'dynamic',
28+
'outer',
29+
'hard',
30+
'speed',
31+
'luxury',
32+
'run',
33+
'truly',
34+
'armed',
35+
];
36+
37+
function confirmSuccessOnDevice(): void {
38+
cy.task('pressYes');
39+
}
40+
41+
describe('Recovery T1B1 - dry run', () => {
442
beforeEach(() => {
543
cy.task('startEmu', { model: 'T1B1', version: '1-latest', wipe: true });
644
cy.wait(2000);
7-
cy.task('setupEmu', { needs_backup: false });
45+
cy.task('setupEmu', { needs_backup: false, mnemonic: mnemonic.join(' ') });
846
cy.task('startBridge');
9-
cy.viewport(1440, 2560).resetDb();
10-
cy.prefixedVisit('/settings/device');
47+
cy.viewport('macbook-13').resetDb();
48+
cy.prefixedVisit('/');
1149
cy.passThroughInitialRun();
50+
onNavBar.openSettings();
51+
onSettingsMenu.openDeviceSettings();
1252
});
1353

14-
it('Dry run with T1B1', () => {
15-
cy.getTestElement('@settings/device/check-seed-button').click();
16-
cy.getTestElement('@recovery/user-understands-checkbox').click();
17-
cy.getTestElement('@recovery/start-button').click();
54+
it('Standard dry run', () => {
55+
onSettingsDevicePage.openSeedCheck();
56+
onCheckSeedPage.initCheck(SeedCheckType.Standard, 24);
57+
onWordInputPage.inputMnemonicT1B1(mnemonic);
1858

19-
cy.getTestElement('@recover/select-count/24').click();
20-
cy.getTestElement('@recover/select-type/advanced').click();
21-
cy.task('pressYes');
22-
cy.getTestElement('@recovery/word-input-advanced/1');
59+
confirmSuccessOnDevice();
2360

24-
// todo: elaborate more, seems like finally T1B1 tests are stable so it would make finally sense to finish this
61+
onCheckSeedPage.verifyCheckSuccessful();
2562
});
2663
});

0 commit comments

Comments
 (0)