Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | import { createTestSelector, repeatAction } from '../integration-helpers'; import { OnboardingSelector } from './onboarding.selectors'; import type { Page } from 'playwright'; export function createOnboardingFeature(page: Page) { return { async findTermsOfServiceTitle() { // force top of page await repeatAction(100)(() => page.keyboard.press('Shift+Space')); const selector = 'text="Terms of Service"'; return page.$(selector); }, findAcceptDiagnosticsBtn() { return page.$(createTestSelector(OnboardingSelector.BtnAcceptDiagnosticPermission)); }, findAcceptBtn() { return page.$(createTestSelector(OnboardingSelector.BtnAcceptTerms)); }, findResoreWalletBtn() { return page.$(createTestSelector(OnboardingSelector.BtnRestoreWallet)); }, findSecretKeyInput() { return page.$(createTestSelector(OnboardingSelector.InputSecretKey)); }, findContinueWithSecretKeyBtn() { return page.$(createTestSelector(OnboardingSelector.BtnContinueWithKey)); }, findPasswordInput() { return page.$(createTestSelector(OnboardingSelector.InputPassword)); }, findContinueWithPasswordBtn() { return page.$(createTestSelector(OnboardingSelector.BtnContinueFromPassword)); }, }; } export function initSoftwareWallet(page: Page) { return async (seed: string, password: string) => { const onboarding = createOnboardingFeature(page); const termsOfServicePageTitle = await onboarding.findTermsOfServiceTitle(); Iif (!termsOfServicePageTitle) { expect(termsOfServicePageTitle).toBeTruthy(); throw new Error('Test not started in clean environment, loaded a `config.json`'); } // Scroll down await repeatAction(1000)(() => page.keyboard.down('Space')); const button = await onboarding.findAcceptBtn(); Iif (!button) throw new Error('Should be defined.'); await button.click(); const diagnosticPermissionBtn = await onboarding.findAcceptDiagnosticsBtn(); Iif (!diagnosticPermissionBtn) throw new Error('Should be defined.'); await diagnosticPermissionBtn.click(); const restoreWalletButton = await onboarding.findResoreWalletBtn(); Iif (!restoreWalletButton) throw new Error('Should be defined.'); await restoreWalletButton.click(); const input = await onboarding.findSecretKeyInput(); Iif (!input) throw new Error('Should be defined.'); await input.type(seed); const continueWithSecretKey = await onboarding.findContinueWithSecretKeyBtn(); Iif (!continueWithSecretKey) throw new Error('Should be defined.'); await continueWithSecretKey.click(); const passwordInput = await onboarding.findPasswordInput(); Iif (!passwordInput) throw new Error('Should be defined.'); await passwordInput.type(password); const continueWithPassword = await onboarding.findContinueWithPasswordBtn(); Iif (!continueWithPassword) throw new Error('Should be defined.'); await continueWithPassword.click(); }; } |