Skip to content

Commit c704062

Browse files
authored
run cypress in docker (#1390)
1 parent b290625 commit c704062

File tree

7 files changed

+469
-932
lines changed

7 files changed

+469
-932
lines changed

.github/workflows/build-and-test-grpc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
context: .
3939
file: bindings/grpc/Dockerfile
4040
push: false
41-
labels: iotaledger/identity-grpc:latest
41+
tags: iotaledger/identity-grpc:latest

.github/workflows/build-and-test.yml

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,105 @@ jobs:
204204
uses: './.github/actions/iota-sandbox/setup'
205205

206206
- name: Run Wasm examples
207-
run: npm run test:examples
207+
run: npm run test:readme && npm run test:node
208208
working-directory: bindings/wasm
209209

210210
- name: Tear down iota sandbox
211211
if: always()
212212
uses: './.github/actions/iota-sandbox/tear-down'
213+
214+
test-wasm-firefox:
215+
needs: build-wasm
216+
if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }}
217+
runs-on: ubuntu-latest
218+
strategy:
219+
fail-fast: false
220+
matrix:
221+
os: [ ubuntu-latest ]
222+
include:
223+
- os: ubuntu-latest
224+
225+
steps:
226+
- uses: actions/checkout@v3
227+
228+
- name: Set up Node.js
229+
uses: actions/setup-node@v1
230+
with:
231+
node-version: 16.x
232+
233+
- name: Install JS dependencies
234+
run: npm ci
235+
working-directory: bindings/wasm
236+
237+
- name: Download bindings/wasm artifacts
238+
uses: actions/download-artifact@v2
239+
with:
240+
name: identity-wasm-bindings-build
241+
path: bindings/wasm
242+
243+
- name: Start iota sandbox
244+
uses: './.github/actions/iota-sandbox/setup'
245+
246+
- name: Build Docker image
247+
uses: docker/[email protected]
248+
with:
249+
context: bindings/wasm/
250+
file: bindings/wasm/cypress/Dockerfile
251+
push: false
252+
tags: cypress-test:latest
253+
load: true
254+
255+
- name: Run cypress
256+
run: docker run --network host cypress-test test:browser:firefox
257+
258+
- name: Tear down iota sandbox
259+
if: always()
260+
uses: './.github/actions/iota-sandbox/tear-down'
261+
262+
test-wasm-chrome:
263+
needs: build-wasm
264+
if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }}
265+
runs-on: ubuntu-latest
266+
strategy:
267+
fail-fast: false
268+
matrix:
269+
os: [ ubuntu-latest ]
270+
include:
271+
- os: ubuntu-latest
272+
273+
steps:
274+
- uses: actions/checkout@v3
275+
276+
- name: Set up Node.js
277+
uses: actions/setup-node@v1
278+
with:
279+
node-version: 16.x
280+
281+
- name: Install JS dependencies
282+
run: npm ci
283+
working-directory: bindings/wasm
284+
285+
- name: Download bindings/wasm artifacts
286+
uses: actions/download-artifact@v2
287+
with:
288+
name: identity-wasm-bindings-build
289+
path: bindings/wasm
290+
291+
- name: Start iota sandbox
292+
uses: './.github/actions/iota-sandbox/setup'
293+
294+
- name: Build Docker image
295+
uses: docker/[email protected]
296+
with:
297+
context: bindings/wasm/
298+
file: bindings/wasm/cypress/Dockerfile
299+
push: false
300+
tags: cypress-test:latest
301+
load: true
302+
303+
- name: Run cypress
304+
run: docker run --network host cypress-test test:browser:parallel:chrome
305+
306+
- name: Tear down iota sandbox
307+
if: always()
308+
uses: './.github/actions/iota-sandbox/tear-down'

bindings/wasm/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
target

bindings/wasm/cypress.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,17 @@ export default defineConfig({
1010
},
1111
e2e: {
1212
supportFile: false,
13+
// Fix to make subtle crypto work in cypress firefox
14+
// https://github.com/cypress-io/cypress/issues/18217
15+
setupNodeEvents(on, config) {
16+
on("before:browser:launch", (browser, launchOptions) => {
17+
if (browser.family === "firefox") {
18+
launchOptions.preferences[
19+
"network.proxy.testing_localhost_is_secure_when_hijacked"
20+
] = true;
21+
}
22+
return launchOptions;
23+
});
24+
},
1325
},
1426
});

bindings/wasm/cypress/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM cypress/browsers:latest
2+
3+
COPY ./ /e2e
4+
5+
WORKDIR /e2e
6+
7+
RUN npm ci
8+
9+
RUN npm run build:examples:web
10+
11+
ENTRYPOINT [ "npm", "run" ]

0 commit comments

Comments
 (0)