From 5544f2192e2e71b5e83c2792a436f0c2434a9385 Mon Sep 17 00:00:00 2001
From: Mat <63294765+matstyler@users.noreply.github.com>
Date: Thu, 18 Jul 2024 21:53:39 +0200
Subject: [PATCH] :sparkles: feat: MetaMask setup in Cypress (#1157)
* feat: MetaMask setup in Cypress part 1
* feat: wallet setup is working as expected
* fix: gitignore cleanup
* fix: clean imports
* fix: export from metamask package
* fix: dependencies issues
* fix: cleanup
* fix: test scripts
* fix: format
* fix: renamed configureBeforeSynpress.ts to configureSynpress.ts
* fix: metamask output dir
---
.github/workflows/test.yml | 2 +-
.gitignore | 3 +
biome.json | 3 +-
examples/new-dawn/README.md | 6 +-
examples/new-dawn/cypress.config.ts | 4 +-
examples/new-dawn/package.json | 10 +-
examples/new-dawn/tsconfig.json | 3 +-
package.json | 4 +-
pnpm-lock.yaml | 57 +++-
release/src/cypress/index.ts | 1 +
release/src/playwright/index.ts | 2 +-
turbo.json | 4 +-
.../ethereum-wallet-mock/cypress.config.ts | 4 +-
wallets/ethereum-wallet-mock/package.json | 9 +-
.../ethereum-wallet-mock/src/cypress/index.ts | 2 +-
...nstallSynpress.ts => configureSynpress.ts} | 2 +-
wallets/metamask/cypress.config.ts | 15 +
wallets/metamask/package.json | 24 +-
wallets/metamask/playwright.config.ts | 2 +-
wallets/metamask/src/cypress/MetaMask.ts | 11 +
.../metamask/src/cypress/configureSynpress.ts | 31 +++
wallets/metamask/src/cypress/index.ts | 1 +
wallets/metamask/src/cypress/support/e2e.ts | 28 ++
.../cypress/support/importMetaMaskWallet.ts | 28 ++
.../src/cypress/support/initMetaMask.ts | 13 +
.../src/cypress/support/synpressCommands.ts | 20 ++
wallets/metamask/src/index.ts | 3 -
.../selectors/walletCreationSuccessPage.ts | 5 -
.../metamask/src/{ => playwright}/MetaMask.ts | 183 +-----------
.../fixture-actions/getExtensionId.ts | 0
.../{ => playwright}/fixture-actions/index.ts | 0
.../fixture-actions/persistLocalStorage.ts | 0
.../fixture-actions/prepareExtension.ts | 0
.../fixture-actions/unlockForFixture.ts | 0
.../fixtures/metaMaskFixtures.ts | 5 +-
wallets/metamask/src/playwright/index.ts | 3 +
.../{ => playwright}/pages/CrashPage/page.ts | 2 +-
.../pages/HomePage/actions/addNetwork.ts | 2 +-
.../pages/HomePage/actions/addNewAccount.ts | 2 +-
.../HomePage/actions/getAccountAddress.ts | 2 +-
.../actions/importWalletFromPrivateKey.ts | 2 +-
.../pages/HomePage/actions/index.ts | 0
.../pages/HomePage/actions/lock.ts | 3 +-
.../popups/closeNetworkAddedPopover.ts | 2 +-
.../popups/closeNewNetworkInfoPopover.ts | 2 +-
.../HomePage/actions/popups/closePopover.ts | 2 +-
.../popups/closeRecoveryPhraseReminder.ts | 2 +-
.../pages/HomePage/actions/popups/index.ts | 0
.../pages/HomePage/actions/renameAccount.ts | 2 +-
.../pages/HomePage/actions/settings.ts | 4 +-
.../pages/HomePage/actions/switchAccount.ts | 2 +-
.../pages/HomePage/actions/switchNetwork.ts | 2 +-
.../actions/toggleShowTestNetworks.ts | 2 +-
.../HomePage/actions/transactionDetails.ts | 2 +-
.../{ => playwright}/pages/HomePage/page.ts | 4 +-
.../pages/LockPage/actions/index.ts | 0
.../pages/LockPage/actions/unlock.ts | 2 +-
.../{ => playwright}/pages/LockPage/page.ts | 2 +-
.../actions/approvePermission.ts | 2 +-
.../NotificationPage/actions/connectToDapp.ts | 2 +-
.../NotificationPage/actions/encryption.ts | 2 +-
.../pages/NotificationPage/actions/index.ts | 0
.../pages/NotificationPage/actions/network.ts | 2 +-
.../actions/signSimpleMessage.ts | 2 +-
.../actions/signStructuredMessage.ts | 2 +-
.../pages/NotificationPage/actions/token.ts | 2 +-
.../NotificationPage/actions/transaction.ts | 4 +-
.../pages/NotificationPage/page.ts | 2 +-
.../helpers/confirmSecretRecoveryPhrase.ts | 2 +-
.../actions/helpers/createPassword.ts | 2 +-
.../OnboardingPage/actions/helpers/index.ts | 0
.../OnboardingPage/actions/importWallet.ts | 6 +-
.../pages/OnboardingPage/actions/index.ts | 0
.../pages/OnboardingPage/page.ts | 2 +-
.../SettingsPage/actions/disableEthSign.ts | 2 +-
.../SettingsPage/actions/enableEthSign.ts | 2 +-
.../pages/SettingsPage/actions/index.ts | 0
.../pages/SettingsPage/page.ts | 2 +-
.../src/{ => playwright}/pages/index.ts | 0
.../{ => playwright}/utils/allTextContents.ts | 0
.../utils/clickLocatorIfCondition.ts | 0
.../getNotificationPageAndWaitForLoad.ts | 0
.../src/{ => playwright}/utils/toggle.ts | 0
.../src/{ => playwright}/utils/waitFor.ts | 3 +-
.../utils/waitForSpinnerToVanish.ts | 2 +-
.../{fixture-actions => }/prepareExtension.ts | 17 +-
.../selectors/createDataTestSelector.ts | 0
wallets/metamask/src/selectors/index.ts | 7 +
.../pages/CrashPage}/index.ts | 0
.../pages/HomePage}/index.ts | 2 +-
.../pages/HomePage}/settings.ts | 2 +-
.../pages/LockPage}/index.ts | 2 +-
.../pages/NotificationPage}/actionFooter.ts | 2 +-
.../pages/NotificationPage}/connectPage.ts | 0
.../pages/NotificationPage}/index.ts | 0
.../pages/NotificationPage}/networkPage.ts | 0
.../pages/NotificationPage}/permissionPage.ts | 2 +-
.../pages/NotificationPage}/signaturePage.ts | 2 +-
.../NotificationPage}/transactionPage.ts | 2 +-
.../pages/OnboardingPage}/analyticsPage.ts | 2 +-
.../pages/OnboardingPage}/getStartedPage.ts | 2 +-
.../pages/OnboardingPage}/index.ts | 0
.../pages/OnboardingPage}/pinExtensionPage.ts | 2 +-
.../secretRecoveryPhrasePage.ts | 2 +-
.../walletCreationSuccessPage.ts | 5 +
.../pages/SettingsPage}/index.ts | 2 +-
wallets/metamask/src/type/MetaMaskAbstract.ts | 262 ++++++++++++++++++
wallets/metamask/test/cypress/metamask.cy.ts | 12 +
.../test/{ => playwright}/e2e/PPOM.spec.ts | 4 +-
.../{ => playwright}/e2e/addNetwork.spec.ts | 2 +-
.../e2e/addNewAccount.spec.ts | 2 +-
.../{ => playwright}/e2e/addNewToken.spec.ts | 2 +-
.../e2e/approveNewNetwork.spec.ts | 0
.../e2e/approvePermission.spec.ts | 0
.../e2e/approveSwitchNetwork.spec.ts | 0
.../e2e/batchTransfer.spec.ts | 0
.../e2e/closeTransactionDetails.spec.ts | 0
.../e2e/confirmSignature.spec.ts | 0
.../e2e/confirmTransaction.spec.ts | 0
...confirmTransactionAndWaitForMining.spec.ts | 0
.../e2e/connectToDapp.spec.ts | 2 +-
.../test/{ => playwright}/e2e/encrypt.spec.ts | 0
.../e2e/goBackToHomePage.spec.ts | 2 +-
.../{ => playwright}/e2e/importWallet.spec.ts | 3 +-
.../e2e/importWalletFromPrivateKey.spec.ts | 2 +-
.../test/{ => playwright}/e2e/lock.spec.ts | 2 +-
.../{ => playwright}/e2e/openSettings.spec.ts | 2 +-
.../e2e/openSidebarMenu.spec.ts | 2 +-
.../e2e/openTransactionDetails.spec.ts | 0
.../e2e/rejectAddNetwork.spec.ts | 0
.../e2e/rejectPermission.spec.ts | 0
.../e2e/rejectSignature.spec.ts | 0
.../e2e/rejectSwitchNetwork.spec.ts | 0
.../e2e/rejectTransaction.spec.ts | 0
.../e2e/renameAccount.spec.ts | 2 +-
.../{ => playwright}/e2e/resetAccount.spec.ts | 2 +-
.../e2e/switchAccount.spec.ts | 2 +-
.../e2e/switchNetwork.spec.ts | 2 +-
...ismissSecretRecoveryPhraseReminder.spec.ts | 4 +-
.../e2e/toggleShowTestNetworks.spec.ts | 4 +-
.../test/{ => playwright}/e2e/unlock.spec.ts | 2 +-
.../test/{ => playwright}/synpress.ts | 2 +-
.../wallet-setup/basic.setup.d.ts | 0
.../wallet-setup/basic.setup.d.ts.map | 0
.../wallet-setup/basic.setup.ts | 2 +-
.../wallet-setup/connected.setup.ts | 2 +-
.../test/unit/prepareExtension.test.ts | 3 +-
wallets/metamask/tsconfig.json | 12 +-
wallets/metamask/tsup.config.ts | 2 +-
149 files changed, 653 insertions(+), 314 deletions(-)
rename wallets/ethereum-wallet-mock/src/cypress/utils/{installSynpress.ts => configureSynpress.ts} (86%)
create mode 100644 wallets/metamask/cypress.config.ts
create mode 100644 wallets/metamask/src/cypress/MetaMask.ts
create mode 100644 wallets/metamask/src/cypress/configureSynpress.ts
create mode 100644 wallets/metamask/src/cypress/index.ts
create mode 100644 wallets/metamask/src/cypress/support/e2e.ts
create mode 100644 wallets/metamask/src/cypress/support/importMetaMaskWallet.ts
create mode 100644 wallets/metamask/src/cypress/support/initMetaMask.ts
create mode 100644 wallets/metamask/src/cypress/support/synpressCommands.ts
delete mode 100644 wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts
rename wallets/metamask/src/{ => playwright}/MetaMask.ts (59%)
rename wallets/metamask/src/{ => playwright}/fixture-actions/getExtensionId.ts (100%)
rename wallets/metamask/src/{ => playwright}/fixture-actions/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/fixture-actions/persistLocalStorage.ts (100%)
create mode 100644 wallets/metamask/src/playwright/fixture-actions/prepareExtension.ts
rename wallets/metamask/src/{ => playwright}/fixture-actions/unlockForFixture.ts (100%)
rename wallets/metamask/src/{ => playwright}/fixtures/metaMaskFixtures.ts (97%)
create mode 100644 wallets/metamask/src/playwright/index.ts
rename wallets/metamask/src/{ => playwright}/pages/CrashPage/page.ts (63%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/addNetwork.ts (97%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/addNewAccount.ts (92%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/getAccountAddress.ts (88%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/importWalletFromPrivateKey.ts (94%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/lock.ts (78%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts (89%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts (86%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/popups/closePopover.ts (89%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts (86%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/popups/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/renameAccount.ts (91%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/settings.ts (87%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/switchAccount.ts (94%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/switchNetwork.ts (96%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/toggleShowTestNetworks.ts (88%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/actions/transactionDetails.ts (94%)
rename wallets/metamask/src/{ => playwright}/pages/HomePage/page.ts (93%)
rename wallets/metamask/src/{ => playwright}/pages/LockPage/actions/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/LockPage/actions/unlock.ts (84%)
rename wallets/metamask/src/{ => playwright}/pages/LockPage/page.ts (85%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/approvePermission.ts (94%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/connectToDapp.ts (96%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/encryption.ts (83%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/network.ts (91%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/signSimpleMessage.ts (90%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/signStructuredMessage.ts (91%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/token.ts (75%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/actions/transaction.ts (98%)
rename wallets/metamask/src/{ => playwright}/pages/NotificationPage/page.ts (98%)
rename wallets/metamask/src/{ => playwright}/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts (93%)
rename wallets/metamask/src/{ => playwright}/pages/OnboardingPage/actions/helpers/createPassword.ts (92%)
rename wallets/metamask/src/{ => playwright}/pages/OnboardingPage/actions/helpers/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/OnboardingPage/actions/importWallet.ts (92%)
rename wallets/metamask/src/{ => playwright}/pages/OnboardingPage/actions/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/OnboardingPage/page.ts (86%)
rename wallets/metamask/src/{ => playwright}/pages/SettingsPage/actions/disableEthSign.ts (78%)
rename wallets/metamask/src/{ => playwright}/pages/SettingsPage/actions/enableEthSign.ts (92%)
rename wallets/metamask/src/{ => playwright}/pages/SettingsPage/actions/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/pages/SettingsPage/page.ts (87%)
rename wallets/metamask/src/{ => playwright}/pages/index.ts (100%)
rename wallets/metamask/src/{ => playwright}/utils/allTextContents.ts (100%)
rename wallets/metamask/src/{ => playwright}/utils/clickLocatorIfCondition.ts (100%)
rename wallets/metamask/src/{ => playwright}/utils/getNotificationPageAndWaitForLoad.ts (100%)
rename wallets/metamask/src/{ => playwright}/utils/toggle.ts (100%)
rename wallets/metamask/src/{ => playwright}/utils/waitFor.ts (97%)
rename wallets/metamask/src/{ => playwright}/utils/waitForSpinnerToVanish.ts (88%)
rename wallets/metamask/src/{fixture-actions => }/prepareExtension.ts (59%)
rename wallets/metamask/src/{utils => }/selectors/createDataTestSelector.ts (100%)
rename wallets/metamask/src/{pages/CrashPage/selectors => selectors/pages/CrashPage}/index.ts (100%)
rename wallets/metamask/src/{pages/HomePage/selectors => selectors/pages/HomePage}/index.ts (98%)
rename wallets/metamask/src/{pages/HomePage/selectors => selectors/pages/HomePage}/settings.ts (95%)
rename wallets/metamask/src/{pages/LockPage/selectors => selectors/pages/LockPage}/index.ts (60%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/actionFooter.ts (72%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/connectPage.ts (100%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/index.ts (100%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/networkPage.ts (100%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/permissionPage.ts (69%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/signaturePage.ts (88%)
rename wallets/metamask/src/{pages/NotificationPage/selectors => selectors/pages/NotificationPage}/transactionPage.ts (94%)
rename wallets/metamask/src/{pages/OnboardingPage/selectors => selectors/pages/OnboardingPage}/analyticsPage.ts (60%)
rename wallets/metamask/src/{pages/OnboardingPage/selectors => selectors/pages/OnboardingPage}/getStartedPage.ts (72%)
rename wallets/metamask/src/{pages/OnboardingPage/selectors => selectors/pages/OnboardingPage}/index.ts (100%)
rename wallets/metamask/src/{pages/OnboardingPage/selectors => selectors/pages/OnboardingPage}/pinExtensionPage.ts (61%)
rename wallets/metamask/src/{pages/OnboardingPage/selectors => selectors/pages/OnboardingPage}/secretRecoveryPhrasePage.ts (90%)
create mode 100644 wallets/metamask/src/selectors/pages/OnboardingPage/walletCreationSuccessPage.ts
rename wallets/metamask/src/{pages/SettingsPage/selectors => selectors/pages/SettingsPage}/index.ts (89%)
create mode 100644 wallets/metamask/src/type/MetaMaskAbstract.ts
create mode 100644 wallets/metamask/test/cypress/metamask.cy.ts
rename wallets/metamask/test/{ => playwright}/e2e/PPOM.spec.ts (93%)
rename wallets/metamask/test/{ => playwright}/e2e/addNetwork.spec.ts (97%)
rename wallets/metamask/test/{ => playwright}/e2e/addNewAccount.spec.ts (92%)
rename wallets/metamask/test/{ => playwright}/e2e/addNewToken.spec.ts (93%)
rename wallets/metamask/test/{ => playwright}/e2e/approveNewNetwork.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/approvePermission.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/approveSwitchNetwork.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/batchTransfer.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/closeTransactionDetails.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/confirmSignature.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/confirmTransaction.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/confirmTransactionAndWaitForMining.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/connectToDapp.spec.ts (94%)
rename wallets/metamask/test/{ => playwright}/e2e/encrypt.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/goBackToHomePage.spec.ts (90%)
rename wallets/metamask/test/{ => playwright}/e2e/importWallet.spec.ts (95%)
rename wallets/metamask/test/{ => playwright}/e2e/importWalletFromPrivateKey.spec.ts (96%)
rename wallets/metamask/test/{ => playwright}/e2e/lock.spec.ts (87%)
rename wallets/metamask/test/{ => playwright}/e2e/openSettings.spec.ts (89%)
rename wallets/metamask/test/{ => playwright}/e2e/openSidebarMenu.spec.ts (92%)
rename wallets/metamask/test/{ => playwright}/e2e/openTransactionDetails.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/rejectAddNetwork.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/rejectPermission.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/rejectSignature.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/rejectSwitchNetwork.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/rejectTransaction.spec.ts (100%)
rename wallets/metamask/test/{ => playwright}/e2e/renameAccount.spec.ts (89%)
rename wallets/metamask/test/{ => playwright}/e2e/resetAccount.spec.ts (89%)
rename wallets/metamask/test/{ => playwright}/e2e/switchAccount.spec.ts (94%)
rename wallets/metamask/test/{ => playwright}/e2e/switchNetwork.spec.ts (95%)
rename wallets/metamask/test/{ => playwright}/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts (87%)
rename wallets/metamask/test/{ => playwright}/e2e/toggleShowTestNetworks.spec.ts (89%)
rename wallets/metamask/test/{ => playwright}/e2e/unlock.spec.ts (87%)
rename wallets/metamask/test/{ => playwright}/synpress.ts (77%)
rename wallets/metamask/test/{ => playwright}/wallet-setup/basic.setup.d.ts (100%)
rename wallets/metamask/test/{ => playwright}/wallet-setup/basic.setup.d.ts.map (100%)
rename wallets/metamask/test/{ => playwright}/wallet-setup/basic.setup.ts (88%)
rename wallets/metamask/test/{ => playwright}/wallet-setup/connected.setup.ts (92%)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 30dd8c25e..c9b123047 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -67,7 +67,7 @@ jobs:
- name: Run E2E tests (headful)
run: |
- xvfb-run pnpm run test:e2e:headful
+ xvfb-run pnpm run test:playwright:headful
- name: Archive Playwright report
uses: actions/upload-artifact@v3
diff --git a/.gitignore b/.gitignore
index 94d16f61e..564fad603 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,9 @@ test-results
playwright-report
playwright/.cache
+### Cypress
+wallets/**/downloads
+
### Synpress
.cache-synpress
diff --git a/biome.json b/biome.json
index 2f9cc4057..6397ca6fe 100644
--- a/biome.json
+++ b/biome.json
@@ -12,7 +12,8 @@
"**/test-results",
"**/playwright-report",
"**/.cache-synpress",
- "**/.vitepress/cache"
+ "**/.vitepress/cache",
+ "**/downloads"
]
},
"formatter": {
diff --git a/examples/new-dawn/README.md b/examples/new-dawn/README.md
index 102ae8257..c89dc3e13 100644
--- a/examples/new-dawn/README.md
+++ b/examples/new-dawn/README.md
@@ -66,9 +66,9 @@ pnpm run build:cache:headless
```bash
# Use one of our scripts:
-pnpm run test:e2e:headful
-pnpm run test:e2e:headless
-pnpm run test:e2e:headless:ui
+pnpm run test:playwright:headful
+pnpm run test:playwright:headless
+pnpm run test:playwright:headless:ui
# Or use Playwright directly:
playwright test
diff --git a/examples/new-dawn/cypress.config.ts b/examples/new-dawn/cypress.config.ts
index 8c9cd8242..408814d76 100644
--- a/examples/new-dawn/cypress.config.ts
+++ b/examples/new-dawn/cypress.config.ts
@@ -1,4 +1,4 @@
-import { installSynpress } from '@synthetixio/synpress/cypress'
+import { configureSynpress } from '@synthetixio/synpress/cypress'
import { defineConfig } from 'cypress'
export default defineConfig({
@@ -9,7 +9,7 @@ export default defineConfig({
supportFile: 'test/cypress/support/e2e.{js,jsx,ts,tsx}',
testIsolation: false,
async setupNodeEvents(on, config) {
- return installSynpress(on, config)
+ return configureSynpress(on, config)
}
}
})
diff --git a/examples/new-dawn/package.json b/examples/new-dawn/package.json
index 29fc6a049..4d5d04e5c 100644
--- a/examples/new-dawn/package.json
+++ b/examples/new-dawn/package.json
@@ -8,10 +8,10 @@
"build:cache:force": "synpress --force",
"build:cache:headless": "synpress --headless",
"serve:test-dapp": "serve node_modules/@metamask/test-dapp/dist -p 9999",
- "test:e2e:headful": "playwright test",
- "test:e2e:headful:cypress": "cypress run --browser chrome --headed",
- "test:e2e:headless": "HEADLESS=true playwright test",
- "test:e2e:headless:ui": "HEADLESS=true playwright test --ui"
+ "test:cypress:headful": "cypress run --browser chrome --headed",
+ "test:playwright:headful": "playwright test",
+ "test:playwright:headless": "HEADLESS=true playwright test",
+ "test:playwright:headless:ui": "HEADLESS=true playwright test --ui"
},
"dependencies": {
"@playwright/test": "1.44.0",
@@ -21,7 +21,7 @@
"devDependencies": {
"@metamask/test-dapp": "8.1.0",
"@types/node": "20.11.17",
- "cypress": "13.9.0",
+ "cypress": "13.13.0",
"serve": "14.2.1",
"typescript": "5.3.3"
}
diff --git a/examples/new-dawn/tsconfig.json b/examples/new-dawn/tsconfig.json
index ae8e7d4dc..d5fba337f 100644
--- a/examples/new-dawn/tsconfig.json
+++ b/examples/new-dawn/tsconfig.json
@@ -7,7 +7,8 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
- "skipLibCheck": true
+ "skipLibCheck": true,
+ "types": ["cypress"]
},
"include": ["test"],
"files": ["environment.d.ts"]
diff --git a/package.json b/package.json
index d8639d08e..b50630817 100644
--- a/package.json
+++ b/package.json
@@ -15,8 +15,8 @@
"sort-package-json": "sort-package-json 'package.json' '{packages,wallets,examples}/*/package.json'",
"sort-package-json:check": "sort-package-json 'package.json' '{packages,wallets,examples}/*/package.json' --check",
"test": "turbo test",
- "test:e2e:headful": "turbo test:e2e:headful --filter=@synthetixio/synpress-metamask --filter=@synthetixio/ethereum-wallet-mock",
- "test:e2e:headless": "turbo test:e2e:headless --filter=@synthetixio/synpress-metamask --filter=@synthetixio/ethereum-wallet-mock",
+ "test:playwright:headful": "turbo test:playwright:headful --filter=@synthetixio/synpress-metamask --filter=@synthetixio/ethereum-wallet-mock",
+ "test:playwright:headless": "turbo test:playwright:headless --filter=@synthetixio/synpress-metamask --filter=@synthetixio/ethereum-wallet-mock",
"update:deps": "ncu -u -ws --root"
},
"lint-staged": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 10d809f51..5e025fc05 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -79,8 +79,8 @@ importers:
specifier: 20.11.17
version: 20.11.17
cypress:
- specifier: 13.9.0
- version: 13.9.0
+ specifier: 13.13.0
+ version: 13.13.0
serve:
specifier: 14.2.1
version: 14.2.1
@@ -304,6 +304,9 @@ importers:
'@vitest/coverage-v8':
specifier: 1.2.2
version: 1.2.2(vitest@1.2.2)
+ cypress:
+ specifier: 13.13.0
+ version: 13.13.0
rimraf:
specifier: 5.0.5
version: 5.0.5
@@ -3766,6 +3769,56 @@ packages:
stream-transform: 2.1.3
dev: true
+ /cypress@13.13.0:
+ resolution: {integrity: sha512-ou/MQUDq4tcDJI2FsPaod2FZpex4kpIK43JJlcBgWrX8WX7R/05ZxGTuxedOuZBfxjZxja+fbijZGyxiLP6CFA==}
+ engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0}
+ hasBin: true
+ requiresBuild: true
+ dependencies:
+ '@cypress/request': 3.0.1
+ '@cypress/xvfb': 1.2.4(supports-color@8.1.1)
+ '@types/sinonjs__fake-timers': 8.1.1
+ '@types/sizzle': 2.3.8
+ arch: 2.2.0
+ blob-util: 2.0.2
+ bluebird: 3.7.2
+ buffer: 5.7.1
+ cachedir: 2.4.0
+ chalk: 4.1.2
+ check-more-types: 2.24.0
+ cli-cursor: 3.1.0
+ cli-table3: 0.6.5
+ commander: 6.2.1
+ common-tags: 1.8.2
+ dayjs: 1.11.11
+ debug: 4.3.4(supports-color@8.1.1)
+ enquirer: 2.4.1
+ eventemitter2: 6.4.7
+ execa: 4.1.0
+ executable: 4.1.1
+ extract-zip: 2.0.1(supports-color@8.1.1)
+ figures: 3.2.0
+ fs-extra: 9.1.0
+ getos: 3.2.1
+ is-ci: 3.0.1
+ is-installed-globally: 0.4.0
+ lazy-ass: 1.6.0
+ listr2: 3.14.0(enquirer@2.4.1)
+ lodash: 4.17.21
+ log-symbols: 4.1.0
+ minimist: 1.2.8
+ ospath: 1.2.2
+ pretty-bytes: 5.6.0
+ process: 0.11.10
+ proxy-from-env: 1.0.0
+ request-progress: 3.0.0
+ semver: 7.6.2
+ supports-color: 8.1.1
+ tmp: 0.2.3
+ untildify: 4.0.0
+ yauzl: 2.10.0
+ dev: true
+
/cypress@13.9.0:
resolution: {integrity: sha512-atNjmYfHsvTuCaxTxLZr9xGoHz53LLui3266WWxXJHY7+N6OdwJdg/feEa3T+buez9dmUXHT1izCOklqG82uCQ==}
engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0}
diff --git a/release/src/cypress/index.ts b/release/src/cypress/index.ts
index 0366851cb..d47e2d85d 100644
--- a/release/src/cypress/index.ts
+++ b/release/src/cypress/index.ts
@@ -1 +1,2 @@
export * from '@synthetixio/ethereum-wallet-mock/cypress'
+export * from '@synthetixio/synpress-metamask/cypress'
diff --git a/release/src/playwright/index.ts b/release/src/playwright/index.ts
index e4ac6235e..f97810c9b 100644
--- a/release/src/playwright/index.ts
+++ b/release/src/playwright/index.ts
@@ -1,2 +1,2 @@
export * from '@synthetixio/ethereum-wallet-mock/playwright'
-export { MetaMask, getExtensionId, metaMaskFixtures } from '@synthetixio/synpress-metamask'
+export * from '@synthetixio/synpress-metamask/playwright'
diff --git a/turbo.json b/turbo.json
index df889c5a7..58c44315a 100644
--- a/turbo.json
+++ b/turbo.json
@@ -11,10 +11,10 @@
"build:cache": {
"dependsOn": ["build"]
},
- "test:e2e:headful": {
+ "test:playwright:headful": {
"dependsOn": ["build", "build:cache"]
},
- "test:e2e:headless": {
+ "test:playwright:headless": {
"dependsOn": ["build", "build:cache"]
},
"docs:build": {
diff --git a/wallets/ethereum-wallet-mock/cypress.config.ts b/wallets/ethereum-wallet-mock/cypress.config.ts
index e57319d60..77ff4d214 100644
--- a/wallets/ethereum-wallet-mock/cypress.config.ts
+++ b/wallets/ethereum-wallet-mock/cypress.config.ts
@@ -1,5 +1,5 @@
import { defineConfig } from 'cypress'
-import { installSynpress } from './src/cypress'
+import { configureSynpress } from './src/cypress'
export default defineConfig({
chromeWebSecurity: false,
@@ -10,7 +10,7 @@ export default defineConfig({
fixturesFolder: 'src/cypress/fixtures',
testIsolation: false,
async setupNodeEvents(on, config) {
- return installSynpress(on, config)
+ return configureSynpress(on, config)
}
}
})
diff --git a/wallets/ethereum-wallet-mock/package.json b/wallets/ethereum-wallet-mock/package.json
index 99dd7fef6..c65ec236b 100644
--- a/wallets/ethereum-wallet-mock/package.json
+++ b/wallets/ethereum-wallet-mock/package.json
@@ -26,11 +26,10 @@
"build:dist": "tsup --tsconfig tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json",
"clean": "rimraf dist types",
- "test:e2e:headful": "playwright test",
- "test:e2e:headful:cypress": "cypress run --browser chrome --headed",
- "test:e2e:headless": "HEADLESS=true playwright test",
- "test:e2e:headless:cypress": "cypress run --headless --browser chrome",
- "test:e2e:headless:ui": "HEADLESS=true playwright test --ui",
+ "test:cypress:headful": "cypress run --browser chrome --headed",
+ "test:playwright:headful": "playwright test",
+ "test:playwright:headless": "HEADLESS=true playwright test",
+ "test:playwright:headless:ui": "HEADLESS=true playwright test --ui",
"test:watch": "vitest watch",
"types:check": "tsc --noEmit"
},
diff --git a/wallets/ethereum-wallet-mock/src/cypress/index.ts b/wallets/ethereum-wallet-mock/src/cypress/index.ts
index 8360764af..3361e4350 100644
--- a/wallets/ethereum-wallet-mock/src/cypress/index.ts
+++ b/wallets/ethereum-wallet-mock/src/cypress/index.ts
@@ -1,2 +1,2 @@
-export { default as installSynpress } from './utils/installSynpress'
+export { default as configureSynpress } from './utils/configureSynpress'
export { default as EthereumWalletMock } from './EthereumWalletMock'
diff --git a/wallets/ethereum-wallet-mock/src/cypress/utils/installSynpress.ts b/wallets/ethereum-wallet-mock/src/cypress/utils/configureSynpress.ts
similarity index 86%
rename from wallets/ethereum-wallet-mock/src/cypress/utils/installSynpress.ts
rename to wallets/ethereum-wallet-mock/src/cypress/utils/configureSynpress.ts
index 95dea8fd4..1a473c0d1 100644
--- a/wallets/ethereum-wallet-mock/src/cypress/utils/installSynpress.ts
+++ b/wallets/ethereum-wallet-mock/src/cypress/utils/configureSynpress.ts
@@ -4,7 +4,7 @@ import { initEthereumWalletMock } from './initEthereumWalletMock'
let port: number
-export default function installSynpress(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) {
+export default function configureSynpress(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) {
const browsers = config.browsers.filter((b) => b.name === 'chrome')
if (browsers.length === 0) {
throw new Error('No Chrome browser found in the configuration')
diff --git a/wallets/metamask/cypress.config.ts b/wallets/metamask/cypress.config.ts
new file mode 100644
index 000000000..ba1e7f9f3
--- /dev/null
+++ b/wallets/metamask/cypress.config.ts
@@ -0,0 +1,15 @@
+import { defineConfig } from 'cypress'
+import configureSynpress from './src/cypress/configureSynpress'
+
+export default defineConfig({
+ chromeWebSecurity: false,
+ e2e: {
+ baseUrl: 'http://localhost:9999',
+ specPattern: 'test/cypress/**/*.cy.{js,jsx,ts,tsx}',
+ supportFile: 'src/cypress/support/e2e.{js,jsx,ts,tsx}',
+ testIsolation: false,
+ async setupNodeEvents(on, config) {
+ return configureSynpress(on, config)
+ }
+ }
+})
diff --git a/wallets/metamask/package.json b/wallets/metamask/package.json
index d9b2eed90..6499255af 100644
--- a/wallets/metamask/package.json
+++ b/wallets/metamask/package.json
@@ -3,8 +3,14 @@
"version": "0.0.1-alpha.7",
"type": "module",
"exports": {
- "types": "./types/index.d.ts",
- "default": "./dist/index.js"
+ "./cypress": {
+ "types": "./types/cypress/index.d.ts",
+ "default": "./dist/cypress/index.js"
+ },
+ "./playwright": {
+ "types": "./types/playwright/index.d.ts",
+ "default": "./dist/playwright/index.js"
+ }
},
"main": "./dist/index.js",
"types": "./types/index.d.ts",
@@ -15,17 +21,18 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run build:dist && pnpm run build:types",
- "build:cache": "synpress-cache test/wallet-setup",
- "build:cache:headless": "synpress-cache test/wallet-setup --headless",
- "build:cache:headless:force": "synpress-cache test/wallet-setup --headless --force",
+ "build:cache": "synpress-cache test/playwright/wallet-setup",
+ "build:cache:headless": "synpress-cache test/playwright/wallet-setup --headless",
+ "build:cache:headless:force": "synpress-cache test/playwright/wallet-setup --headless --force",
"build:dist": "tsup --tsconfig tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json",
"clean": "rimraf dist types",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
- "test:e2e:headful": "playwright test",
- "test:e2e:headless": "HEADLESS=true playwright test",
- "test:e2e:headless:ui": "HEADLESS=true playwright test --ui",
+ "test:cypress:headful": "cypress run --browser chrome --headed",
+ "test:playwright:headful": "playwright test",
+ "test:playwright:headless": "HEADLESS=true playwright test",
+ "test:playwright:headless:ui": "HEADLESS=true playwright test --ui",
"test:watch": "vitest watch",
"types:check": "tsc --noEmit"
},
@@ -41,6 +48,7 @@
"@types/fs-extra": "11.0.4",
"@types/node": "20.11.17",
"@vitest/coverage-v8": "1.2.2",
+ "cypress": "13.13.0",
"rimraf": "5.0.5",
"tsup": "8.0.2",
"typescript": "5.3.3",
diff --git a/wallets/metamask/playwright.config.ts b/wallets/metamask/playwright.config.ts
index 0994ed0a0..b90b26697 100644
--- a/wallets/metamask/playwright.config.ts
+++ b/wallets/metamask/playwright.config.ts
@@ -5,7 +5,7 @@ import { defineConfig, devices } from '@playwright/test'
*/
export default defineConfig({
// Look for test files in the "test/e2e" directory, relative to this configuration file.
- testDir: './test/e2e',
+ testDir: './test/playwright/e2e',
// We're increasing the timeout to 60 seconds to allow all traces to be recorded.
// Sometimes it threw an error saying that traces were not recorded in the 30 seconds timeout limit.
diff --git a/wallets/metamask/src/cypress/MetaMask.ts b/wallets/metamask/src/cypress/MetaMask.ts
new file mode 100644
index 000000000..00b9668ba
--- /dev/null
+++ b/wallets/metamask/src/cypress/MetaMask.ts
@@ -0,0 +1,11 @@
+import { lockPage } from '../selectors'
+import { MetaMaskAbstract } from '../type/MetaMaskAbstract'
+
+// @ts-ignore
+// TODO: To be implemented
+export class MetaMask extends MetaMaskAbstract {
+ unlock() {
+ cy.get(lockPage.passwordInput).type(this.password)
+ cy.get(lockPage.submitButton).click()
+ }
+}
diff --git a/wallets/metamask/src/cypress/configureSynpress.ts b/wallets/metamask/src/cypress/configureSynpress.ts
new file mode 100644
index 000000000..654723260
--- /dev/null
+++ b/wallets/metamask/src/cypress/configureSynpress.ts
@@ -0,0 +1,31 @@
+import { ensureRdpPort } from '@synthetixio/synpress-core'
+import importMetaMaskWallet from './support/importMetaMaskWallet'
+import { initMetaMask } from './support/initMetaMask'
+
+let port: number
+
+export default function configureSynpress(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) {
+ const browsers = config.browsers.filter((b) => b.name === 'chrome')
+ if (browsers.length === 0) {
+ throw new Error('No Chrome browser found in the configuration')
+ }
+
+ on('before:browser:launch', async (_, launchOptions) => {
+ // Enable debug mode to establish playwright connection
+ const args = Array.isArray(launchOptions) ? launchOptions : launchOptions.args
+ port = ensureRdpPort(args)
+
+ args.push(...(await initMetaMask()))
+
+ return launchOptions
+ })
+
+ on('before:spec', async () => {
+ await importMetaMaskWallet(port)
+ })
+
+ return {
+ ...config,
+ browsers
+ }
+}
diff --git a/wallets/metamask/src/cypress/index.ts b/wallets/metamask/src/cypress/index.ts
new file mode 100644
index 000000000..8289daa24
--- /dev/null
+++ b/wallets/metamask/src/cypress/index.ts
@@ -0,0 +1 @@
+export * from './MetaMask'
diff --git a/wallets/metamask/src/cypress/support/e2e.ts b/wallets/metamask/src/cypress/support/e2e.ts
new file mode 100644
index 000000000..a1e60ea00
--- /dev/null
+++ b/wallets/metamask/src/cypress/support/e2e.ts
@@ -0,0 +1,28 @@
+// ***********************************************************
+// This example support/e2e.ts is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import synpressCommands from './synpressCommands'
+
+before(() => {
+ cy.visit('/')
+})
+
+Cypress.on('uncaught:exception', () => {
+ // failing the test
+ return false
+})
+
+synpressCommands()
diff --git a/wallets/metamask/src/cypress/support/importMetaMaskWallet.ts b/wallets/metamask/src/cypress/support/importMetaMaskWallet.ts
new file mode 100644
index 000000000..7a7dff271
--- /dev/null
+++ b/wallets/metamask/src/cypress/support/importMetaMaskWallet.ts
@@ -0,0 +1,28 @@
+import { type BrowserContext, type Page, chromium } from '@playwright/test'
+import { importWallet } from '../../playwright/pages/OnboardingPage/actions'
+import { onboardingPage } from '../../selectors'
+
+const SEED_PHRASE = 'test test test test test test test test test test test junk'
+
+export default async function importMetaMaskWallet(port: number) {
+ const debuggerDetails = await fetch(`http://127.0.0.1:${port}/json/version`)
+
+ const debuggerDetailsConfig = (await debuggerDetails.json()) as {
+ webSocketDebuggerUrl: string
+ }
+
+ const browser = await chromium.connectOverCDP(debuggerDetailsConfig.webSocketDebuggerUrl)
+
+ const context = browser.contexts()[0] as BrowserContext
+
+ await context.waitForEvent('response')
+
+ // First page (index equal 0) is the cypress page, second one (index equal 1) is the extension page
+ const extensionPage = context.pages()[1] as Page
+
+ await extensionPage.waitForSelector(onboardingPage.GetStartedPageSelectors.termsOfServiceCheckbox)
+
+ await importWallet(extensionPage, SEED_PHRASE, 'password')
+
+ await extensionPage.close()
+}
diff --git a/wallets/metamask/src/cypress/support/initMetaMask.ts b/wallets/metamask/src/cypress/support/initMetaMask.ts
new file mode 100644
index 000000000..c64999192
--- /dev/null
+++ b/wallets/metamask/src/cypress/support/initMetaMask.ts
@@ -0,0 +1,13 @@
+import { prepareExtension } from '../../prepareExtension'
+
+export async function initMetaMask() {
+ const metamaskPath = await prepareExtension(false)
+
+ const browserArgs = [`--disable-extensions-except=${metamaskPath}`, `--load-extension=${metamaskPath}`]
+
+ if (process.env.HEADLESS) {
+ browserArgs.push('--headless=new')
+ }
+
+ return browserArgs
+}
diff --git a/wallets/metamask/src/cypress/support/synpressCommands.ts b/wallets/metamask/src/cypress/support/synpressCommands.ts
new file mode 100644
index 000000000..6e4ee34a6
--- /dev/null
+++ b/wallets/metamask/src/cypress/support/synpressCommands.ts
@@ -0,0 +1,20 @@
+///
+// ***********************************************
+// This example commands.ts shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+
+// TODO: To be implemented
+// declare global {
+// namespace Cypress {
+// interface Chainable {
+// }
+// }
+// }
+
+export default function synpressCommands() {}
diff --git a/wallets/metamask/src/index.ts b/wallets/metamask/src/index.ts
index e23a6f6c3..e69de29bb 100644
--- a/wallets/metamask/src/index.ts
+++ b/wallets/metamask/src/index.ts
@@ -1,3 +0,0 @@
-export * from './MetaMask'
-export * from './fixtures/metaMaskFixtures'
-export * from './fixture-actions'
diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts b/wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts
deleted file mode 100644
index b3ad52380..000000000
--- a/wallets/metamask/src/pages/OnboardingPage/selectors/walletCreationSuccessPage.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
-
-export default {
- confirmButton: createDataTestSelector('onboarding-complete-done')
-}
diff --git a/wallets/metamask/src/MetaMask.ts b/wallets/metamask/src/playwright/MetaMask.ts
similarity index 59%
rename from wallets/metamask/src/MetaMask.ts
rename to wallets/metamask/src/playwright/MetaMask.ts
index 90abeaeeb..94a278741 100644
--- a/wallets/metamask/src/MetaMask.ts
+++ b/wallets/metamask/src/playwright/MetaMask.ts
@@ -1,16 +1,14 @@
import type { BrowserContext, Page } from '@playwright/test'
+import { SettingsSidebarMenus } from '../selectors/pages/HomePage/settings'
+import { MetaMaskAbstract } from '../type/MetaMaskAbstract'
import { CrashPage, HomePage, LockPage, NotificationPage, OnboardingPage } from './pages'
import type { Network } from './pages/HomePage/actions'
-import { SettingsSidebarMenus } from './pages/HomePage/selectors/settings'
import type { GasSetting } from './pages/NotificationPage/actions'
import { SettingsPage } from './pages/SettingsPage/page'
const NO_EXTENSION_ID_ERROR = new Error('MetaMask extensionId is not set')
-/**
- * This class is the heart of Synpress's MetaMask API.
- */
-export class MetaMask {
+export class MetaMask extends MetaMaskAbstract {
/**
* This property can be used to access selectors for a given page.
*
@@ -43,16 +41,6 @@ export class MetaMask {
readonly notificationPage: NotificationPage
readonly settingsPage: SettingsPage
- /**
- * Class constructor.
- *
- * @param context - The browser context.
- * @param page - The MetaMask tab page.
- * @param password - The password of the MetaMask wallet.
- * @param extensionId - The extension ID of the MetaMask extension. Optional if no interaction with the dapp is required.
- *
- * @returns A new instance of the MetaMask class.
- */
constructor(
/**
* The browser context.
@@ -65,12 +53,14 @@ export class MetaMask {
/**
* The password of the MetaMask wallet.
*/
- readonly password: string,
+ override readonly password: string,
/**
* The extension ID of the MetaMask extension. Optional if no interaction with the dapp is required.
*/
- readonly extensionId?: string
+ override readonly extensionId?: string
) {
+ super(password, extensionId)
+
this.crashPage = new CrashPage()
this.onboardingPage = new OnboardingPage(page)
@@ -80,20 +70,10 @@ export class MetaMask {
this.settingsPage = new SettingsPage(page)
}
- /**
- * Imports a wallet using the given seed phrase.
- *
- * @param seedPhrase - The seed phrase to import.
- */
async importWallet(seedPhrase: string) {
await this.onboardingPage.importWallet(seedPhrase, this.password)
}
- /**
- * Adds a new account with the given name. This account is based on the initially imported seed phrase.
- *
- * @param accountName - The name of the new account.
- */
async addNewAccount(accountName: string) {
await this.homePage.addNewAccount(accountName)
}
@@ -112,53 +92,27 @@ export class MetaMask {
*
* @param privateKey - The private key to import.
*/
+
async importWalletFromPrivateKey(privateKey: string) {
await this.homePage.importWalletFromPrivateKey(privateKey)
}
- /**
- * Switches to the account with the given name.
- *
- * @param accountName - The name of the account to switch to.
- */
async switchAccount(accountName: string) {
await this.homePage.switchAccount(accountName)
}
- /**
- * Adds a new network.
- *
- * @param network - The network object to use for adding the new network.
- * @param network.name - The name of the network.
- * @param network.rpcUrl - The RPC URL of the network.
- * @param network.chainId - The chain ID of the network.
- * @param network.symbol - The currency symbol of the network.
- * @param network.blockExplorerUrl - The block explorer URL of the network.
- */
async addNetwork(network: Network) {
await this.homePage.addNetwork(network)
}
- /**
- * Retrieves the current account address.
- */
async getAccountAddress() {
return await this.homePage.getAccountAddress()
}
- /**
- * Switches to the network with the given name.
- *
- * @param networkName - The name of the network to switch to.
- * @param isTestnet - If switch to a test network.
- */
async switchNetwork(networkName: string, isTestnet = false) {
await this.homePage.switchNetwork(networkName, isTestnet)
}
- /**
- * Connects to the dapp using the currently selected account.
- */
async connectToDapp(accounts?: string[]) {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -167,23 +121,14 @@ export class MetaMask {
await this.notificationPage.connectToDapp(this.extensionId, accounts)
}
- /**
- * Locks MetaMask.
- */
async lock() {
await this.homePage.lock()
}
- /**
- * Unlocks MetaMask.
- */
async unlock() {
await this.lockPage.unlock(this.password)
}
- /**
- * Confirms a signature request. This function supports all types of commonly used signatures.
- */
async confirmSignature() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -192,9 +137,6 @@ export class MetaMask {
await this.notificationPage.signMessage(this.extensionId)
}
- /**
- * Confirms a signature request with potential risk.
- */
async confirmSignatureWithRisk() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -203,9 +145,6 @@ export class MetaMask {
await this.notificationPage.signMessageWithRisk(this.extensionId)
}
- /**
- * Rejects a signature request. This function supports all types of commonly used signatures.
- */
async rejectSignature() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -214,9 +153,6 @@ export class MetaMask {
await this.notificationPage.rejectMessage(this.extensionId)
}
- /**
- * Approves a new network request.
- */
async approveNewNetwork() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -225,9 +161,6 @@ export class MetaMask {
await this.notificationPage.approveNewNetwork(this.extensionId)
}
- /**
- * Rejects a new network request.
- */
async rejectNewNetwork() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -236,9 +169,6 @@ export class MetaMask {
await this.notificationPage.rejectNewNetwork(this.extensionId)
}
- /**
- * Approves a switch network request.
- */
async approveSwitchNetwork() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -247,9 +177,6 @@ export class MetaMask {
await this.notificationPage.approveSwitchNetwork(this.extensionId)
}
- /**
- * Rejects a switch network request.
- */
async rejectSwitchNetwork() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -258,12 +185,6 @@ export class MetaMask {
await this.notificationPage.rejectSwitchNetwork(this.extensionId)
}
- /**
- * Confirms a transaction request.
- *
- * @param options - The transaction options.
- * @param options.gasSetting - The gas setting to use for the transaction.
- */
async confirmTransaction(options?: { gasSetting?: GasSetting }) {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -272,9 +193,6 @@ export class MetaMask {
await this.notificationPage.confirmTransaction(this.extensionId, options)
}
- /**
- * Rejects a transaction request.
- */
async rejectTransaction() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -283,17 +201,6 @@ export class MetaMask {
await this.notificationPage.rejectTransaction(this.extensionId)
}
- /**
- * Approves a permission request to spend tokens.
- *
- * ::: warning
- * For NFT approvals, use `confirmTransaction` method.
- * :::
- *
- * @param options - The permission options.
- * @param options.spendLimit - The spend limit to use for the permission.
- * @param options.gasSetting - The gas setting to use for the approval transaction.
- */
async approveTokenPermission(options?: {
spendLimit?: 'max' | number
gasSetting?: GasSetting
@@ -305,13 +212,6 @@ export class MetaMask {
await this.notificationPage.approveTokenPermission(this.extensionId, options)
}
- /**
- * Rejects a permission request to spend tokens.
- *
- * ::: warning
- * For NFT approvals, use `confirmTransaction` method.
- * :::
- */
async rejectTokenPermission() {
if (!this.extensionId) {
throw NO_EXTENSION_ID_ERROR
@@ -320,74 +220,35 @@ export class MetaMask {
await this.notificationPage.rejectTokenPermission(this.extensionId)
}
- /**
- * Goes back to the home page of MetaMask tab.
- */
async goBackToHomePage() {
await this.homePage.goBackToHomePage()
}
- /**
- * Opens the settings page.
- */
async openSettings() {
await this.homePage.openSettings()
}
- /**
- * Opens a given menu in the sidebar.
- *
- * @param menu - The menu to open.
- */
async openSidebarMenu(menu: SettingsSidebarMenus) {
await this.homePage.openSidebarMenu(menu)
}
- /**
- * Toggles the "Show Test Networks" setting.
- *
- * ::: warning
- * This function requires the correct menu to be already opened.
- * :::
- */
async toggleShowTestNetworks() {
await this.homePage.toggleShowTestNetworks()
}
- /**
- * Toggles the "Dismiss Secret Recovery Phrase Reminder" setting.
- *
- * ::: warning
- * This function requires the correct menu to be already opened.
- * :::
- */
async toggleDismissSecretRecoveryPhraseReminder() {
await this.homePage.toggleDismissSecretRecoveryPhraseReminder()
}
- /**
- * Resets the account.
- *
- * ::: warning
- * This function requires the correct menu to be already opened.
- * :::
- */
async resetAccount() {
await this.homePage.resetAccount()
}
- /**
- * Enables the eth_sign feature in MetaMask advanced settings.
- * This method is marked as unsafe because enabling eth_sign can have security implications.
- */
async unsafe_enableEthSign() {
await this.homePage.openSettings()
await this.settingsPage.enableEthSign()
}
- /**
- * Disables the eth_sign feature in MetaMask advanced settings.
- */
async disableEthSign() {
await this.homePage.openSettings()
await this.settingsPage.disableEthSign()
@@ -417,20 +278,6 @@ export class MetaMask {
await this.notificationPage.decryptMessage(this.extensionId)
}
- /// -------------------------------------------
- /// ---------- EXPERIMENTAL FEATURES ----------
- /// -------------------------------------------
-
- /**
- * Confirms a transaction request and waits for the transaction to be mined.
- * This function utilizes the "Activity" tab of the MetaMask tab.
- *
- * @param options - The transaction options.
- * @param options.gasSetting - The gas setting to use for the transaction.
- *
- * @experimental
- * @group Experimental Methods
- */
async confirmTransactionAndWaitForMining(options?: {
gasSetting?: GasSetting
}) {
@@ -441,24 +288,10 @@ export class MetaMask {
await this.notificationPage.confirmTransactionAndWaitForMining(this.extensionId, options)
}
- /**
- * Opens the transaction details.
- *
- * @param txIndex - The index of the transaction in the "Activity" tab. Starts from `0`.
- *
- * @experimental
- * @group Experimental Methods
- */
async openTransactionDetails(txIndex: number) {
await this.homePage.openTransactionDetails(txIndex)
}
- /**
- * Closes the currently opened transaction details.
- *
- * @experimental
- * @group Experimental Methods
- */
async closeTransactionDetails() {
await this.homePage.closeTransactionDetails()
}
diff --git a/wallets/metamask/src/fixture-actions/getExtensionId.ts b/wallets/metamask/src/playwright/fixture-actions/getExtensionId.ts
similarity index 100%
rename from wallets/metamask/src/fixture-actions/getExtensionId.ts
rename to wallets/metamask/src/playwright/fixture-actions/getExtensionId.ts
diff --git a/wallets/metamask/src/fixture-actions/index.ts b/wallets/metamask/src/playwright/fixture-actions/index.ts
similarity index 100%
rename from wallets/metamask/src/fixture-actions/index.ts
rename to wallets/metamask/src/playwright/fixture-actions/index.ts
diff --git a/wallets/metamask/src/fixture-actions/persistLocalStorage.ts b/wallets/metamask/src/playwright/fixture-actions/persistLocalStorage.ts
similarity index 100%
rename from wallets/metamask/src/fixture-actions/persistLocalStorage.ts
rename to wallets/metamask/src/playwright/fixture-actions/persistLocalStorage.ts
diff --git a/wallets/metamask/src/playwright/fixture-actions/prepareExtension.ts b/wallets/metamask/src/playwright/fixture-actions/prepareExtension.ts
new file mode 100644
index 000000000..e69de29bb
diff --git a/wallets/metamask/src/fixture-actions/unlockForFixture.ts b/wallets/metamask/src/playwright/fixture-actions/unlockForFixture.ts
similarity index 100%
rename from wallets/metamask/src/fixture-actions/unlockForFixture.ts
rename to wallets/metamask/src/playwright/fixture-actions/unlockForFixture.ts
diff --git a/wallets/metamask/src/fixtures/metaMaskFixtures.ts b/wallets/metamask/src/playwright/fixtures/metaMaskFixtures.ts
similarity index 97%
rename from wallets/metamask/src/fixtures/metaMaskFixtures.ts
rename to wallets/metamask/src/playwright/fixtures/metaMaskFixtures.ts
index 88b3cd55a..34cc335b9 100644
--- a/wallets/metamask/src/fixtures/metaMaskFixtures.ts
+++ b/wallets/metamask/src/playwright/fixtures/metaMaskFixtures.ts
@@ -1,5 +1,3 @@
-import { MetaMask, getExtensionId, prepareExtension, unlockForFixture } from '../../src'
-
import path from 'node:path'
import { type Page, chromium } from '@playwright/test'
import { test as base } from '@playwright/test'
@@ -11,6 +9,9 @@ import {
} from '@synthetixio/synpress-cache'
import { type Anvil, type CreateAnvilOptions, createPool } from '@viem/anvil'
import fs from 'fs-extra'
+import { prepareExtension } from '../../prepareExtension'
+import { MetaMask } from '../MetaMask'
+import { getExtensionId, unlockForFixture } from '../fixture-actions'
import { persistLocalStorage } from '../fixture-actions/persistLocalStorage'
import { waitForMetaMaskWindowToBeStable } from '../utils/waitFor'
diff --git a/wallets/metamask/src/playwright/index.ts b/wallets/metamask/src/playwright/index.ts
new file mode 100644
index 000000000..e23a6f6c3
--- /dev/null
+++ b/wallets/metamask/src/playwright/index.ts
@@ -0,0 +1,3 @@
+export * from './MetaMask'
+export * from './fixtures/metaMaskFixtures'
+export * from './fixture-actions'
diff --git a/wallets/metamask/src/pages/CrashPage/page.ts b/wallets/metamask/src/playwright/pages/CrashPage/page.ts
similarity index 63%
rename from wallets/metamask/src/pages/CrashPage/page.ts
rename to wallets/metamask/src/playwright/pages/CrashPage/page.ts
index 8c9f2c31c..e731a6e94 100644
--- a/wallets/metamask/src/pages/CrashPage/page.ts
+++ b/wallets/metamask/src/playwright/pages/CrashPage/page.ts
@@ -1,4 +1,4 @@
-import Selectors from './selectors'
+import Selectors from '../../../selectors/pages/CrashPage'
export class CrashPage {
static readonly selectors = Selectors
diff --git a/wallets/metamask/src/pages/HomePage/actions/addNetwork.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/addNetwork.ts
similarity index 97%
rename from wallets/metamask/src/pages/HomePage/actions/addNetwork.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/addNetwork.ts
index 997f6a476..7a23f2cf4 100644
--- a/wallets/metamask/src/pages/HomePage/actions/addNetwork.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/addNetwork.ts
@@ -1,7 +1,7 @@
import type { Page } from '@playwright/test'
import { z } from 'zod'
+import Selectors from '../../../../selectors/pages/HomePage'
import { waitFor } from '../../../utils/waitFor'
-import Selectors from '../selectors'
import { closeNetworkAddedPopover, closeNewNetworkInfoPopover } from './popups'
const Network = z.object({
diff --git a/wallets/metamask/src/pages/HomePage/actions/addNewAccount.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/addNewAccount.ts
similarity index 92%
rename from wallets/metamask/src/pages/HomePage/actions/addNewAccount.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/addNewAccount.ts
index 15d48d8e6..d443eb7b1 100644
--- a/wallets/metamask/src/pages/HomePage/actions/addNewAccount.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/addNewAccount.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/HomePage'
export async function addNewAccount(page: Page, accountName: string) {
// TODO: Use zod to validate this.
diff --git a/wallets/metamask/src/pages/HomePage/actions/getAccountAddress.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/getAccountAddress.ts
similarity index 88%
rename from wallets/metamask/src/pages/HomePage/actions/getAccountAddress.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/getAccountAddress.ts
index 5cb5e942d..4c0427c3f 100644
--- a/wallets/metamask/src/pages/HomePage/actions/getAccountAddress.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/getAccountAddress.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/HomePage'
export default async function getAccountAddress(page: Page): Promise {
await page.locator(Selectors.threeDotsMenu.threeDotsButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/actions/importWalletFromPrivateKey.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/importWalletFromPrivateKey.ts
similarity index 94%
rename from wallets/metamask/src/pages/HomePage/actions/importWalletFromPrivateKey.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/importWalletFromPrivateKey.ts
index 85a34ea97..a9ad32f99 100644
--- a/wallets/metamask/src/pages/HomePage/actions/importWalletFromPrivateKey.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/importWalletFromPrivateKey.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/HomePage'
import { waitFor } from '../../../utils/waitFor'
-import Selectors from '../selectors'
export async function importWalletFromPrivateKey(page: Page, privateKey: string) {
await page.locator(Selectors.accountMenu.accountButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/actions/index.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/HomePage/actions/index.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/index.ts
diff --git a/wallets/metamask/src/pages/HomePage/actions/lock.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/lock.ts
similarity index 78%
rename from wallets/metamask/src/pages/HomePage/actions/lock.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/lock.ts
index b6218cd10..010ec8c01 100644
--- a/wallets/metamask/src/pages/HomePage/actions/lock.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/lock.ts
@@ -1,5 +1,6 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+
+import Selectors from '../../../../selectors/pages/HomePage'
export async function lock(page: Page) {
await page.locator(Selectors.threeDotsMenu.threeDotsButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts
similarity index 89%
rename from wallets/metamask/src/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts
index cedc39d9d..b107b411c 100644
--- a/wallets/metamask/src/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeNetworkAddedPopover.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../../selectors/pages/HomePage'
import { clickLocatorIfCondition } from '../../../../utils/clickLocatorIfCondition'
-import Selectors from '../../selectors'
// Note: The "Dismiss" button does NOTHING and the network is ALWAYS automatically switched.
export async function closeNetworkAddedPopover(page: Page) {
diff --git a/wallets/metamask/src/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts
similarity index 86%
rename from wallets/metamask/src/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts
index c8ebdcf31..8ac81f444 100644
--- a/wallets/metamask/src/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeNewNetworkInfoPopover.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../../selectors/pages/HomePage'
import { clickLocatorIfCondition } from '../../../../utils/clickLocatorIfCondition'
-import Selectors from '../../selectors'
export async function closeNewNetworkInfoPopover(page: Page) {
const gotItButtonLocator = page.locator(Selectors.newNetworkInfoPopover.gotItButton)
diff --git a/wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closePopover.ts
similarity index 89%
rename from wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/popups/closePopover.ts
index dba4a03f1..36378580b 100644
--- a/wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closePopover.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../../selectors/pages/HomePage'
import { clickLocatorIfCondition } from '../../../../utils/clickLocatorIfCondition'
-import Selectors from '../../selectors'
// Closes the popover with news, rainbows, unicorns, and other stuff.
export async function closePopover(page: Page) {
diff --git a/wallets/metamask/src/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts
similarity index 86%
rename from wallets/metamask/src/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts
index c1f0a0c42..1664221e0 100644
--- a/wallets/metamask/src/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/closeRecoveryPhraseReminder.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../../selectors/pages/HomePage'
import { clickLocatorIfCondition } from '../../../../utils/clickLocatorIfCondition'
-import Selectors from '../../selectors'
export async function closeRecoveryPhraseReminder(page: Page) {
const closeButtonLocator = page.locator(Selectors.recoveryPhraseReminder.gotItButton)
diff --git a/wallets/metamask/src/pages/HomePage/actions/popups/index.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/popups/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/HomePage/actions/popups/index.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/popups/index.ts
diff --git a/wallets/metamask/src/pages/HomePage/actions/renameAccount.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/renameAccount.ts
similarity index 91%
rename from wallets/metamask/src/pages/HomePage/actions/renameAccount.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/renameAccount.ts
index af3479023..466f7ded6 100644
--- a/wallets/metamask/src/pages/HomePage/actions/renameAccount.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/renameAccount.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/HomePage'
export async function renameAccount(page: Page, newAccountName: string) {
await page.locator(Selectors.accountMenu.accountButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/actions/settings.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/settings.ts
similarity index 87%
rename from wallets/metamask/src/pages/HomePage/actions/settings.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/settings.ts
index 585d2c186..0ba074619 100644
--- a/wallets/metamask/src/pages/HomePage/actions/settings.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/settings.ts
@@ -1,7 +1,7 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/HomePage'
+import type { SettingsSidebarMenus } from '../../../../selectors/pages/HomePage/settings'
import { toggle } from '../../../utils/toggle'
-import Selectors from '../selectors'
-import type { SettingsSidebarMenus } from '../selectors/settings'
async function openSettings(page: Page) {
await page.locator(Selectors.threeDotsMenu.threeDotsButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/actions/switchAccount.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/switchAccount.ts
similarity index 94%
rename from wallets/metamask/src/pages/HomePage/actions/switchAccount.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/switchAccount.ts
index fab808ed5..ad303290b 100644
--- a/wallets/metamask/src/pages/HomePage/actions/switchAccount.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/switchAccount.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/HomePage'
import { allTextContents } from '../../../utils/allTextContents'
-import Selectors from '../selectors'
export async function switchAccount(page: Page, accountName: string) {
await page.locator(Selectors.accountMenu.accountButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/actions/switchNetwork.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/switchNetwork.ts
similarity index 96%
rename from wallets/metamask/src/pages/HomePage/actions/switchNetwork.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/switchNetwork.ts
index ae0bc2b64..363485e4e 100644
--- a/wallets/metamask/src/pages/HomePage/actions/switchNetwork.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/switchNetwork.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/HomePage'
import { allTextContents } from '../../../utils/allTextContents'
-import Selectors from '../selectors'
import { closeRecoveryPhraseReminder } from './popups'
async function openTestnetSection(page: Page) {
diff --git a/wallets/metamask/src/pages/HomePage/actions/toggleShowTestNetworks.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/toggleShowTestNetworks.ts
similarity index 88%
rename from wallets/metamask/src/pages/HomePage/actions/toggleShowTestNetworks.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/toggleShowTestNetworks.ts
index b02ebfebd..9e48c1527 100644
--- a/wallets/metamask/src/pages/HomePage/actions/toggleShowTestNetworks.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/toggleShowTestNetworks.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/HomePage'
import { toggle } from '../../../utils/toggle'
-import Selectors from '../selectors'
// Toggling this through the network dropdown instead of the settings page is a better approach.
// This is in most cases the faster approach, but it's also more reliable.
diff --git a/wallets/metamask/src/pages/HomePage/actions/transactionDetails.ts b/wallets/metamask/src/playwright/pages/HomePage/actions/transactionDetails.ts
similarity index 94%
rename from wallets/metamask/src/pages/HomePage/actions/transactionDetails.ts
rename to wallets/metamask/src/playwright/pages/HomePage/actions/transactionDetails.ts
index 02bd1feef..979e67979 100644
--- a/wallets/metamask/src/pages/HomePage/actions/transactionDetails.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/actions/transactionDetails.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/HomePage'
import { waitFor } from '../../../utils/waitFor'
-import Selectors from '../selectors'
const openTransactionDetails = async (page: Page, txIndex: number) => {
await page.locator(Selectors.activityTab.activityTabButton).click()
diff --git a/wallets/metamask/src/pages/HomePage/page.ts b/wallets/metamask/src/playwright/pages/HomePage/page.ts
similarity index 93%
rename from wallets/metamask/src/pages/HomePage/page.ts
rename to wallets/metamask/src/playwright/pages/HomePage/page.ts
index 344c70f58..156de5e85 100644
--- a/wallets/metamask/src/pages/HomePage/page.ts
+++ b/wallets/metamask/src/playwright/pages/HomePage/page.ts
@@ -1,4 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../selectors/pages/HomePage'
+import type { SettingsSidebarMenus } from '../../../selectors/pages/HomePage/settings'
import {
addNetwork,
addNewAccount,
@@ -13,8 +15,6 @@ import {
transactionDetails
} from './actions'
import type { Network } from './actions'
-import Selectors from './selectors'
-import type { SettingsSidebarMenus } from './selectors/settings'
export class HomePage {
static readonly selectors = Selectors
diff --git a/wallets/metamask/src/pages/LockPage/actions/index.ts b/wallets/metamask/src/playwright/pages/LockPage/actions/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/LockPage/actions/index.ts
rename to wallets/metamask/src/playwright/pages/LockPage/actions/index.ts
diff --git a/wallets/metamask/src/pages/LockPage/actions/unlock.ts b/wallets/metamask/src/playwright/pages/LockPage/actions/unlock.ts
similarity index 84%
rename from wallets/metamask/src/pages/LockPage/actions/unlock.ts
rename to wallets/metamask/src/playwright/pages/LockPage/actions/unlock.ts
index 3fabef333..79e3956df 100644
--- a/wallets/metamask/src/pages/LockPage/actions/unlock.ts
+++ b/wallets/metamask/src/playwright/pages/LockPage/actions/unlock.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/LockPage'
import { waitForSpinnerToVanish } from '../../../utils/waitForSpinnerToVanish'
-import Selectors from '../selectors'
export async function unlock(page: Page, password: string) {
await page.locator(Selectors.passwordInput).fill(password)
diff --git a/wallets/metamask/src/pages/LockPage/page.ts b/wallets/metamask/src/playwright/pages/LockPage/page.ts
similarity index 85%
rename from wallets/metamask/src/pages/LockPage/page.ts
rename to wallets/metamask/src/playwright/pages/LockPage/page.ts
index ce95f7c0f..1b14d06e6 100644
--- a/wallets/metamask/src/pages/LockPage/page.ts
+++ b/wallets/metamask/src/playwright/pages/LockPage/page.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../selectors/pages/LockPage'
import { unlock } from './actions'
-import Selectors from './selectors'
export class LockPage {
static readonly selectors = Selectors
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/approvePermission.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/approvePermission.ts
similarity index 94%
rename from wallets/metamask/src/pages/NotificationPage/actions/approvePermission.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/approvePermission.ts
index 7199b7174..0c8b0b03b 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/approvePermission.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/approvePermission.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/NotificationPage'
import { type GasSetting, transaction } from './transaction'
const editTokenPermission = async (notificationPage: Page, customSpendLimit: 'max' | number) => {
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/connectToDapp.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/connectToDapp.ts
similarity index 96%
rename from wallets/metamask/src/pages/NotificationPage/actions/connectToDapp.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/connectToDapp.ts
index f2177fed6..63c8a4887 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/connectToDapp.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/connectToDapp.ts
@@ -1,6 +1,6 @@
import type { Locator, Page } from '@playwright/test'
+import Selectors from '../../../../selectors/pages/NotificationPage'
import { allTextContents } from '../../../utils/allTextContents'
-import Selectors from '../selectors'
async function selectAccounts(accountsToSelect: string[], accountLocators: Locator[], availableAccountNames: string[]) {
for (const account of accountsToSelect) {
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/encryption.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/encryption.ts
similarity index 83%
rename from wallets/metamask/src/pages/NotificationPage/actions/encryption.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/encryption.ts
index 365371806..77a1fd957 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/encryption.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/encryption.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/NotificationPage'
export async function providePublicEncryptionKey(notificationPage: Page) {
await notificationPage.locator(Selectors.ActionFooter.confirmActionButton).click()
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/index.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/NotificationPage/actions/index.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/index.ts
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/network.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/network.ts
similarity index 91%
rename from wallets/metamask/src/pages/NotificationPage/actions/network.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/network.ts
index de65c8e1e..bafe7e695 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/network.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/network.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/NotificationPage'
const approveNewNetwork = async (notificationPage: Page) => {
await notificationPage.locator(Selectors.NetworkPage.addNetwork.approveButton).click()
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/signSimpleMessage.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/signSimpleMessage.ts
similarity index 90%
rename from wallets/metamask/src/pages/NotificationPage/actions/signSimpleMessage.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/signSimpleMessage.ts
index 51e752314..e6b193084 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/signSimpleMessage.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/signSimpleMessage.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/NotificationPage'
const signMessage = async (notificationPage: Page) => {
await notificationPage.locator(Selectors.ActionFooter.confirmActionButton).click()
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/signStructuredMessage.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/signStructuredMessage.ts
similarity index 91%
rename from wallets/metamask/src/pages/NotificationPage/actions/signStructuredMessage.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/signStructuredMessage.ts
index 494a54714..60f03bada 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/signStructuredMessage.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/signStructuredMessage.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/NotificationPage'
const signMessage = async (notificationPage: Page) => {
const scrollDownButton = notificationPage.locator(Selectors.SignaturePage.structuredMessage.scrollDownButton)
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/token.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/token.ts
similarity index 75%
rename from wallets/metamask/src/pages/NotificationPage/actions/token.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/token.ts
index b7a452e7a..b909eff66 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/token.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/token.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/NotificationPage'
async function addNew(notificationPage: Page) {
await notificationPage.locator(Selectors.ActionFooter.confirmActionButton).click()
diff --git a/wallets/metamask/src/pages/NotificationPage/actions/transaction.ts b/wallets/metamask/src/playwright/pages/NotificationPage/actions/transaction.ts
similarity index 98%
rename from wallets/metamask/src/pages/NotificationPage/actions/transaction.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/actions/transaction.ts
index acce2b7cb..5558ccddb 100644
--- a/wallets/metamask/src/pages/NotificationPage/actions/transaction.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/actions/transaction.ts
@@ -1,8 +1,8 @@
import type { Page } from '@playwright/test'
import { z } from 'zod'
+import HomePageSelectors from '../../../../selectors/pages/HomePage'
+import Selectors from '../../../../selectors/pages/NotificationPage'
import { waitFor } from '../../../utils/waitFor'
-import HomePageSelectors from '../../HomePage/selectors'
-import Selectors from '../selectors'
const GasSetting = z.union([
z.literal('low'),
diff --git a/wallets/metamask/src/pages/NotificationPage/page.ts b/wallets/metamask/src/playwright/pages/NotificationPage/page.ts
similarity index 98%
rename from wallets/metamask/src/pages/NotificationPage/page.ts
rename to wallets/metamask/src/playwright/pages/NotificationPage/page.ts
index a41493c51..8756d526d 100644
--- a/wallets/metamask/src/pages/NotificationPage/page.ts
+++ b/wallets/metamask/src/playwright/pages/NotificationPage/page.ts
@@ -1,4 +1,5 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../selectors/pages/NotificationPage'
import { getNotificationPageAndWaitForLoad } from '../../utils/getNotificationPageAndWaitForLoad'
import {
type GasSetting,
@@ -12,7 +13,6 @@ import {
token,
transaction
} from './actions'
-import Selectors from './selectors'
export class NotificationPage {
static readonly selectors = Selectors
diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts
similarity index 93%
rename from wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts
rename to wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts
index 6103bfff9..67a5d5045 100644
--- a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts
+++ b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/confirmSecretRecoveryPhrase.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../../selectors'
+import Selectors from '../../../../../selectors/pages/OnboardingPage'
const StepSelectors = Selectors.SecretRecoveryPhrasePageSelectors.recoveryStep
diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/createPassword.ts
similarity index 92%
rename from wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts
rename to wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/createPassword.ts
index 7990a7975..8ad3d5735 100644
--- a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/createPassword.ts
+++ b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/createPassword.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../../selectors'
+import Selectors from '../../../../../selectors/pages/OnboardingPage'
const StepSelectors = Selectors.SecretRecoveryPhrasePageSelectors.passwordStep
diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/helpers/index.ts b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/OnboardingPage/actions/helpers/index.ts
rename to wallets/metamask/src/playwright/pages/OnboardingPage/actions/helpers/index.ts
diff --git a/wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/importWallet.ts
similarity index 92%
rename from wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts
rename to wallets/metamask/src/playwright/pages/OnboardingPage/actions/importWallet.ts
index 7dda51b9f..6e20de9bc 100644
--- a/wallets/metamask/src/pages/OnboardingPage/actions/importWallet.ts
+++ b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/importWallet.ts
@@ -1,8 +1,10 @@
import assert from 'node:assert'
import type { Page } from '@playwright/test'
+
+import HomePageSelectors from '../../../../selectors/pages/HomePage'
+import Selectors from '../../../../selectors/pages/OnboardingPage'
+
import { closePopover } from '../../HomePage/actions'
-import HomePageSelectors from '../../HomePage/selectors'
-import 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/actions/index.ts b/wallets/metamask/src/playwright/pages/OnboardingPage/actions/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/OnboardingPage/actions/index.ts
rename to wallets/metamask/src/playwright/pages/OnboardingPage/actions/index.ts
diff --git a/wallets/metamask/src/pages/OnboardingPage/page.ts b/wallets/metamask/src/playwright/pages/OnboardingPage/page.ts
similarity index 86%
rename from wallets/metamask/src/pages/OnboardingPage/page.ts
rename to wallets/metamask/src/playwright/pages/OnboardingPage/page.ts
index 67ce03f0e..2c03651b4 100644
--- a/wallets/metamask/src/pages/OnboardingPage/page.ts
+++ b/wallets/metamask/src/playwright/pages/OnboardingPage/page.ts
@@ -1,6 +1,6 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../selectors/pages/OnboardingPage'
import { importWallet } from './actions'
-import Selectors from './selectors'
export class OnboardingPage {
static readonly selectors = Selectors
diff --git a/wallets/metamask/src/pages/SettingsPage/actions/disableEthSign.ts b/wallets/metamask/src/playwright/pages/SettingsPage/actions/disableEthSign.ts
similarity index 78%
rename from wallets/metamask/src/pages/SettingsPage/actions/disableEthSign.ts
rename to wallets/metamask/src/playwright/pages/SettingsPage/actions/disableEthSign.ts
index d4cab2335..8c917c25b 100644
--- a/wallets/metamask/src/pages/SettingsPage/actions/disableEthSign.ts
+++ b/wallets/metamask/src/playwright/pages/SettingsPage/actions/disableEthSign.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/SettingsPage'
export default async function disableEthSign(page: Page) {
await page.locator(Selectors.settings.advancedSettings).click()
diff --git a/wallets/metamask/src/pages/SettingsPage/actions/enableEthSign.ts b/wallets/metamask/src/playwright/pages/SettingsPage/actions/enableEthSign.ts
similarity index 92%
rename from wallets/metamask/src/pages/SettingsPage/actions/enableEthSign.ts
rename to wallets/metamask/src/playwright/pages/SettingsPage/actions/enableEthSign.ts
index 937ccf1cb..cd9a05c09 100644
--- a/wallets/metamask/src/pages/SettingsPage/actions/enableEthSign.ts
+++ b/wallets/metamask/src/playwright/pages/SettingsPage/actions/enableEthSign.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import Selectors from '../selectors'
+import Selectors from '../../../../selectors/pages/SettingsPage'
export default async function enableEthSign(page: Page) {
// Settings
diff --git a/wallets/metamask/src/pages/SettingsPage/actions/index.ts b/wallets/metamask/src/playwright/pages/SettingsPage/actions/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/SettingsPage/actions/index.ts
rename to wallets/metamask/src/playwright/pages/SettingsPage/actions/index.ts
diff --git a/wallets/metamask/src/pages/SettingsPage/page.ts b/wallets/metamask/src/playwright/pages/SettingsPage/page.ts
similarity index 87%
rename from wallets/metamask/src/pages/SettingsPage/page.ts
rename to wallets/metamask/src/playwright/pages/SettingsPage/page.ts
index a9889f5a7..71bcf29d1 100644
--- a/wallets/metamask/src/pages/SettingsPage/page.ts
+++ b/wallets/metamask/src/playwright/pages/SettingsPage/page.ts
@@ -1,7 +1,7 @@
import type { Page } from '@playwright/test'
+import Selectors from '../../../selectors/pages/SettingsPage'
import { enableEthSign } from './actions'
import disableEthSign from './actions/disableEthSign'
-import Selectors from './selectors'
export class SettingsPage {
static readonly selectors = Selectors
diff --git a/wallets/metamask/src/pages/index.ts b/wallets/metamask/src/playwright/pages/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/index.ts
rename to wallets/metamask/src/playwright/pages/index.ts
diff --git a/wallets/metamask/src/utils/allTextContents.ts b/wallets/metamask/src/playwright/utils/allTextContents.ts
similarity index 100%
rename from wallets/metamask/src/utils/allTextContents.ts
rename to wallets/metamask/src/playwright/utils/allTextContents.ts
diff --git a/wallets/metamask/src/utils/clickLocatorIfCondition.ts b/wallets/metamask/src/playwright/utils/clickLocatorIfCondition.ts
similarity index 100%
rename from wallets/metamask/src/utils/clickLocatorIfCondition.ts
rename to wallets/metamask/src/playwright/utils/clickLocatorIfCondition.ts
diff --git a/wallets/metamask/src/utils/getNotificationPageAndWaitForLoad.ts b/wallets/metamask/src/playwright/utils/getNotificationPageAndWaitForLoad.ts
similarity index 100%
rename from wallets/metamask/src/utils/getNotificationPageAndWaitForLoad.ts
rename to wallets/metamask/src/playwright/utils/getNotificationPageAndWaitForLoad.ts
diff --git a/wallets/metamask/src/utils/toggle.ts b/wallets/metamask/src/playwright/utils/toggle.ts
similarity index 100%
rename from wallets/metamask/src/utils/toggle.ts
rename to wallets/metamask/src/playwright/utils/toggle.ts
diff --git a/wallets/metamask/src/utils/waitFor.ts b/wallets/metamask/src/playwright/utils/waitFor.ts
similarity index 97%
rename from wallets/metamask/src/utils/waitFor.ts
rename to wallets/metamask/src/playwright/utils/waitFor.ts
index c5680567e..04e66a1f3 100644
--- a/wallets/metamask/src/utils/waitFor.ts
+++ b/wallets/metamask/src/playwright/utils/waitFor.ts
@@ -1,6 +1,7 @@
import type { Page } from '@playwright/test'
import { errors } from '@playwright/test'
-import { ErrorSelectors, LoadingSelectors } from '../selectors'
+import { LoadingSelectors } from '../../selectors'
+import { ErrorSelectors } from '../../selectors'
const DEFAULT_TIMEOUT = 2000
diff --git a/wallets/metamask/src/utils/waitForSpinnerToVanish.ts b/wallets/metamask/src/playwright/utils/waitForSpinnerToVanish.ts
similarity index 88%
rename from wallets/metamask/src/utils/waitForSpinnerToVanish.ts
rename to wallets/metamask/src/playwright/utils/waitForSpinnerToVanish.ts
index fd99071a0..77043750a 100644
--- a/wallets/metamask/src/utils/waitForSpinnerToVanish.ts
+++ b/wallets/metamask/src/playwright/utils/waitForSpinnerToVanish.ts
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
-import { LoadingSelectors } from '../selectors'
+import { LoadingSelectors } from '../../selectors'
// TODO: Should we decrease the timeout?
// TODO: Not sure if hard coding the timeout is a good idea but must be enough for now.
diff --git a/wallets/metamask/src/fixture-actions/prepareExtension.ts b/wallets/metamask/src/prepareExtension.ts
similarity index 59%
rename from wallets/metamask/src/fixture-actions/prepareExtension.ts
rename to wallets/metamask/src/prepareExtension.ts
index 649e346d0..47ae2c08f 100644
--- a/wallets/metamask/src/fixture-actions/prepareExtension.ts
+++ b/wallets/metamask/src/prepareExtension.ts
@@ -1,14 +1,25 @@
+import path from 'node:path'
import { downloadFile, ensureCacheDirExists, unzipArchive } from '@synthetixio/synpress-cache'
+import fs from 'fs-extra'
export const DEFAULT_METAMASK_VERSION = '11.9.1'
export const EXTENSION_DOWNLOAD_URL = `https://github.com/MetaMask/metamask-extension/releases/download/v${DEFAULT_METAMASK_VERSION}/metamask-chrome-${DEFAULT_METAMASK_VERSION}.zip`
-export async function prepareExtension() {
- const cacheDirPath = ensureCacheDirExists()
+export async function prepareExtension(forceCache = true) {
+ let outputDir = ''
+ if (forceCache) {
+ outputDir = ensureCacheDirExists()
+ } else {
+ outputDir = process.platform === 'win32' ? `file:\\\\\\${outputDir}` : path.resolve('./', 'downloads')
+
+ if (!(await fs.exists(outputDir))) {
+ fs.mkdirSync(outputDir)
+ }
+ }
const downloadResult = await downloadFile({
url: EXTENSION_DOWNLOAD_URL,
- outputDir: cacheDirPath,
+ outputDir,
fileName: `metamask-chrome-${DEFAULT_METAMASK_VERSION}.zip`
})
diff --git a/wallets/metamask/src/utils/selectors/createDataTestSelector.ts b/wallets/metamask/src/selectors/createDataTestSelector.ts
similarity index 100%
rename from wallets/metamask/src/utils/selectors/createDataTestSelector.ts
rename to wallets/metamask/src/selectors/createDataTestSelector.ts
diff --git a/wallets/metamask/src/selectors/index.ts b/wallets/metamask/src/selectors/index.ts
index bcf820533..dcba70893 100644
--- a/wallets/metamask/src/selectors/index.ts
+++ b/wallets/metamask/src/selectors/index.ts
@@ -1,2 +1,9 @@
export * from './loading'
export * from './error'
+
+export { default as crashPage } from './pages/CrashPage'
+export { default as homePage } from './pages/HomePage'
+export { default as lockPage } from './pages/LockPage'
+export { default as notificationPage } from './pages/NotificationPage'
+export { default as onboardingPage } from './pages/OnboardingPage'
+export { default as settingsPage } from './pages/SettingsPage'
diff --git a/wallets/metamask/src/pages/CrashPage/selectors/index.ts b/wallets/metamask/src/selectors/pages/CrashPage/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/CrashPage/selectors/index.ts
rename to wallets/metamask/src/selectors/pages/CrashPage/index.ts
diff --git a/wallets/metamask/src/pages/HomePage/selectors/index.ts b/wallets/metamask/src/selectors/pages/HomePage/index.ts
similarity index 98%
rename from wallets/metamask/src/pages/HomePage/selectors/index.ts
rename to wallets/metamask/src/selectors/pages/HomePage/index.ts
index 71f300bc9..d3a8a10b1 100644
--- a/wallets/metamask/src/pages/HomePage/selectors/index.ts
+++ b/wallets/metamask/src/selectors/pages/HomePage/index.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
import settings from './settings'
const accountMenuContainer = '.multichain-account-menu-popover'
diff --git a/wallets/metamask/src/pages/HomePage/selectors/settings.ts b/wallets/metamask/src/selectors/pages/HomePage/settings.ts
similarity index 95%
rename from wallets/metamask/src/pages/HomePage/selectors/settings.ts
rename to wallets/metamask/src/selectors/pages/HomePage/settings.ts
index d68edcaa6..e4b588985 100644
--- a/wallets/metamask/src/pages/HomePage/selectors/settings.ts
+++ b/wallets/metamask/src/selectors/pages/HomePage/settings.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
export enum SettingsSidebarMenus {
General = 1,
diff --git a/wallets/metamask/src/pages/LockPage/selectors/index.ts b/wallets/metamask/src/selectors/pages/LockPage/index.ts
similarity index 60%
rename from wallets/metamask/src/pages/LockPage/selectors/index.ts
rename to wallets/metamask/src/selectors/pages/LockPage/index.ts
index 233814296..6a4331f1d 100644
--- a/wallets/metamask/src/pages/LockPage/selectors/index.ts
+++ b/wallets/metamask/src/selectors/pages/LockPage/index.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
export default {
passwordInput: createDataTestSelector('unlock-password'),
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/actionFooter.ts b/wallets/metamask/src/selectors/pages/NotificationPage/actionFooter.ts
similarity index 72%
rename from wallets/metamask/src/pages/NotificationPage/selectors/actionFooter.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/actionFooter.ts
index fb1504b24..815fafd87 100644
--- a/wallets/metamask/src/pages/NotificationPage/selectors/actionFooter.ts
+++ b/wallets/metamask/src/selectors/pages/NotificationPage/actionFooter.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
export default {
confirmActionButton: `.page-container__footer ${createDataTestSelector('page-container-footer-next')}`,
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/connectPage.ts b/wallets/metamask/src/selectors/pages/NotificationPage/connectPage.ts
similarity index 100%
rename from wallets/metamask/src/pages/NotificationPage/selectors/connectPage.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/connectPage.ts
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/index.ts b/wallets/metamask/src/selectors/pages/NotificationPage/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/NotificationPage/selectors/index.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/index.ts
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/networkPage.ts b/wallets/metamask/src/selectors/pages/NotificationPage/networkPage.ts
similarity index 100%
rename from wallets/metamask/src/pages/NotificationPage/selectors/networkPage.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/networkPage.ts
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/permissionPage.ts b/wallets/metamask/src/selectors/pages/NotificationPage/permissionPage.ts
similarity index 69%
rename from wallets/metamask/src/pages/NotificationPage/selectors/permissionPage.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/permissionPage.ts
index f824e56cc..70fe9b90f 100644
--- a/wallets/metamask/src/pages/NotificationPage/selectors/permissionPage.ts
+++ b/wallets/metamask/src/selectors/pages/NotificationPage/permissionPage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
const approve = {
maxButton: createDataTestSelector('custom-spending-cap-max-button'),
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/signaturePage.ts b/wallets/metamask/src/selectors/pages/NotificationPage/signaturePage.ts
similarity index 88%
rename from wallets/metamask/src/pages/NotificationPage/selectors/signaturePage.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/signaturePage.ts
index a7b9dee0e..7b133cc4f 100644
--- a/wallets/metamask/src/pages/NotificationPage/selectors/signaturePage.ts
+++ b/wallets/metamask/src/selectors/pages/NotificationPage/signaturePage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
const simpleMessage = {
signButton: `.request-signature__footer ${createDataTestSelector('request-signature__sign')}`,
diff --git a/wallets/metamask/src/pages/NotificationPage/selectors/transactionPage.ts b/wallets/metamask/src/selectors/pages/NotificationPage/transactionPage.ts
similarity index 94%
rename from wallets/metamask/src/pages/NotificationPage/selectors/transactionPage.ts
rename to wallets/metamask/src/selectors/pages/NotificationPage/transactionPage.ts
index 7e1b46761..ed4a9c9c0 100644
--- a/wallets/metamask/src/pages/NotificationPage/selectors/transactionPage.ts
+++ b/wallets/metamask/src/selectors/pages/NotificationPage/transactionPage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
const advancedGasFeeMenu = {
maxBaseFeeInput: createDataTestSelector('base-fee-input'),
diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/analyticsPage.ts b/wallets/metamask/src/selectors/pages/OnboardingPage/analyticsPage.ts
similarity index 60%
rename from wallets/metamask/src/pages/OnboardingPage/selectors/analyticsPage.ts
rename to wallets/metamask/src/selectors/pages/OnboardingPage/analyticsPage.ts
index 5051b9152..7738bd2ed 100644
--- a/wallets/metamask/src/pages/OnboardingPage/selectors/analyticsPage.ts
+++ b/wallets/metamask/src/selectors/pages/OnboardingPage/analyticsPage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
export default {
optIn: createDataTestSelector('metametrics-i-agree'),
diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/getStartedPage.ts b/wallets/metamask/src/selectors/pages/OnboardingPage/getStartedPage.ts
similarity index 72%
rename from wallets/metamask/src/pages/OnboardingPage/selectors/getStartedPage.ts
rename to wallets/metamask/src/selectors/pages/OnboardingPage/getStartedPage.ts
index 200d1adb2..5362059c0 100644
--- a/wallets/metamask/src/pages/OnboardingPage/selectors/getStartedPage.ts
+++ b/wallets/metamask/src/selectors/pages/OnboardingPage/getStartedPage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
export default {
termsOfServiceCheckbox: createDataTestSelector('onboarding-terms-checkbox'),
diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/index.ts b/wallets/metamask/src/selectors/pages/OnboardingPage/index.ts
similarity index 100%
rename from wallets/metamask/src/pages/OnboardingPage/selectors/index.ts
rename to wallets/metamask/src/selectors/pages/OnboardingPage/index.ts
diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/pinExtensionPage.ts b/wallets/metamask/src/selectors/pages/OnboardingPage/pinExtensionPage.ts
similarity index 61%
rename from wallets/metamask/src/pages/OnboardingPage/selectors/pinExtensionPage.ts
rename to wallets/metamask/src/selectors/pages/OnboardingPage/pinExtensionPage.ts
index b0a0d5eda..64a9b9634 100644
--- a/wallets/metamask/src/pages/OnboardingPage/selectors/pinExtensionPage.ts
+++ b/wallets/metamask/src/selectors/pages/OnboardingPage/pinExtensionPage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
export default {
nextButton: createDataTestSelector('pin-extension-next'),
diff --git a/wallets/metamask/src/pages/OnboardingPage/selectors/secretRecoveryPhrasePage.ts b/wallets/metamask/src/selectors/pages/OnboardingPage/secretRecoveryPhrasePage.ts
similarity index 90%
rename from wallets/metamask/src/pages/OnboardingPage/selectors/secretRecoveryPhrasePage.ts
rename to wallets/metamask/src/selectors/pages/OnboardingPage/secretRecoveryPhrasePage.ts
index 1bce0f81a..6a96d5b34 100644
--- a/wallets/metamask/src/pages/OnboardingPage/selectors/secretRecoveryPhrasePage.ts
+++ b/wallets/metamask/src/selectors/pages/OnboardingPage/secretRecoveryPhrasePage.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
const recoveryStep = {
selectNumberOfWordsDropdown: '.import-srp__number-of-words-dropdown > .dropdown__select',
diff --git a/wallets/metamask/src/selectors/pages/OnboardingPage/walletCreationSuccessPage.ts b/wallets/metamask/src/selectors/pages/OnboardingPage/walletCreationSuccessPage.ts
new file mode 100644
index 000000000..726626a15
--- /dev/null
+++ b/wallets/metamask/src/selectors/pages/OnboardingPage/walletCreationSuccessPage.ts
@@ -0,0 +1,5 @@
+import { createDataTestSelector } from '../../createDataTestSelector'
+
+export default {
+ confirmButton: createDataTestSelector('onboarding-complete-done')
+}
diff --git a/wallets/metamask/src/pages/SettingsPage/selectors/index.ts b/wallets/metamask/src/selectors/pages/SettingsPage/index.ts
similarity index 89%
rename from wallets/metamask/src/pages/SettingsPage/selectors/index.ts
rename to wallets/metamask/src/selectors/pages/SettingsPage/index.ts
index e72f3dac5..57e201a10 100644
--- a/wallets/metamask/src/pages/SettingsPage/selectors/index.ts
+++ b/wallets/metamask/src/selectors/pages/SettingsPage/index.ts
@@ -1,4 +1,4 @@
-import { createDataTestSelector } from '../../../utils/selectors/createDataTestSelector'
+import { createDataTestSelector } from '../../createDataTestSelector'
const menuOption = '.settings-page__content__tabs .tab-bar .tab-bar__tab'
diff --git a/wallets/metamask/src/type/MetaMaskAbstract.ts b/wallets/metamask/src/type/MetaMaskAbstract.ts
new file mode 100644
index 000000000..be64e4b90
--- /dev/null
+++ b/wallets/metamask/src/type/MetaMaskAbstract.ts
@@ -0,0 +1,262 @@
+import type { Network } from '../playwright/pages/HomePage/actions'
+import type { GasSetting } from '../playwright/pages/NotificationPage/actions'
+import { SettingsSidebarMenus } from '../selectors/pages/HomePage/settings'
+
+export abstract class MetaMaskAbstract {
+ /**
+ * @param password - The password of the MetaMask wallet.
+ * @param extensionId - The extension ID of the MetaMask extension. Optional if no interaction with the dapp is required.
+ *
+ * @returns A new instance of the MetaMask class.
+ */
+ constructor(
+ /**
+ * The password of the MetaMask wallet.
+ */
+ readonly password: string,
+ /**
+ * The extension ID of the MetaMask extension. Optional if no interaction with the dapp is required.
+ */
+ readonly extensionId?: string
+ ) {
+ this.password = password
+ this.extensionId = extensionId
+ }
+
+ /**
+ * Imports a wallet using the given seed phrase.
+ *
+ * @param seedPhrase - The seed phrase to import.
+ */
+ abstract importWallet(seedPhrase: string): void
+
+ /**
+ * Adds a new account with the given name. This account is based on the initially imported seed phrase.
+ *
+ * @param accountName - The name of the new account.
+ */
+ abstract addNewAccount(accountName: string): void
+
+ /**
+ * Imports a wallet using the given private key.
+ *
+ * @param privateKey - The private key to import.
+ */
+ abstract importWalletFromPrivateKey(privateKey: string): void
+
+ /**
+ * Switches to the account with the given name.
+ *
+ * @param accountName - The name of the account to switch to.
+ */
+ abstract switchAccount(accountName: string): void
+
+ /**
+ * Adds a new network.
+ *
+ * @param network - The network object to use for adding the new network.
+ * @param network.name - The name of the network.
+ * @param network.rpcUrl - The RPC URL of the network.
+ * @param network.chainId - The chain ID of the network.
+ * @param network.symbol - The currency symbol of the network.
+ * @param network.blockExplorerUrl - The block explorer URL of the network.
+ */
+ abstract addNetwork(network: Network): void
+
+ /**
+ * Retrieves the current account address.
+ */
+ abstract getAccountAddress(): void
+
+ /**
+ * Switches to the network with the given name.
+ *
+ * @param networkName - The name of the network to switch to.
+ * @param isTestnet - If switch to a test network.
+ */
+ abstract switchNetwork(networkName: string, isTestnet: boolean): void
+
+ /**
+ * Connects to the dapp using the currently selected account.
+ */
+ abstract connectToDapp(accounts?: string[]): void
+
+ /**
+ * Locks MetaMask.
+ */
+ abstract lock(): void
+
+ /**
+ * Unlocks MetaMask.
+ */
+ abstract unlock(): void
+
+ /**
+ * Confirms a signature request. This function supports all types of commonly used signatures.
+ */
+ abstract confirmSignature(): void
+
+ /**
+ * Confirms a signature request with potential risk.
+ */
+ abstract confirmSignatureWithRisk(): void
+
+ /**
+ * Rejects a signature request. This function supports all types of commonly used signatures.
+ */
+ abstract rejectSignature(): void
+
+ /**
+ * Approves a new network request.
+ */
+ abstract approveNewNetwork(): void
+
+ /**
+ * Rejects a new network request.
+ */
+ abstract rejectNewNetwork(): void
+
+ /**
+ * Approves a switch network request.
+ */
+ abstract approveSwitchNetwork(): void
+
+ /**
+ * Rejects a switch network request.
+ */
+ abstract rejectSwitchNetwork(): void
+
+ /**
+ * Confirms a transaction request.
+ *
+ * @param options - The transaction options.
+ * @param options.gasSetting - The gas setting to use for the transaction.
+ */
+ abstract confirmTransaction(options?: { gasSetting?: GasSetting }): void
+
+ /**
+ * Rejects a transaction request.
+ */
+ abstract rejectTransaction(): void
+
+ /**
+ * Approves a permission request to spend tokens.
+ *
+ * ::: warning
+ * For NFT approvals, use `confirmTransaction` method.
+ * :::
+ *
+ * @param options - The permission options.
+ * @param options.spendLimit - The spend limit to use for the permission.
+ * @param options.gasSetting - The gas setting to use for the approval transaction.
+ */
+ abstract approveTokenPermission(options?: {
+ spendLimit?: 'max' | number
+ gasSetting?: GasSetting
+ }): void
+
+ /**
+ * Rejects a permission request to spend tokens.
+ *
+ * ::: warning
+ * For NFT approvals, use `confirmTransaction` method.
+ * :::
+ */
+ abstract rejectTokenPermission(): void
+
+ /**
+ * Goes back to the home page of MetaMask tab.
+ */
+ abstract goBackToHomePage(): void
+
+ /**
+ * Opens the settings page.
+ */
+ abstract openSettings(): void
+
+ /**
+ * Opens a given menu in the sidebar.
+ *
+ * @param menu - The menu to open.
+ */
+ abstract openSidebarMenu(menu: SettingsSidebarMenus): void
+ /**
+ * Toggles the "Show Test Networks" setting.
+ *
+ * ::: warning
+ * This function requires the correct menu to be already opened.
+ * :::
+ */
+ abstract toggleShowTestNetworks(): void
+
+ /**
+ * Toggles the "Dismiss Secret Recovery Phrase Reminder" setting.
+ *
+ * ::: warning
+ * This function requires the correct menu to be already opened.
+ * :::
+ */
+ abstract toggleDismissSecretRecoveryPhraseReminder(): void
+
+ /**
+ * Resets the account.
+ *
+ * ::: warning
+ * This function requires the correct menu to be already opened.
+ * :::
+ */
+ abstract resetAccount(): void
+
+ /**
+ * Enables the eth_sign feature in MetaMask advanced settings.
+ * This method is marked as unsafe because enabling eth_sign can have security implications.
+ */
+ abstract unsafe_enableEthSign(): void
+
+ /**
+ * Disables the eth_sign feature in MetaMask advanced settings.
+ */
+ abstract disableEthSign(): void
+
+ abstract addNewToken(): void
+
+ abstract providePublicEncryptionKey(): void
+
+ abstract decrypt(): void
+
+ /// -------------------------------------------
+ /// ---------- EXPERIMENTAL FEATURES ----------
+ /// -------------------------------------------
+
+ /**
+ * Confirms a transaction request and waits for the transaction to be mined.
+ * This function utilizes the "Activity" tab of the MetaMask tab.
+ *
+ * @param options - The transaction options.
+ * @param options.gasSetting - The gas setting to use for the transaction.
+ *
+ * @experimental
+ * @group Experimental Methods
+ */
+ abstract confirmTransactionAndWaitForMining(options?: {
+ gasSetting?: GasSetting
+ }): void
+
+ /**
+ * Opens the transaction details.
+ *
+ * @param txIndex - The index of the transaction in the "Activity" tab. Starts from `0`.
+ *
+ * @experimental
+ * @group Experimental Methods
+ */
+ abstract openTransactionDetails(txIndex: number): void
+
+ /**
+ * Closes the currently opened transaction details.
+ *
+ * @experimental
+ * @group Experimental Methods
+ */
+ abstract closeTransactionDetails(): void
+}
diff --git a/wallets/metamask/test/cypress/metamask.cy.ts b/wallets/metamask/test/cypress/metamask.cy.ts
new file mode 100644
index 000000000..b9baa54c1
--- /dev/null
+++ b/wallets/metamask/test/cypress/metamask.cy.ts
@@ -0,0 +1,12 @@
+it('should connect to ethereum', () => {
+ cy.window().then((window) => {
+ // @ts-ignore
+ window.ethereum
+ .request({
+ method: 'eth_chainId'
+ })
+ .then((currentChainId: string) => {
+ expect(currentChainId).to.equal('0x1')
+ })
+ })
+})
diff --git a/wallets/metamask/test/e2e/PPOM.spec.ts b/wallets/metamask/test/playwright/e2e/PPOM.spec.ts
similarity index 93%
rename from wallets/metamask/test/e2e/PPOM.spec.ts
rename to wallets/metamask/test/playwright/e2e/PPOM.spec.ts
index fdfa7ffbb..944b21343 100644
--- a/wallets/metamask/test/e2e/PPOM.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/PPOM.spec.ts
@@ -1,5 +1,5 @@
-import { getNotificationPageAndWaitForLoad } from '../../src/utils/getNotificationPageAndWaitForLoad'
-import { createDataTestSelector } from '../../src/utils/selectors/createDataTestSelector'
+import { getNotificationPageAndWaitForLoad } from '../../../src/playwright/utils/getNotificationPageAndWaitForLoad'
+import { createDataTestSelector } from '../../../src/selectors/createDataTestSelector'
import synpress from '../synpress'
const test = synpress
diff --git a/wallets/metamask/test/e2e/addNetwork.spec.ts b/wallets/metamask/test/playwright/e2e/addNetwork.spec.ts
similarity index 97%
rename from wallets/metamask/test/e2e/addNetwork.spec.ts
rename to wallets/metamask/test/playwright/e2e/addNetwork.spec.ts
index 0d3fa5b6f..7a1fcf0bc 100644
--- a/wallets/metamask/test/e2e/addNetwork.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/addNetwork.spec.ts
@@ -1,5 +1,5 @@
import { z } from 'zod'
-import { waitFor } from '../../src/utils/waitFor'
+import { waitFor } from '../../../src/playwright/utils/waitFor'
import synpress from '../synpress'
diff --git a/wallets/metamask/test/e2e/addNewAccount.spec.ts b/wallets/metamask/test/playwright/e2e/addNewAccount.spec.ts
similarity index 92%
rename from wallets/metamask/test/e2e/addNewAccount.spec.ts
rename to wallets/metamask/test/playwright/e2e/addNewAccount.spec.ts
index a759e811d..6ad6048f0 100644
--- a/wallets/metamask/test/e2e/addNewAccount.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/addNewAccount.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/addNewToken.spec.ts b/wallets/metamask/test/playwright/e2e/addNewToken.spec.ts
similarity index 93%
rename from wallets/metamask/test/e2e/addNewToken.spec.ts
rename to wallets/metamask/test/playwright/e2e/addNewToken.spec.ts
index 633de0964..9f8139bb5 100644
--- a/wallets/metamask/test/e2e/addNewToken.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/addNewToken.spec.ts
@@ -1,4 +1,4 @@
-import Selectors from '../../src/pages/HomePage/selectors'
+import Selectors from '../../../src/selectors/pages/HomePage'
import synpress from '../synpress'
diff --git a/wallets/metamask/test/e2e/approveNewNetwork.spec.ts b/wallets/metamask/test/playwright/e2e/approveNewNetwork.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/approveNewNetwork.spec.ts
rename to wallets/metamask/test/playwright/e2e/approveNewNetwork.spec.ts
diff --git a/wallets/metamask/test/e2e/approvePermission.spec.ts b/wallets/metamask/test/playwright/e2e/approvePermission.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/approvePermission.spec.ts
rename to wallets/metamask/test/playwright/e2e/approvePermission.spec.ts
diff --git a/wallets/metamask/test/e2e/approveSwitchNetwork.spec.ts b/wallets/metamask/test/playwright/e2e/approveSwitchNetwork.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/approveSwitchNetwork.spec.ts
rename to wallets/metamask/test/playwright/e2e/approveSwitchNetwork.spec.ts
diff --git a/wallets/metamask/test/e2e/batchTransfer.spec.ts b/wallets/metamask/test/playwright/e2e/batchTransfer.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/batchTransfer.spec.ts
rename to wallets/metamask/test/playwright/e2e/batchTransfer.spec.ts
diff --git a/wallets/metamask/test/e2e/closeTransactionDetails.spec.ts b/wallets/metamask/test/playwright/e2e/closeTransactionDetails.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/closeTransactionDetails.spec.ts
rename to wallets/metamask/test/playwright/e2e/closeTransactionDetails.spec.ts
diff --git a/wallets/metamask/test/e2e/confirmSignature.spec.ts b/wallets/metamask/test/playwright/e2e/confirmSignature.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/confirmSignature.spec.ts
rename to wallets/metamask/test/playwright/e2e/confirmSignature.spec.ts
diff --git a/wallets/metamask/test/e2e/confirmTransaction.spec.ts b/wallets/metamask/test/playwright/e2e/confirmTransaction.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/confirmTransaction.spec.ts
rename to wallets/metamask/test/playwright/e2e/confirmTransaction.spec.ts
diff --git a/wallets/metamask/test/e2e/confirmTransactionAndWaitForMining.spec.ts b/wallets/metamask/test/playwright/e2e/confirmTransactionAndWaitForMining.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/confirmTransactionAndWaitForMining.spec.ts
rename to wallets/metamask/test/playwright/e2e/confirmTransactionAndWaitForMining.spec.ts
diff --git a/wallets/metamask/test/e2e/connectToDapp.spec.ts b/wallets/metamask/test/playwright/e2e/connectToDapp.spec.ts
similarity index 94%
rename from wallets/metamask/test/e2e/connectToDapp.spec.ts
rename to wallets/metamask/test/playwright/e2e/connectToDapp.spec.ts
index 1fa603ac8..fd356866f 100644
--- a/wallets/metamask/test/e2e/connectToDapp.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/connectToDapp.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/encrypt.spec.ts b/wallets/metamask/test/playwright/e2e/encrypt.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/encrypt.spec.ts
rename to wallets/metamask/test/playwright/e2e/encrypt.spec.ts
diff --git a/wallets/metamask/test/e2e/goBackToHomePage.spec.ts b/wallets/metamask/test/playwright/e2e/goBackToHomePage.spec.ts
similarity index 90%
rename from wallets/metamask/test/e2e/goBackToHomePage.spec.ts
rename to wallets/metamask/test/playwright/e2e/goBackToHomePage.spec.ts
index 6213c8096..d662c2f03 100644
--- a/wallets/metamask/test/e2e/goBackToHomePage.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/goBackToHomePage.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/importWallet.spec.ts b/wallets/metamask/test/playwright/e2e/importWallet.spec.ts
similarity index 95%
rename from wallets/metamask/test/e2e/importWallet.spec.ts
rename to wallets/metamask/test/playwright/e2e/importWallet.spec.ts
index 7e1c55a12..3ce966676 100644
--- a/wallets/metamask/test/e2e/importWallet.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/importWallet.spec.ts
@@ -1,5 +1,6 @@
import { type Page, chromium, test as base } from '@playwright/test'
-import { MetaMask, prepareExtension } from '../../src'
+import { MetaMask } from '../../../src/playwright'
+import { prepareExtension } from '../../../src/prepareExtension'
const SEED_PHRASE = 'test test test test test test test test test test test junk'
const PASSWORD = 'Tester@1234'
diff --git a/wallets/metamask/test/e2e/importWalletFromPrivateKey.spec.ts b/wallets/metamask/test/playwright/e2e/importWalletFromPrivateKey.spec.ts
similarity index 96%
rename from wallets/metamask/test/e2e/importWalletFromPrivateKey.spec.ts
rename to wallets/metamask/test/playwright/e2e/importWalletFromPrivateKey.spec.ts
index a12f5b523..3f76dedf0 100644
--- a/wallets/metamask/test/e2e/importWalletFromPrivateKey.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/importWalletFromPrivateKey.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/lock.spec.ts b/wallets/metamask/test/playwright/e2e/lock.spec.ts
similarity index 87%
rename from wallets/metamask/test/e2e/lock.spec.ts
rename to wallets/metamask/test/playwright/e2e/lock.spec.ts
index 29eb54075..300e315f2 100644
--- a/wallets/metamask/test/e2e/lock.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/lock.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/openSettings.spec.ts b/wallets/metamask/test/playwright/e2e/openSettings.spec.ts
similarity index 89%
rename from wallets/metamask/test/e2e/openSettings.spec.ts
rename to wallets/metamask/test/playwright/e2e/openSettings.spec.ts
index e15a53074..00ebb127c 100644
--- a/wallets/metamask/test/e2e/openSettings.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/openSettings.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
const test = testWithSynpress(metaMaskFixtures(basicSetup))
diff --git a/wallets/metamask/test/e2e/openSidebarMenu.spec.ts b/wallets/metamask/test/playwright/e2e/openSidebarMenu.spec.ts
similarity index 92%
rename from wallets/metamask/test/e2e/openSidebarMenu.spec.ts
rename to wallets/metamask/test/playwright/e2e/openSidebarMenu.spec.ts
index 97b6a5ad1..a9c455dc7 100644
--- a/wallets/metamask/test/e2e/openSidebarMenu.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/openSidebarMenu.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/openTransactionDetails.spec.ts b/wallets/metamask/test/playwright/e2e/openTransactionDetails.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/openTransactionDetails.spec.ts
rename to wallets/metamask/test/playwright/e2e/openTransactionDetails.spec.ts
diff --git a/wallets/metamask/test/e2e/rejectAddNetwork.spec.ts b/wallets/metamask/test/playwright/e2e/rejectAddNetwork.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/rejectAddNetwork.spec.ts
rename to wallets/metamask/test/playwright/e2e/rejectAddNetwork.spec.ts
diff --git a/wallets/metamask/test/e2e/rejectPermission.spec.ts b/wallets/metamask/test/playwright/e2e/rejectPermission.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/rejectPermission.spec.ts
rename to wallets/metamask/test/playwright/e2e/rejectPermission.spec.ts
diff --git a/wallets/metamask/test/e2e/rejectSignature.spec.ts b/wallets/metamask/test/playwright/e2e/rejectSignature.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/rejectSignature.spec.ts
rename to wallets/metamask/test/playwright/e2e/rejectSignature.spec.ts
diff --git a/wallets/metamask/test/e2e/rejectSwitchNetwork.spec.ts b/wallets/metamask/test/playwright/e2e/rejectSwitchNetwork.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/rejectSwitchNetwork.spec.ts
rename to wallets/metamask/test/playwright/e2e/rejectSwitchNetwork.spec.ts
diff --git a/wallets/metamask/test/e2e/rejectTransaction.spec.ts b/wallets/metamask/test/playwright/e2e/rejectTransaction.spec.ts
similarity index 100%
rename from wallets/metamask/test/e2e/rejectTransaction.spec.ts
rename to wallets/metamask/test/playwright/e2e/rejectTransaction.spec.ts
diff --git a/wallets/metamask/test/e2e/renameAccount.spec.ts b/wallets/metamask/test/playwright/e2e/renameAccount.spec.ts
similarity index 89%
rename from wallets/metamask/test/e2e/renameAccount.spec.ts
rename to wallets/metamask/test/playwright/e2e/renameAccount.spec.ts
index b3aa89acc..34356b762 100644
--- a/wallets/metamask/test/e2e/renameAccount.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/renameAccount.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/resetAccount.spec.ts b/wallets/metamask/test/playwright/e2e/resetAccount.spec.ts
similarity index 89%
rename from wallets/metamask/test/e2e/resetAccount.spec.ts
rename to wallets/metamask/test/playwright/e2e/resetAccount.spec.ts
index b65795c48..4517096ea 100644
--- a/wallets/metamask/test/e2e/resetAccount.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/resetAccount.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/switchAccount.spec.ts b/wallets/metamask/test/playwright/e2e/switchAccount.spec.ts
similarity index 94%
rename from wallets/metamask/test/e2e/switchAccount.spec.ts
rename to wallets/metamask/test/playwright/e2e/switchAccount.spec.ts
index b9eb400a9..f6f2a6c1c 100644
--- a/wallets/metamask/test/e2e/switchAccount.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/switchAccount.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/switchNetwork.spec.ts b/wallets/metamask/test/playwright/e2e/switchNetwork.spec.ts
similarity index 95%
rename from wallets/metamask/test/e2e/switchNetwork.spec.ts
rename to wallets/metamask/test/playwright/e2e/switchNetwork.spec.ts
index 4335938de..0ad50973d 100644
--- a/wallets/metamask/test/e2e/switchNetwork.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/switchNetwork.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts b/wallets/metamask/test/playwright/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts
similarity index 87%
rename from wallets/metamask/test/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts
rename to wallets/metamask/test/playwright/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts
index e3a99f820..c337f11e6 100644
--- a/wallets/metamask/test/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/toggleDismissSecretRecoveryPhraseReminder.spec.ts
@@ -1,7 +1,7 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
-import Selectors from '../../src/pages/HomePage/selectors'
+import Selectors from '../../../src/selectors/pages/HomePage'
import basicSetup from '../wallet-setup/basic.setup'
const test = testWithSynpress(metaMaskFixtures(basicSetup))
diff --git a/wallets/metamask/test/e2e/toggleShowTestNetworks.spec.ts b/wallets/metamask/test/playwright/e2e/toggleShowTestNetworks.spec.ts
similarity index 89%
rename from wallets/metamask/test/e2e/toggleShowTestNetworks.spec.ts
rename to wallets/metamask/test/playwright/e2e/toggleShowTestNetworks.spec.ts
index 4ae671eda..6361fbaf4 100644
--- a/wallets/metamask/test/e2e/toggleShowTestNetworks.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/toggleShowTestNetworks.spec.ts
@@ -1,7 +1,7 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
-import Selectors from '../../src/pages/HomePage/selectors'
+import Selectors from '../../../src/selectors/pages/HomePage'
import basicSetup from '../wallet-setup/basic.setup'
const test = testWithSynpress(metaMaskFixtures(basicSetup))
diff --git a/wallets/metamask/test/e2e/unlock.spec.ts b/wallets/metamask/test/playwright/e2e/unlock.spec.ts
similarity index 87%
rename from wallets/metamask/test/e2e/unlock.spec.ts
rename to wallets/metamask/test/playwright/e2e/unlock.spec.ts
index 57320d9fa..93e1ca381 100644
--- a/wallets/metamask/test/e2e/unlock.spec.ts
+++ b/wallets/metamask/test/playwright/e2e/unlock.spec.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { MetaMask, metaMaskFixtures } from '../../src'
+import { MetaMask, metaMaskFixtures } from '../../../src/playwright'
import basicSetup from '../wallet-setup/basic.setup'
diff --git a/wallets/metamask/test/synpress.ts b/wallets/metamask/test/playwright/synpress.ts
similarity index 77%
rename from wallets/metamask/test/synpress.ts
rename to wallets/metamask/test/playwright/synpress.ts
index bf6f76793..91efba0e3 100644
--- a/wallets/metamask/test/synpress.ts
+++ b/wallets/metamask/test/playwright/synpress.ts
@@ -1,5 +1,5 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
-import { metaMaskFixtures } from '../src'
+import { metaMaskFixtures } from '../../src/playwright'
import connectedSetup from './wallet-setup/connected.setup'
export default testWithSynpress(metaMaskFixtures(connectedSetup))
diff --git a/wallets/metamask/test/wallet-setup/basic.setup.d.ts b/wallets/metamask/test/playwright/wallet-setup/basic.setup.d.ts
similarity index 100%
rename from wallets/metamask/test/wallet-setup/basic.setup.d.ts
rename to wallets/metamask/test/playwright/wallet-setup/basic.setup.d.ts
diff --git a/wallets/metamask/test/wallet-setup/basic.setup.d.ts.map b/wallets/metamask/test/playwright/wallet-setup/basic.setup.d.ts.map
similarity index 100%
rename from wallets/metamask/test/wallet-setup/basic.setup.d.ts.map
rename to wallets/metamask/test/playwright/wallet-setup/basic.setup.d.ts.map
diff --git a/wallets/metamask/test/wallet-setup/basic.setup.ts b/wallets/metamask/test/playwright/wallet-setup/basic.setup.ts
similarity index 88%
rename from wallets/metamask/test/wallet-setup/basic.setup.ts
rename to wallets/metamask/test/playwright/wallet-setup/basic.setup.ts
index bd95e161f..1ab425893 100644
--- a/wallets/metamask/test/wallet-setup/basic.setup.ts
+++ b/wallets/metamask/test/playwright/wallet-setup/basic.setup.ts
@@ -1,5 +1,5 @@
import { defineWalletSetup } from '@synthetixio/synpress-cache'
-import { MetaMask } from '../../src'
+import { MetaMask } from '../../../src/playwright'
export const SEED_PHRASE = 'test test test test test test test test test test test junk'
diff --git a/wallets/metamask/test/wallet-setup/connected.setup.ts b/wallets/metamask/test/playwright/wallet-setup/connected.setup.ts
similarity index 92%
rename from wallets/metamask/test/wallet-setup/connected.setup.ts
rename to wallets/metamask/test/playwright/wallet-setup/connected.setup.ts
index 3bcd4659b..4bbea6c31 100644
--- a/wallets/metamask/test/wallet-setup/connected.setup.ts
+++ b/wallets/metamask/test/playwright/wallet-setup/connected.setup.ts
@@ -1,5 +1,5 @@
import { defineWalletSetup } from '@synthetixio/synpress-cache'
-import { MetaMask, getExtensionId } from '../../src'
+import { MetaMask, getExtensionId } from '../../../src/playwright'
const SEED_PHRASE = 'test test test test test test test test test test test junk'
diff --git a/wallets/metamask/test/unit/prepareExtension.test.ts b/wallets/metamask/test/unit/prepareExtension.test.ts
index 840b7ba5f..eb42ce072 100644
--- a/wallets/metamask/test/unit/prepareExtension.test.ts
+++ b/wallets/metamask/test/unit/prepareExtension.test.ts
@@ -1,6 +1,7 @@
import * as core from '@synthetixio/synpress-cache'
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'
-import { DEFAULT_METAMASK_VERSION, EXTENSION_DOWNLOAD_URL, prepareExtension } from '../../src'
+
+import { DEFAULT_METAMASK_VERSION, EXTENSION_DOWNLOAD_URL, prepareExtension } from '../../src/prepareExtension'
const MOCK_CACHE_DIR_PATH = 'mockCacheDirPath'
const MOCK_EXTENSION_ARCHIVE_PATH = 'mockExtensionArchivePath'
diff --git a/wallets/metamask/tsconfig.json b/wallets/metamask/tsconfig.json
index 15e94bcc2..4e7446721 100644
--- a/wallets/metamask/tsconfig.json
+++ b/wallets/metamask/tsconfig.json
@@ -4,14 +4,8 @@
"rootDir": ".",
"exactOptionalPropertyTypes": false, // Allows for `undefined` in `playwright.config.ts`
"types": ["cypress"],
+ "sourceMap": false
},
- "include": [
- "src",
- "test"
- ],
- "files": [
- "environment.d.ts",
- "playwright.config.ts",
- "vitest.config.ts",
- ]
+ "include": ["src", "test"],
+ "files": ["environment.d.ts", "playwright.config.ts", "vitest.config.ts"]
}
diff --git a/wallets/metamask/tsup.config.ts b/wallets/metamask/tsup.config.ts
index 63ed05775..3d9157495 100644
--- a/wallets/metamask/tsup.config.ts
+++ b/wallets/metamask/tsup.config.ts
@@ -2,7 +2,7 @@ import { defineConfig } from 'tsup'
export default defineConfig({
name: 'metamask',
- entry: ['src/index.ts'],
+ entry: ['src/index.ts', 'src/playwright/index.ts', 'src/cypress/index.ts'],
outDir: 'dist',
format: 'esm',
splitting: false,