From fcca155f3c88492ec835cd3bf04956363698285d Mon Sep 17 00:00:00 2001 From: Jimmy Hardwick Date: Wed, 23 Oct 2024 09:03:34 +1100 Subject: [PATCH] fix: Checkout widgets e2e tests (#2341) --- .../sdk-load-widgets-with-nextjs/package.json | 4 +- .../tests/utils/intercept-widgets.ts | 5 -- .../tests/version.spec.ts | 5 +- yarn.lock | 81 ++++++++++++++++++- 4 files changed, 84 insertions(+), 11 deletions(-) diff --git a/examples/checkout/sdk-load-widgets-with-nextjs/package.json b/examples/checkout/sdk-load-widgets-with-nextjs/package.json index b5ee4ecd61..e8372f222f 100644 --- a/examples/checkout/sdk-load-widgets-with-nextjs/package.json +++ b/examples/checkout/sdk-load-widgets-with-nextjs/package.json @@ -9,12 +9,12 @@ "lint": "next lint", "test": "playwright test", "test:ui": "playwright test --ui", - "test:remotewidgets": "USE_LOCAL_BUNDLE=false playwright test" + "test:remotewidgets": "USE_REMOTE_WIDGETS=true playwright test" }, "dependencies": { "@biom3/react": "^0.25.21", "@ethersproject/providers": "^5.7.2", - "@imtbl/sdk": "latest", + "@imtbl/sdk": "1.58.0", "next": "14.2.7", "react": "^18", "react-dom": "^18" diff --git a/examples/checkout/sdk-load-widgets-with-nextjs/tests/utils/intercept-widgets.ts b/examples/checkout/sdk-load-widgets-with-nextjs/tests/utils/intercept-widgets.ts index 9f5b317368..3de1f74dfd 100644 --- a/examples/checkout/sdk-load-widgets-with-nextjs/tests/utils/intercept-widgets.ts +++ b/examples/checkout/sdk-load-widgets-with-nextjs/tests/utils/intercept-widgets.ts @@ -12,11 +12,6 @@ export const interceptWidgets = async (page: Page, widgetsVersion: string | 'lat const fileName = path.basename(url.pathname); let filePath = path.join(__dirname, 'local-widgets-js', fileName); - // Special case for widgets-esm.js - if (fileName === 'widgets-esm.js') { - filePath = path.join(__dirname, 'local-widgets-js', 'index.js'); - } - try { if (fs.existsSync(filePath)) { const fileContent = fs.readFileSync(filePath, 'utf8'); diff --git a/examples/checkout/sdk-load-widgets-with-nextjs/tests/version.spec.ts b/examples/checkout/sdk-load-widgets-with-nextjs/tests/version.spec.ts index 7043eac6e0..9adf19c7ea 100644 --- a/examples/checkout/sdk-load-widgets-with-nextjs/tests/version.spec.ts +++ b/examples/checkout/sdk-load-widgets-with-nextjs/tests/version.spec.ts @@ -1,11 +1,10 @@ import { test, expect } from "@playwright/test"; import { interceptWidgets } from "./utils/intercept-widgets"; -const useLocalBundle = process.env.USE_LOCAL_BUNDLE === 'true'; - +const USE_REMOTE_WIDGETS = process.env.USE_REMOTE_WIDGETS === 'true'; test.beforeEach(async ({ page }) => { - if (useLocalBundle) { + if (!USE_REMOTE_WIDGETS) { await interceptWidgets(page); } diff --git a/yarn.lock b/yarn.lock index 872160c226..93e6c5a932 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4193,7 +4193,7 @@ __metadata: dependencies: "@biom3/react": ^0.25.21 "@ethersproject/providers": ^5.7.2 - "@imtbl/sdk": latest + "@imtbl/sdk": 1.58.0 "@playwright/test": ^1.45.3 "@types/node": ^20 "@types/react": ^18.3.4 @@ -5039,6 +5039,85 @@ __metadata: languageName: unknown linkType: soft +"@imtbl/sdk@npm:1.58.0": + version: 1.58.0 + resolution: "@imtbl/sdk@npm:1.58.0" + dependencies: + "@0xsequence/abi": ^1.4.3 + "@0xsequence/core": ^1.4.3 + "@0xsquid/sdk": ^2.8.25 + "@biom3/design-tokens": ^0.4.4 + "@biom3/react": ^0.27.12 + "@ethersproject/abi": ^5.7.0 + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/contracts": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/providers": ^5.7.2 + "@ethersproject/solidity": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + "@ethersproject/units": ^5.7.0 + "@ethersproject/wallet": ^5.7.0 + "@imtbl/react-analytics": 0.2.1-alpha + "@jest/globals": ^29.5.0 + "@magic-ext/oidc": 4.3.1 + "@magic-sdk/provider": ^21.2.0 + "@metamask/detect-provider": ^2.0.0 + "@opensea/seaport-js": 4.0.3 + "@rive-app/react-canvas-lite": ^4.9.0 + "@stdlib/number-float64-base-normalize": 0.0.8 + "@uniswap/router-sdk": ^1.4.0 + "@uniswap/sdk-core": ^3.0.1 + "@uniswap/v3-sdk": ^3.9.0 + "@walletconnect/ethereum-provider": ^2.11.1 + "@walletconnect/modal": ^2.6.2 + assert: ^2.0.0 + axios: ^1.6.5 + bn.js: ^5.2.1 + buffer: ^6.0.3 + crypto-browserify: ^3.12.0 + elliptic: ^6.5.7 + enc-utils: ^3.0.0 + ethereumjs-wallet: ^1.0.2 + ethers: ^5.7.2 + ethers-v6: "npm:ethers@6.11.1" + events: ^3.3.0 + form-data: ^4.0.0 + framer-motion: ^11.0.6 + global-const: ^0.1.2 + hash.js: ^1.1.7 + https-browserify: ^1.0.0 + i18next: ^23.7.6 + i18next-browser-languagedetector: ^7.2.0 + jwt-decode: ^3.1.2 + localforage: ^1.10.0 + lru-memorise: 0.3.0 + magic-sdk: ^21.2.0 + merkletreejs: ^0.3.11 + oidc-client-ts: 2.4.0 + os-browserify: ^0.3.0 + pako: ^2.1.0 + pg: ^8.11.5 + pino-pretty: ^11.2.2 + prisma: ^5.13.0 + react-i18next: ^13.5.0 + sns-validator: ^0.3.5 + stream-browserify: ^3.0.0 + stream-http: ^3.2.0 + url: ^0.11.0 + uuid: ^8.3.2 + dependenciesMeta: + pg: + optional: true + prisma: + optional: true + checksum: 6f0d031f0db561ce51be24c66b4cd92e1abc3d568bfb279fdfd06ff5848ce2a6bbd4690226bae3ac0a876ed0dc42d1a8c0d3eae108ef6c24995b78a9ee74a490 + languageName: node + linkType: hard + "@imtbl/sdk@npm:latest": version: 1.56.0 resolution: "@imtbl/sdk@npm:1.56.0"