diff --git a/.github/workflows/e2e-browser-tests.yml b/.github/workflows/e2e-browser-tests.yml new file mode 100644 index 00000000..270d6fd2 --- /dev/null +++ b/.github/workflows/e2e-browser-tests.yml @@ -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 diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 0068c994..a264d37f 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,4 +1,4 @@ -name: End to End +name: E2E Node Tests on: pull_request: @@ -19,7 +19,7 @@ jobs: spec: - '0.16.1' node: - - 18 + - 20 steps: - uses: actions/checkout@v4 @@ -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() }} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1a95dc57..818bebd0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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 diff --git a/e2e/browser/cypress/e2e/ecdsa.cy.js b/e2e/browser/cypress/e2e/ecdsa.cy.js index 839749af..3005ca28 100644 --- a/e2e/browser/cypress/e2e/ecdsa.cy.js +++ b/e2e/browser/cypress/e2e/ecdsa.cy.js @@ -12,7 +12,7 @@ const setup = async () => { verifyQuerySignatures: false, identity: identity1, fetch: fetchPolyfill, - host: 'http://127.0.0.1:4943/', + host: 'http://localhost:4943/', }, }); @@ -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/', }, });