@studyportals/cypress-slicer
v0.1.2
Published
Cypress plugin to slice the specPattern list of tests into subsets
Downloads
5,075
Maintainers
Readme
@studyportals/cypress-slicer
Slices the Cypress tests resolved by the
specPatternconfig property into multiple chunks and runs them in parallel.
# runs only the first third (natural sorting) of the tests
npx cypress run --env workers=3,worker=1
# runs only the the last third (natural sorting) of the tests
npx cypress run --env workers=3,worker=3
# runs only all the tests
npx cypress run --env workers=1,worker=1
npx cypress runInstall
Assuming you have Cypress installed, add this module as a dev dependency.
# using NPM
npm i -D @studyportals/cypress-slicer
# using Yarn
yarn add -D @studyportals/cypress-slicerNote: @studyportals/cypress-slicer only works with Cypress version >= 10.
Config file
optional: load and register this module from the config file:
// cypress.config.js
{
e2e: {
setupNodeEvents(on, config) {
require('@studyportals/cypress-slicer/plugin')(config);
return config;
},
}
}Usage Overview
The number of chunks is determined by the workers environment variable. The worker environment variable determines which chunk to run.
You can configure the number of workers and the worker index through the env property of the configuration defined in the cypress.config.js file:
{
env: {
workers: process.env.WORKERS,
worker: process.env.WORKER,
}
}⚠ The
workerindex is 1-based, not 0-based.
