Skip to content

Commit

Permalink
run cypress in docker (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed Jul 12, 2024
1 parent b290625 commit c704062
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 932 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-grpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
context: .
file: bindings/grpc/Dockerfile
push: false
labels: iotaledger/identity-grpc:latest
tags: iotaledger/identity-grpc:latest
98 changes: 97 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,105 @@ jobs:
uses: './.github/actions/iota-sandbox/setup'

- name: Run Wasm examples
run: npm run test:examples
run: npm run test:readme && npm run test:node
working-directory: bindings/wasm

- name: Tear down iota sandbox
if: always()
uses: './.github/actions/iota-sandbox/tear-down'

test-wasm-firefox:
needs: build-wasm
if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
include:
- os: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Install JS dependencies
run: npm ci
working-directory: bindings/wasm

- name: Download bindings/wasm artifacts
uses: actions/download-artifact@v2
with:
name: identity-wasm-bindings-build
path: bindings/wasm

- name: Start iota sandbox
uses: './.github/actions/iota-sandbox/setup'

- name: Build Docker image
uses: docker/build-push-action@v6.2.0
with:
context: bindings/wasm/
file: bindings/wasm/cypress/Dockerfile
push: false
tags: cypress-test:latest
load: true

- name: Run cypress
run: docker run --network host cypress-test test:browser:firefox

- name: Tear down iota sandbox
if: always()
uses: './.github/actions/iota-sandbox/tear-down'

test-wasm-chrome:
needs: build-wasm
if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
include:
- os: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Install JS dependencies
run: npm ci
working-directory: bindings/wasm

- name: Download bindings/wasm artifacts
uses: actions/download-artifact@v2
with:
name: identity-wasm-bindings-build
path: bindings/wasm

- name: Start iota sandbox
uses: './.github/actions/iota-sandbox/setup'

- name: Build Docker image
uses: docker/build-push-action@v6.2.0
with:
context: bindings/wasm/
file: bindings/wasm/cypress/Dockerfile
push: false
tags: cypress-test:latest
load: true

- name: Run cypress
run: docker run --network host cypress-test test:browser:parallel:chrome

- name: Tear down iota sandbox
if: always()
uses: './.github/actions/iota-sandbox/tear-down'
2 changes: 2 additions & 0 deletions bindings/wasm/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
target
12 changes: 12 additions & 0 deletions bindings/wasm/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,17 @@ export default defineConfig({
},
e2e: {
supportFile: false,
// Fix to make subtle crypto work in cypress firefox
// https://github.com/cypress-io/cypress/issues/18217
setupNodeEvents(on, config) {
on("before:browser:launch", (browser, launchOptions) => {
if (browser.family === "firefox") {
launchOptions.preferences[
"network.proxy.testing_localhost_is_secure_when_hijacked"
] = true;
}
return launchOptions;
});
},
},
});
11 changes: 11 additions & 0 deletions bindings/wasm/cypress/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM cypress/browsers:latest

COPY ./ /e2e

WORKDIR /e2e

RUN npm ci

RUN npm run build:examples:web

ENTRYPOINT [ "npm", "run" ]
Loading

0 comments on commit c704062

Please sign in to comment.