diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 21338101f..deebec5f9 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -42,6 +42,10 @@ jobs: run: | dfx start --background + - name: setup + id: setup + run: npm run setup --workspaces --if-present + - run: npm run e2e --workspaces --if-present env: CI: true diff --git a/e2e/browser/cypress/e2e/ecdsa.cy.js b/e2e/browser/cypress/e2e/ecdsa.cy.js index 523a398a7..4fe1fb1e4 100644 --- a/e2e/browser/cypress/e2e/ecdsa.cy.js +++ b/e2e/browser/cypress/e2e/ecdsa.cy.js @@ -2,13 +2,18 @@ import { ECDSAKeyIdentity } from '@dfinity/identity'; import { get, set } from 'idb-keyval'; import { createActor } from '../utils/actor'; import ids from '../../.dfx/local/canister_ids.json'; -import fetch from 'isomorphic-fetch'; +import fetchPolyfill from 'isomorphic-fetch'; const canisterId = ids.whoami.local; const setup = async () => { const identity1 = await ECDSAKeyIdentity.generate(); const whoami1 = createActor(ids.whoami.local, { - agentOptions: { verifyQuerySignatures: false, identity: identity1 }, + agentOptions: { + verifyQuerySignatures: false, + identity: identity1, + fetch: fetchPolyfill, + host: 'http://127.0.0.1:4943/', + }, }); const principal1 = await whoami1.whoami(); @@ -38,7 +43,12 @@ describe('ECDSAKeyIdentity tests with SubtleCrypto', () => { const identity2 = await ECDSAKeyIdentity.fromKeyPair(storedKeyPair); const whoami2 = createActor(canisterId, { - agentOptions: { verifyQuerySignatures: false, identity: identity2, fetch }, + agentOptions: { + verifyQuerySignatures: false, + identity: identity2, + fetchPolyfill, + host: 'http://127.0.0.1:4943/', + }, }); const principal2 = await whoami2.whoami(); diff --git a/e2e/browser/package.json b/e2e/browser/package.json index a37c8342e..4c3368403 100644 --- a/e2e/browser/package.json +++ b/e2e/browser/package.json @@ -6,8 +6,8 @@ "ci": "npm run e2e", "setup": "dfx deploy; dfx generate; pm2 --name parcel start npm -- start", "cypress": "cypress run", - "e2e": "npm run setup; npm run cypress", - "poste2e": "pm2 delete 0", + "e2e": "npm run cypress", + "poste2e": "pm2 kill", "eslint:fix": "npm run lint -- --fix", "eslint": "eslint --ext '.js,.jsx,.ts,.tsx' cypress *.js", "lint": "npm run eslint", diff --git a/package-lock.json b/package-lock.json index f9c96e99f..2b4946c8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,6 +96,7 @@ "concurrently": "^7.3.0", "cypress": "^13.2.0", "esbuild": "^0.15.16", + "isomorphic-fetch": "^3.0.0", "parcel": "^2.6.2", "pm2": "^5.3.0", "size-limit": "^8.1.0" @@ -11696,8 +11697,9 @@ }, "node_modules/isomorphic-fetch": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", "dev": true, - "license": "MIT", "dependencies": { "node-fetch": "^2.6.1", "whatwg-fetch": "^3.4.1"