mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
chore: Split cypress tests locally
This commit is contained in:
parent
6e0fe03552
commit
8fc36d2684
15
.github/workflows/e2e.yml
vendored
15
.github/workflows/e2e.yml
vendored
@ -28,7 +28,6 @@ env:
|
|||||||
) ||
|
) ||
|
||||||
github.event.before
|
github.event.before
|
||||||
}}
|
}}
|
||||||
shouldRunParallel: ${{ secrets.CYPRESS_RECORD_KEY != '' && !(github.event_name == 'push' && github.ref == 'refs/heads/develop') }}
|
|
||||||
jobs:
|
jobs:
|
||||||
cache:
|
cache:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -119,9 +118,6 @@ jobs:
|
|||||||
- name: Cypress run
|
- name: Cypress run
|
||||||
uses: cypress-io/github-action@df7484c5ba85def7eef30db301afa688187bc378 # v6.7.2
|
uses: cypress-io/github-action@df7484c5ba85def7eef30db301afa688187bc378 # v6.7.2
|
||||||
id: cypress
|
id: cypress
|
||||||
# If CYPRESS_RECORD_KEY is set, run in parallel on all containers
|
|
||||||
# Otherwise (e.g. if running from fork), we run on a single container only
|
|
||||||
if: ${{ env.shouldRunParallel == 'true' || ( matrix.containers == 1 ) }}
|
|
||||||
with:
|
with:
|
||||||
install: false
|
install: false
|
||||||
start: pnpm run dev:coverage
|
start: pnpm run dev:coverage
|
||||||
@ -129,16 +125,17 @@ jobs:
|
|||||||
browser: chrome
|
browser: chrome
|
||||||
# Disable recording if we don't have an API key
|
# Disable recording if we don't have an API key
|
||||||
# e.g. if this action was run from a fork
|
# e.g. if this action was run from a fork
|
||||||
record: ${{ env.shouldRunParallel == 'true' }}
|
record: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
|
||||||
parallel: ${{ env.shouldRunParallel == 'true' }}
|
|
||||||
env:
|
env:
|
||||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
VITEST_COVERAGE: true
|
VITEST_COVERAGE: true
|
||||||
CYPRESS_COMMIT: ${{ github.sha }}
|
CYPRESS_COMMIT: ${{ github.sha }}
|
||||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
||||||
ARGOS_PARALLEL: ${{ env.shouldRunParallel == 'true' }}
|
ARGOS_PARALLEL: true
|
||||||
ARGOS_PARALLEL_TOTAL: 4
|
ARGOS_PARALLEL_TOTAL: ${{ strategy.job-total }}
|
||||||
ARGOS_PARALLEL_INDEX: ${{ matrix.containers }}
|
ARGOS_PARALLEL_INDEX: ${{ strategy.job-index }}
|
||||||
|
SPLIT: ${{ strategy.job-total }}
|
||||||
|
SPLIT_INDEX: ${{ strategy.job-index }}
|
||||||
|
|
||||||
- name: Upload Coverage to Codecov
|
- name: Upload Coverage to Codecov
|
||||||
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { defineConfig } from 'cypress';
|
|
||||||
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
|
|
||||||
import coverage from '@cypress/code-coverage/task';
|
|
||||||
import eyesPlugin from '@applitools/eyes-cypress';
|
import eyesPlugin from '@applitools/eyes-cypress';
|
||||||
import { registerArgosTask } from '@argos-ci/cypress/task';
|
import { registerArgosTask } from '@argos-ci/cypress/task';
|
||||||
|
import coverage from '@cypress/code-coverage/task';
|
||||||
|
import { defineConfig } from 'cypress';
|
||||||
|
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
|
||||||
|
import cypressSplit from 'cypress-split';
|
||||||
|
|
||||||
export default eyesPlugin(
|
export default eyesPlugin(
|
||||||
defineConfig({
|
defineConfig({
|
||||||
@ -13,6 +14,7 @@ export default eyesPlugin(
|
|||||||
specPattern: 'cypress/integration/**/*.{js,ts}',
|
specPattern: 'cypress/integration/**/*.{js,ts}',
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
coverage(on, config);
|
coverage(on, config);
|
||||||
|
cypressSplit(on, config);
|
||||||
on('before:browser:launch', (browser, launchOptions) => {
|
on('before:browser:launch', (browser, launchOptions) => {
|
||||||
if (browser.name === 'chrome' && browser.isHeadless) {
|
if (browser.name === 'chrome' && browser.isHeadless) {
|
||||||
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1');
|
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1');
|
||||||
|
@ -91,6 +91,7 @@
|
|||||||
"cspell": "^8.6.0",
|
"cspell": "^8.6.0",
|
||||||
"cypress": "^13.14.1",
|
"cypress": "^13.14.1",
|
||||||
"cypress-image-snapshot": "^4.0.1",
|
"cypress-image-snapshot": "^4.0.1",
|
||||||
|
"cypress-split": "^1.24.0",
|
||||||
"esbuild": "^0.21.5",
|
"esbuild": "^0.21.5",
|
||||||
"eslint": "^9.4.0",
|
"eslint": "^9.4.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
861
pnpm-lock.yaml
generated
861
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user