From 7cf5e34444a1e902cb552915f2ef0d5700b62698 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 24 Oct 2024 20:28:05 +0100 Subject: [PATCH] chore: upgrate mm tools --- packages/adapter/package.json | 2 +- packages/snap/package.json | 2 +- packages/snap/playwright.config.js | 2 +- packages/snap/test/configure.spec.ts | 6 ++-- packages/snap/test/gas-estimate.spec.ts | 4 +-- packages/snap/test/mainnet.spec.ts | 3 +- packages/snap/test/methods.spec.ts | 18 ++++------- pnpm-lock.yaml | 40 +++++++++++++++++++------ 8 files changed, 44 insertions(+), 33 deletions(-) diff --git a/packages/adapter/package.json b/packages/adapter/package.json index 473cef51..41ba6e39 100644 --- a/packages/adapter/package.json +++ b/packages/adapter/package.json @@ -51,7 +51,7 @@ "devDependencies": { "@playwright/test": "^1.48.1", "@types/node": "^22.7.9", - "metamask-testing-tools": "^2.0.1", + "metamask-testing-tools": "^2.1.0", "typescript": "5.6.3" }, "publishConfig": { diff --git a/packages/snap/package.json b/packages/snap/package.json index 680312a6..40d77ded 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -91,7 +91,7 @@ "@playwright/test": "^1.48.1", "@types/react": "18.2.14", "@types/react-dom": "18.2.4", - "metamask-testing-tools": "^2.0.1", + "metamask-testing-tools": "^2.1.0", "playwright-test": "^14.1.6", "type-fest": "^4.26.1", "typescript": "5.6.3" diff --git a/packages/snap/playwright.config.js b/packages/snap/playwright.config.js index c12255ba..a13c4de3 100644 --- a/packages/snap/playwright.config.js +++ b/packages/snap/playwright.config.js @@ -6,7 +6,7 @@ export default defineConfig({ timeout: process.env.CI ? 60 * 1000 : 30 * 1000, forbidOnly: Boolean(process.env.CI), retries: process.env.CI ? 2 : 1, - workers: process.env.CI ? 1 : 1, + workers: process.env.CI ? 1 : undefined, reporter: process.env.CI ? [['html'], ['list']] : 'list', use: { baseURL: 'http://example.org', diff --git a/packages/snap/test/configure.spec.ts b/packages/snap/test/configure.spec.ts index 27902d69..e26524cb 100644 --- a/packages/snap/test/configure.spec.ts +++ b/packages/snap/test/configure.spec.ts @@ -24,8 +24,7 @@ test.describe('fil_configure', () => { page, }) - const dialog = await metamask.waitForDialog('confirmation') - await dialog.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() const response = await req expect(response.result).toStrictEqual({ @@ -51,8 +50,7 @@ test.describe('fil_configure', () => { page, }) - const dialog = await metamask.waitForDialog('confirmation') - await dialog.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() const response = await req expect(response.result).toStrictEqual({ diff --git a/packages/snap/test/gas-estimate.spec.ts b/packages/snap/test/gas-estimate.spec.ts index a672c8dd..de5035e8 100644 --- a/packages/snap/test/gas-estimate.spec.ts +++ b/packages/snap/test/gas-estimate.spec.ts @@ -26,9 +26,7 @@ test.beforeAll(async ({ metamask, page }) => { page, }) - const dialog = await metamask.waitForDialog('confirmation') - await dialog.getByTestId('confirmation-submit-button').click() - + await metamask.waitForConfirmation() await req }) test.describe('fil_getGasForMessage', () => { diff --git a/packages/snap/test/mainnet.spec.ts b/packages/snap/test/mainnet.spec.ts index 7ca1bf60..19b6106b 100644 --- a/packages/snap/test/mainnet.spec.ts +++ b/packages/snap/test/mainnet.spec.ts @@ -23,8 +23,7 @@ test.beforeAll(async ({ metamask, page }) => { page, }) - const dialog = await metamask.waitForDialog('confirmation') - await dialog.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() await req }) diff --git a/packages/snap/test/methods.spec.ts b/packages/snap/test/methods.spec.ts index c7d0202c..3916fe76 100644 --- a/packages/snap/test/methods.spec.ts +++ b/packages/snap/test/methods.spec.ts @@ -35,8 +35,7 @@ test.beforeAll(async ({ metamask, page }) => { page, }) - const dialog = await metamask.waitForDialog('confirmation') - await dialog.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() await req }) @@ -73,10 +72,8 @@ test.describe('filsnap testnet', () => { page, }) - let popup = await metamask.waitForDialog('confirmation') - await popup.getByTestId('confirmation-submit-button').click() - popup = await metamask.waitForDialog('confirmation') - await popup.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() + await metamask.waitForConfirmation() const { result } = await privateKey @@ -103,8 +100,7 @@ test.describe('filsnap testnet', () => { page, }) - const popup = await metamask.waitForDialog('confirmation') - await popup.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() const { result } = await signRaw expect(result).toStrictEqual( @@ -140,8 +136,7 @@ test.describe('filsnap testnet', () => { page, }) - const popup = await metamask.waitForDialog('confirmation') - await popup.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() const { result } = await sign if (result == null) { @@ -178,8 +173,7 @@ test.describe('filsnap testnet', () => { page, }) - const popup = await metamask.waitForDialog('confirmation') - await popup.getByTestId('confirmation-submit-button').click() + await metamask.waitForConfirmation() const signedMessageResponse = await invoke if (signedMessageResponse.error != null) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 632d0679..7a973466 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -174,8 +174,8 @@ importers: specifier: ^22.7.9 version: 22.7.9 metamask-testing-tools: - specifier: ^2.0.1 - version: 2.0.1(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0) + specifier: ^2.1.0 + version: 2.1.0(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0) typescript: specifier: 5.6.3 version: 5.6.3 @@ -266,8 +266,8 @@ importers: specifier: 18.2.4 version: 18.2.4 metamask-testing-tools: - specifier: ^2.0.1 - version: 2.0.1(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0) + specifier: ^2.1.0 + version: 2.1.0(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0) playwright-test: specifier: ^14.1.6 version: 14.1.6 @@ -1510,6 +1510,12 @@ packages: peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + '@metamask/providers@18.1.0': + resolution: {integrity: sha512-k/R9EJUx4cAqzWCzSDLBTg44XJlhQQgAucFPP9QCdz9Qi9hg2D8YwWJ28bnxEjl/HKc39xLL1s4VvPk0g9QR0Q==} + engines: {node: ^18.18 || >=20} + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + '@metamask/rpc-errors@6.4.0': resolution: {integrity: sha512-1ugFO1UoirU2esS3juZanS/Fo8C8XYocCuBpfZI5N7ECtoG+zu0wF+uWZASik6CkO6w9n/Iebt4iI4pT0vptpg==} engines: {node: '>=16.0.0'} @@ -4312,8 +4318,8 @@ packages: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} - metamask-testing-tools@2.0.1: - resolution: {integrity: sha512-rMhI72khrzLlYTj7uImgnhBENya+6Q9EaNxLedNe1VxyUkoVXPcLRuu5fl4TOIS/RHTLAb3ALoB6J4rnbK9PpA==} + metamask-testing-tools@2.1.0: + resolution: {integrity: sha512-EQu18DZZhgUHXzSS9b9zVxZkdP63LI2ShgFPeciTTYgYH1PTxoj5J8XTMdl1RnqlFm/+EmStot5eEL1vLGo5eA==} engines: {node: '>=20'} metro-babel-transformer@0.81.0: @@ -7585,6 +7591,23 @@ snapshots: transitivePeerDependencies: - supports-color + '@metamask/providers@18.1.0(webextension-polyfill@0.10.0)': + dependencies: + '@metamask/json-rpc-engine': 10.0.0 + '@metamask/json-rpc-middleware-stream': 8.0.4 + '@metamask/object-multiplex': 2.1.0 + '@metamask/rpc-errors': 7.0.1 + '@metamask/safe-event-emitter': 3.1.2 + '@metamask/utils': 9.3.0 + detect-browser: 5.3.0 + extension-port-stream: 4.2.0(webextension-polyfill@0.10.0) + fast-deep-equal: 3.1.3 + is-stream: 2.0.1 + readable-stream: 3.6.2 + webextension-polyfill: 0.10.0 + transitivePeerDependencies: + - supports-color + '@metamask/rpc-errors@6.4.0': dependencies: '@metamask/utils': 9.3.0 @@ -11255,13 +11278,12 @@ snapshots: merge2@1.4.1: {} - metamask-testing-tools@2.0.1(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0): + metamask-testing-tools@2.1.0(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0): dependencies: - '@metamask/providers': 17.2.1(webextension-polyfill@0.10.0) + '@metamask/providers': 18.1.0(webextension-polyfill@0.10.0) '@metamask/snaps-utils': 8.4.1(@babel/runtime@7.25.9)(@metamask/approval-controller@7.1.0)(webextension-polyfill@0.10.0) '@playwright/test': 1.48.1 conf: 13.0.1 - delay: 6.0.0 eth-rpc-errors: 4.0.3 fflate: 0.8.2 p-retry: 6.2.0