Skip to content

Commit

Permalink
updating browser tests to use direct host
Browse files Browse the repository at this point in the history
  • Loading branch information
krpeacock committed Oct 24, 2023
1 parent a0f2ebd commit 2e81ce2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions e2e/browser/cypress/e2e/ecdsa.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions e2e/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e81ce2

Please sign in to comment.