Skip to content

Commit

Permalink
ci: fix cypress (#898)
Browse files Browse the repository at this point in the history
* separating node and browser tests

* changelog
  • Loading branch information
krpeacock authored Jun 24, 2024
1 parent 01fab14 commit a5cc246
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 18 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/e2e-browser-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: E2E Browser Tests

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
ghc: ['8.8.4']
spec:
- '0.16.1'
node:
- 20

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- run: npm ci
- run: npm run build -ws

# build monorepo incl. each subpackage
- run: npm run build --workspaces --if-present

- uses: dfinity/setup-dfx@main

- name: running dfx
id: dfx
run: |
dfx start --background
- name: Cypress e2e tests
uses: cypress-io/github-action@v6
with:
install: false
project: ./e2e/browser
wait-on: 'http://localhost:1234'
wait-on-timeout: 240
build: npm run setup --workspace e2e/browser
start: npm run start --workspace e2e/browser

aggregate:
name: e2e:required
if: ${{ always() }}
needs: [test]
runs-on: ubuntu-latest
steps:
- name: check e2e test result
if: ${{ needs.test.result != 'success' }}
run: exit 1
18 changes: 2 additions & 16 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: End to End
name: E2E Node Tests

on:
pull_request:
Expand All @@ -19,7 +19,7 @@ jobs:
spec:
- '0.16.1'
node:
- 18
- 20

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -58,26 +58,12 @@ jobs:
run: |
dfx start --background
- name: setup
id: setup
run: npm run setup --workspaces --if-present

- name: Node.js e2e tests
run: npm run e2e --workspace e2e/node
env:
CI: true
REPLICA_PORT: 4943

- name: Cypress e2e tests
uses: cypress-io/github-action@v6
with:
install: false
project: ./e2e/browser
start: |
npm run e2e --workspace e2e/node
wait-on: 'http://localhost:1234'
wait-on-timeout: 120

aggregate:
name: e2e:required
if: ${{ always() }}
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changed

- ci: breaking out browser and noded e2e tests into separate workflows
- ci: using cypress github action for e2e tests

## [1.4.0] - 2024-06-17
Expand Down
4 changes: 2 additions & 2 deletions e2e/browser/cypress/e2e/ecdsa.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const setup = async () => {
verifyQuerySignatures: false,
identity: identity1,
fetch: fetchPolyfill,
host: 'http://127.0.0.1:4943/',
host: 'http://localhost:4943/',
},
});

Expand Down Expand Up @@ -47,7 +47,7 @@ describe('ECDSAKeyIdentity tests with SubtleCrypto', () => {
verifyQuerySignatures: false,
identity: identity2,
fetchPolyfill,
host: 'http://127.0.0.1:4943/',
host: 'http://localhost:4943/',
},
});

Expand Down

0 comments on commit a5cc246

Please sign in to comment.