|
| 1 | +import { EventType } from '@trezor/suite-analytics'; |
| 2 | +import { ExtractByEventType } from '@trezor/suite-web/e2e/support/types'; |
| 3 | + |
| 4 | +import { expect, test } from '../../support/fixtures'; |
| 5 | + |
| 6 | +test.describe('Backup success', { tag: ['@group=device-management'] }, () => { |
| 7 | + test.use({ |
| 8 | + emulatorStartConf: { model: 'T2T1', wipe: true }, |
| 9 | + emulatorSetupConf: { needs_backup: true, mnemonic: 'mnemonic_all' }, |
| 10 | + }); |
| 11 | + |
| 12 | + test.beforeEach(async ({ onboardingPage, analytics }) => { |
| 13 | + await analytics.interceptAnalytics(); |
| 14 | + await onboardingPage.completeOnboarding(); |
| 15 | + }); |
| 16 | + |
| 17 | + test('Successful backup happy path', async ({ |
| 18 | + analytics, |
| 19 | + onboardingPage, |
| 20 | + dashboardPage, |
| 21 | + devicePrompt, |
| 22 | + trezorUserEnvLink, |
| 23 | + }) => { |
| 24 | + // access from notification |
| 25 | + await dashboardPage.notificationNoBackupButton.click(); |
| 26 | + |
| 27 | + await onboardingPage.backup.undertandWhatSeedIsCheckbox.click(); |
| 28 | + await onboardingPage.backup.hasEnoughTimeCheckbox.click(); |
| 29 | + await onboardingPage.backup.isInPrivateCheckbox.click(); |
| 30 | + |
| 31 | + // Create backup on device |
| 32 | + await onboardingPage.backup.startButton.click(); |
| 33 | + |
| 34 | + await devicePrompt.confirmOnDevicePromptIsShown(); |
| 35 | + |
| 36 | + //await trezorUserEnvLink.readAndConfirmMnemonicEmu(); should be used here, but it is flaky |
| 37 | + // TODO: https://github.com/trezor/trezor-suite/issues/17148 |
| 38 | + await trezorUserEnvLink.pressYes(); |
| 39 | + await trezorUserEnvLink.pressYes(); |
| 40 | + await trezorUserEnvLink.swipeEmu('up'); |
| 41 | + await trezorUserEnvLink.swipeEmu('up'); |
| 42 | + await trezorUserEnvLink.pressYes(); |
| 43 | + await trezorUserEnvLink.inputEmu('all'); |
| 44 | + await trezorUserEnvLink.inputEmu('all'); |
| 45 | + await trezorUserEnvLink.inputEmu('all'); |
| 46 | + await trezorUserEnvLink.pressYes(); |
| 47 | + await trezorUserEnvLink.pressYes(); |
| 48 | + |
| 49 | + // Click all after checkboxes and close backup modal |
| 50 | + await expect(onboardingPage.backup.closeButton).toBeDisabled(); |
| 51 | + await onboardingPage.backup.wroteSeedProperlyCheckbox.click(); |
| 52 | + await onboardingPage.backup.madeNoDigitalCopyCheckbox.click(); |
| 53 | + await onboardingPage.backup.willHideSeedCheckbox.click(); |
| 54 | + await expect(onboardingPage.backup.closeButton).toBeEnabled(); |
| 55 | + |
| 56 | + const createBackupEvent = analytics.findAnalyticsEventByType< |
| 57 | + ExtractByEventType<EventType.CreateBackup> |
| 58 | + >(EventType.CreateBackup); |
| 59 | + expect(createBackupEvent.status).toEqual('finished'); |
| 60 | + expect(createBackupEvent.error).toEqual(''); |
| 61 | + }); |
| 62 | +}); |
0 commit comments