Skip to content

Commit 98ddd76

Browse files
Samuli RasiSamuli Rasi
authored andcommitted
E2E parallelization in run-cypress-tests action
Use cypress-parallel command in the CI to run e2e tests in three threads
1 parent 7e5b2d8 commit 98ddd76

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/test-run-cypress-tests-action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
run_cypress_tests:
1010
name: Run cypress e2e tests from docker
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest-4-cores
1212

1313
steps:
1414
- name: Checkout code
@@ -22,3 +22,7 @@ jobs:
2222

2323
- name: Run e2e tests from github action
2424
uses: ./github-actions/run-cypress-tests
25+
with:
26+
threads: '3'
27+
video: 'false'
28+
test-tags: ''

github-actions/run-cypress-tests/action.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ inputs:
1010
it to ''.
1111
required: false
1212
default: "@smoke"
13+
threads:
14+
description:
15+
Amount of parallel executors. Supported values are 1-3.
16+
required: false
17+
default: "1"
1318
video:
1419
description:
1520
Turn video on or off. Supported values are 'true' and 'false'.
@@ -19,25 +24,27 @@ inputs:
1924
runs:
2025
using: "composite"
2126
steps:
22-
- name: Run tests using the e2e docker bundle's cypress container
27+
- name: Run the tests
2328
if: inputs.video == 'false'
2429
run: |
2530
docker exec cypress \
26-
bash -c "yarn test:e2e --env grepTags='${{ inputs.test-tags }}'"
31+
bash -c "yarn ws:db build && yarn ws:e2e cypress-parallel --script cy:run --threads ${{ inputs.threads }} \
32+
--verbose --reporterModulePath '../node_modules/cypress-multi-reporters' --specsDir 'e2e/*.cy.ts' --weightsJson './parallel-weights.json'"
2733
shell: bash
2834

29-
- name: Run tests and enable video
35+
- name: Run the tests and record video
3036
if: inputs.video == 'true'
3137
run: |
3238
docker exec cypress \
33-
bash -c "yarn test:e2e --config-file cypress.config.video.ts --env grepTags='${{ inputs.test-tags }}'"
39+
bash -c "yarn ws:db build && yarn ws:e2e cypress-parallel --script cy:run:video --threads ${{ inputs.threads }} \
40+
--verbose --reporterModulePath '../node_modules/cypress-multi-reporters' --specsDir 'e2e/*.cy.ts' --weightsJson './parallel-weights.json'"
3441
shell: bash
3542

3643
- name: Retrieve test reports from container
3744
# should be run even if the tests fail
3845
if: always()
3946
run: |
40-
docker cp cypress:/e2e/cypress/reports ${{ github.workspace }}/cypress/ || echo "No reports"
47+
docker cp cypress:/e2e/cypress/reports ${{ github.workspace }}/test-reports || echo "No reports"
4148
shell: bash
4249

4350
- name: Upload test reports as an artifact
@@ -47,7 +54,7 @@ runs:
4754
with:
4855
name: cypress-docker-reports
4956
path: |
50-
${{ github.workspace }}/cypress/reports
57+
${{ github.workspace }}/test-reports
5158
5259
- name: Fail the job
5360
# should fail the job if the tests fail

0 commit comments

Comments
 (0)