Skip to content

Commit 696f3c6

Browse files
committed
Add V3 of run-cypress-tests action
* Actual run logic contained in a shell script to simplify the action and make future changes easier. * Dropped parallelization bits from the unreleased V2. Parallelization requires completely separated databases and needs to happen at a higher level. * Starts a custom Xvfb server with 4K resolution for high res screenshots.
1 parent 88e63c1 commit 696f3c6

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

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

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,25 @@ 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"
1813
video:
19-
description:
14+
description:
2015
Turn video on or off. Supported values are 'true' and 'false'.
2116
required: false
2217
default: 'false'
2318

2419
runs:
2520
using: "composite"
2621
steps:
27-
- name: Run the tests
28-
if: inputs.video == 'false'
29-
run: |
30-
docker exec cypress \
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'"
22+
- name: Find test script
23+
run: pwd && find / -name run-cypress.sh
3324
shell: bash
3425

35-
- name: Run the tests and record video
36-
if: inputs.video == 'true'
37-
run: |
38-
docker exec cypress \
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'"
26+
- name: Run the tests
27+
run: docker exec cypress bash < github-actions/run-cypress-tests/run-cypress.sh
4128
shell: bash
29+
env:
30+
TEST_TAGS: ${{ inputs.test-tags }}
31+
TEST_VIDEO: ${{ inputs.video }}
4232

4333
- name: Retrieve test reports from container
4434
# should be run even if the tests fail
@@ -53,8 +43,7 @@ runs:
5343
uses: actions/upload-artifact@v4
5444
with:
5545
name: cypress-docker-reports
56-
path: |
57-
${{ github.workspace }}/test-reports
46+
path: ${{ github.workspace }}/test-reports
5847

5948
- name: Fail the job
6049
# should fail the job if the tests fail
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
runArgs=(yarn ws:e2e)
4+
5+
if [[ $TEST_VIDEO = "true" ]]; then
6+
runArgs+=(cy:run)
7+
else
8+
runArgs+=(cy:run:video)
9+
fi
10+
11+
if [[ -n $TEST_TAGS ]]; then
12+
runArgs+=(--env grepTags=\'"${TEST_TAGS}"\')
13+
fi
14+
15+
Xvfb -screen 0 3840x2160x24 :99
16+
export DISPLAY=:99
17+
18+
yarn ws:e2e "${runArgs[@]}"
19+
20+
pkill Xvfb

0 commit comments

Comments
 (0)