From 461ca58184c60401edd9af1c21f5d536580e4118 Mon Sep 17 00:00:00 2001 From: Daniel Izdebski Date: Tue, 7 Nov 2023 01:25:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20chore(metamask):=20Move=20onboar?= =?UTF-8?q?ding=20selectors=20to=20page=20class=20(#983)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/helpers/confirmSecretRecoveryPhrase.ts | 2 +- .../pages/OnboardingPage/actions/helpers/createPassword.ts | 2 +- .../src/pages/OnboardingPage/actions/importWallet.ts | 2 +- wallets/metamask/src/pages/OnboardingPage/page.ts | 2 ++ .../OnboardingPage/selectors}/analyticsPage.ts | 2 +- .../OnboardingPage/selectors}/getStartedPage.ts | 2 +- .../onboarding => pages/OnboardingPage/selectors}/index.ts | 0 .../OnboardingPage/selectors}/pinExtensionPage.ts | 2 +- .../OnboardingPage/selectors}/secretRecoveryPhrasePage.ts | 2 +- .../OnboardingPage/selectors/walletCreationSuccessPage.ts | 5 +++++ wallets/metamask/src/selectors/index.ts | 1 - .../src/selectors/onboarding/walletCreationSuccessPage.ts | 5 ----- 12 files changed, 14 insertions(+), 13 deletions(-) rename wallets/metamask/src/{selectors/onboarding => pages/OnboardingPage/selectors}/analyticsPage.ts (60%) rename wallets/metamask/src/{selectors/onboarding => pages/OnboardingPage/selectors}/getStartedPage.ts (63%) rename wallets/metamask/src/{selectors/onboarding => pages/OnboardingPage/selectors}/index.ts (100%) rename wallets/metamask/src/{selectors/onboarding => pages/OnboardingPage/selectors}/pinExtensionPage.ts (61%) rename wallets/metamask/src/{selectors/onboarding => pages/OnboardingPage/selectors}/secretRecoveryPhrasePage.ts (91%) create mode 100644 wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts delete mode 100644 wallets/metamask/src/selectors/onboarding/walletCreationSuccessPage.ts diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts b/wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts index cf3162b5d..2a4936a6f 100644 --- a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts +++ b/wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts @@ -1,5 +1,5 @@ import type { Page } from '@playwright/test' -import { SecretRecoveryPhrasePageSelectors } from '../../../../selectors' +import { SecretRecoveryPhrasePageSelectors } from '../../selectors' const StepSelectors = SecretRecoveryPhrasePageSelectors.recoveryStep diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts b/wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts index 43c27f23a..028a1974e 100644 --- a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts +++ b/wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts @@ -1,5 +1,5 @@ import type { Page } from '@playwright/test' -import { SecretRecoveryPhrasePageSelectors } from '../../../../selectors' +import { SecretRecoveryPhrasePageSelectors } from '../../selectors' const StepSelectors = SecretRecoveryPhrasePageSelectors.passwordStep diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts b/wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts index 82dab6afe..f84a5ea62 100644 --- a/wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts +++ b/wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts @@ -4,7 +4,7 @@ import { GetStartedPageSelectors, PinExtensionPageSelectors, WalletCreationSuccessPageSelectors -} from '../../../selectors' +} from '../selectors' import { confirmSecretRecoveryPhrase, createPassword } from './helpers' export async function importWallet(page: Page, seedPhrase: string, password: string) { diff --git a/wallets/metamask/src/pages/OnboardingPage/page.ts b/wallets/metamask/src/pages/OnboardingPage/page.ts index 0384c7211..dfafe9177 100644 --- a/wallets/metamask/src/pages/OnboardingPage/page.ts +++ b/wallets/metamask/src/pages/OnboardingPage/page.ts @@ -1,8 +1,10 @@ import type { Page } from '@playwright/test' import { importWallet } from './actions' +import * as Selectors from './selectors' export class OnboardingPage { readonly page: Page + readonly selectors = Selectors constructor(page: Page) { this.page = page diff --git a/wallets/metamask/src/selectors/onboarding/analyticsPage.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/analyticsPage.ts similarity index 60% rename from wallets/metamask/src/selectors/onboarding/analyticsPage.ts rename to wallets/metamask/src/pages/OnboardingPage/selectors/analyticsPage.ts index 6f807d41e..5051b9152 100644 --- a/wallets/metamask/src/selectors/onboarding/analyticsPage.ts +++ b/wallets/metamask/src/pages/OnboardingPage/selectors/analyticsPage.ts @@ -1,4 +1,4 @@ -import { createDataTestSelector } from '../../utils/selectors/createDataTestSelector' +import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector' export default { optIn: createDataTestSelector('metametrics-i-agree'), diff --git a/wallets/metamask/src/selectors/onboarding/getStartedPage.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/getStartedPage.ts similarity index 63% rename from wallets/metamask/src/selectors/onboarding/getStartedPage.ts rename to wallets/metamask/src/pages/OnboardingPage/selectors/getStartedPage.ts index c7aa4d24c..37e2b735f 100644 --- a/wallets/metamask/src/selectors/onboarding/getStartedPage.ts +++ b/wallets/metamask/src/pages/OnboardingPage/selectors/getStartedPage.ts @@ -1,4 +1,4 @@ -import { createDataTestSelector } from '../../utils/selectors/createDataTestSelector' +import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector' export default { createNewWallet: createDataTestSelector('onboarding-create-wallet'), diff --git a/wallets/metamask/src/selectors/onboarding/index.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/index.ts similarity index 100% rename from wallets/metamask/src/selectors/onboarding/index.ts rename to wallets/metamask/src/pages/OnboardingPage/selectors/index.ts diff --git a/wallets/metamask/src/selectors/onboarding/pinExtensionPage.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/pinExtensionPage.ts similarity index 61% rename from wallets/metamask/src/selectors/onboarding/pinExtensionPage.ts rename to wallets/metamask/src/pages/OnboardingPage/selectors/pinExtensionPage.ts index 9a737d94a..b0a0d5eda 100644 --- a/wallets/metamask/src/selectors/onboarding/pinExtensionPage.ts +++ b/wallets/metamask/src/pages/OnboardingPage/selectors/pinExtensionPage.ts @@ -1,4 +1,4 @@ -import { createDataTestSelector } from '../../utils/selectors/createDataTestSelector' +import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector' export default { nextButton: createDataTestSelector('pin-extension-next'), diff --git a/wallets/metamask/src/selectors/onboarding/secretRecoveryPhrasePage.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/secretRecoveryPhrasePage.ts similarity index 91% rename from wallets/metamask/src/selectors/onboarding/secretRecoveryPhrasePage.ts rename to wallets/metamask/src/pages/OnboardingPage/selectors/secretRecoveryPhrasePage.ts index 4d0a92339..3f97cd933 100644 --- a/wallets/metamask/src/selectors/onboarding/secretRecoveryPhrasePage.ts +++ b/wallets/metamask/src/pages/OnboardingPage/selectors/secretRecoveryPhrasePage.ts @@ -1,4 +1,4 @@ -import { createDataTestSelector } from '../../utils/selectors/createDataTestSelector' +import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector' const recoveryStep = { selectNumberOfWordsDropdown: '.import-srp__number-of-words-dropdown > .dropdown__select', diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts new file mode 100644 index 000000000..b3ad52380 --- /dev/null +++ b/wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts @@ -0,0 +1,5 @@ +import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector' + +export default { + confirmButton: createDataTestSelector('onboarding-complete-done') +} diff --git a/wallets/metamask/src/selectors/index.ts b/wallets/metamask/src/selectors/index.ts index 7159570b7..b5113d2b8 100644 --- a/wallets/metamask/src/selectors/index.ts +++ b/wallets/metamask/src/selectors/index.ts @@ -1,4 +1,3 @@ -export * from './onboarding' export * from './unlocking' export * from './loading' export * from './crash' diff --git a/wallets/metamask/src/selectors/onboarding/walletCreationSuccessPage.ts b/wallets/metamask/src/selectors/onboarding/walletCreationSuccessPage.ts deleted file mode 100644 index 0b6315f1c..000000000 --- a/wallets/metamask/src/selectors/onboarding/walletCreationSuccessPage.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createDataTestSelector } from '../../utils/selectors/createDataTestSelector' - -export default { - confirmButton: createDataTestSelector('onboarding-complete-done') -}