Skip to content

Commit

Permalink
test(suite-web): add a test for t3t1 multishare backup
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 authored and HajekOndrej committed Oct 11, 2024
1 parent cb2d5d1 commit d0683e0
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// @group_device-management
// @retry=2

const mnemonic =
'academic again academic academic academic academic academic academic academic academic academic academic academic academic academic academic academic pecan provide remember';
describe('Backup success', () => {
beforeEach(() => {
cy.task('startEmu', { wipe: true, model: 'T3T1', version: '2.8.1' });
cy.task('setupEmu', {
needs_backup: false,
mnemonic,
});
cy.task('startBridge');

cy.viewport('macbook-15').resetDb();
cy.prefixedVisit('/');
cy.getTestElement('@analytics/continue-button', { timeout: 40000 })
.click()
.getTestElement('@onboarding/exit-app-button')
.click();
cy.passThroughAuthenticityCheck();
cy.getTestElement('@onboarding/viewOnly/enable').click();
cy.getTestElement('@viewOnlyTooltip/gotIt', { timeout: 15000 })
.should('be.visible')
.click();
// navigate to device settings page
cy.getTestElement('@suite/menu/settings').click();
cy.getTestElement('@settings/menu/device').click();

cy.getTestElement('@settings/device/create-multi-share-backup-button').click();
cy.getTestElement('@multi-share-backup/checkbox/1').click();
cy.getTestElement('@multi-share-backup/checkbox/2').click();
cy.getTestElement('@multi-share-backup/1st-info/submit-button').click();
cy.getTestElement('@multi-share-backup/2nd-info/submit-button').click();

// cy.pause();
// [device screen] check your backup?
cy.task('swipeEmu', 'up');
// cy.pause();

// [device screen] select the number of words in your backup
cy.task('inputEmu', '20');
// cy.pause();

// [device screen] backup instructions
cy.task('swipeEmu', 'up');
for (const m of mnemonic.split(' ')) {
// [device screen] enter next word
cy.task('inputEmu', m);
}
// [device screen] create additional backup?
cy.wait(1000); // without this timeout, backup on device simply disappears, it stinks
cy.task('swipeEmu', 'up');
// [device screen] your wallet backup contains multiple lists of words in a specific order (shares)
cy.task('swipeEmu', 'up');
// [device screen] multi share backup steps overview
cy.task('swipeEmu', 'up');
// [device screen] set number of shares
cy.task('swipeEmu', 'up');
// [device screen] multi share backup steps overview (2. set threshold)
cy.task('swipeEmu', 'up');
// [device screen] set threshold
cy.task('swipeEmu', 'up');
// [device screen] multi share backup steps overview (write down and check)
cy.task('swipeEmu', 'up');
// [device screen] never put your digital backup anywhere digital!
cy.task('swipeEmu', 'up');
// [device screen] instructions - start with share 1
cy.task('swipeEmu', 'up');
cy.wait(500);

// TODO: uf, readAndConfirmMnemonicEmu doesn't work as expected. I could do it using getDebugState
// but it would be reinventing the wheel. Lets wait for Jiri to help with it.
cy.task('getDebugState', _event => {});
});

it('Successful backup happy path', () => {
// access from notification
// cy.pause();
});
});

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ export const MultiShareBackupModal = ({ onCancel }: MultiShareBackupModalProps)
),
bottomBarComponents: (
<>
<Button onClick={goToStepNextStep}>
<Button
onClick={goToStepNextStep}
data-testid="@multi-share-backup/1st-info/submit-button"
>
<Translation id="TR_CREATE_MULTI_SHARE_BACKUP" />
</Button>
<LearnMoreButton
Expand Down Expand Up @@ -142,7 +145,10 @@ export const MultiShareBackupModal = ({ onCancel }: MultiShareBackupModalProps)
children: <MultiShareBackupStep2SecondInfo />,
bottomBarComponents: (
<>
<Button onClick={enterBackup}>
<Button
onClick={enterBackup}
data-testid="@multi-share-backup/2nd-info/submit-button"
>
<Translation id="TR_ENTER_EXISTING_BACKUP" />
</Button>
<LearnMoreButton url={TREZOR_SUPPORT_RECOVERY_ISSUES_URL} size="medium">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ export const MultiShareBackupStep1FirstInfo = ({
isChecked={isChecked1}
onClick={toggleCheckbox1}
variant={checkboxVariant1}
data-testid={`@multi-share-backup/checkbox/1`}
>
<Translation id="TR_MULTI_SHARE_BACKUP_CHECKBOX_1" />
</Checkbox>
<Checkbox
isChecked={isChecked2}
onClick={toggleCheckbox2}
variant={checkboxVariant2}
data-testid={`@multi-share-backup/checkbox/2`}
>
<Translation id="TR_MULTI_SHARE_BACKUP_CHECKBOX_2" />
</Checkbox>
Expand Down

0 comments on commit d0683e0

Please sign in to comment.