Cypress plugin to slice the specPattern list of tests into subsets
> Slices the Cypress tests resolved by the specPattern config property into multiple chunks and runs them in parallel.
``shellruns only the first third (natural sorting) of the tests
npx cypress run --env workers=3,worker=1
npx cypress run
`
Assuming you have Cypress installed, add this module as a dev dependency.
`shell`using NPM
npm i -D @studyportals/cypress-slicerusing Yarn
yarn add -D @studyportals/cypress-slicer
Note: @studyportals/cypress-slicer only works with Cypress version >= 10.
optional: load and register this module from the config file:
`js`
// 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:`js`
{
env: {
workers: process.env.WORKERS,
worker: process.env.WORKER,
}
}worker` index is 1-based, not 0-based.
> ⚠ The