Skip to content

Commit d59d62f

Browse files
jjzhang332yingxuan
andauthored
chore: Add parallel testing functionality (#639)
Signed-off-by: yingxuan <zhanglujia.zlj@digital-engine.com> Co-authored-by: yingxuan <zhanglujia.zlj@digital-engine.com>
1 parent bbb8c2e commit d59d62f

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.github/workflows/e2e.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on: push
55
jobs:
66
cypress-run:
77
runs-on: ubuntu-22.04
8+
strategy:
9+
matrix:
10+
containers: [0, 1, 2]
811
steps:
912
- name: Checkout
1013
uses: actions/checkout@v6
@@ -24,7 +27,16 @@ jobs:
2427
start: yarn start
2528
wait-on: 'http://localhost:3000'
2629
wait-on-timeout: 120
27-
30+
command: npm run cy:run:parallel
31+
env:
32+
CI: true
33+
DEBUG: 'cypress-split,find-cypress-specs'
34+
SPLIT: 3
35+
SPLIT_INDEX: ${{ matrix.containers }}
36+
GITHUB_RUN_ID: ${{ github.run_id }}
37+
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
38+
GITHUB_JOB: ${{ github.job }}
39+
2840
- name: Upload coverage reports to Codecov
2941
uses: codecov/codecov-action@v5
3042
env:

cypress.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { defineConfig } from 'cypress';
2+
import cypressSplit from 'cypress-split';
23

34
export default defineConfig({
45
// setupNodeEvents can be defined in either
56
// the e2e or component configuration
67
e2e: {
78
setupNodeEvents(on, config) {
89
require('@cypress/code-coverage/task')(on, config);
10+
cypressSplit(on, config);
911
// include any other plugin code...
1012

1113
// It's IMPORTANT to return the config object

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"lint": "react-scripts lint",
1919
"cy:open": "npx cypress open",
2020
"cy:run": "npx cypress run --headed",
21+
"cy:run:parallel": "npx cypress run --headed",
2122
"coverage:verify": "npx nyc report --check-coverage true --lines 10"
2223
},
2324
"dependencies": {
@@ -69,14 +70,17 @@
6970
"@cypress/code-coverage": "^3.14.0",
7071
"@cypress/instrument-cra": "^1.4.0",
7172
"@web3-storage/parse-link-header": "^3.1.0",
73+
"babel-plugin-istanbul": "^7.0.1",
7274
"chart.js": "^4.4.0",
7375
"cypress": "^14.3.0",
76+
"cypress-split": "^1.24.25",
7477
"eslint": "^9.0.0",
7578
"eslint-config-prettier": "^10.0.1",
7679
"eslint-config-react-app": "^7.0.1",
7780
"eslint-plugin-cypress": "^5.1.0",
7881
"husky": "^9.0.7",
7982
"lint-staged": "^15.0.1",
83+
"nyc": "^17.1.0",
8084
"react-app-rewired": "^2.2.1",
8185
"react-chartjs-2": "^5.2.0",
8286
"react-use": "^17.4.0",

0 commit comments

Comments
 (0)