Cypress Parallelization Setup
DeploySentinel can help speed up test runs by orchestrating your CI machines to run your test suite concurrently and load balanace test files across multiple machines.
Install
Install the debugger package to access the ds
CLI if you haven't already.
npm install -D @deploysentinel/cypress-debugger
Define a Project ID
If you haven't already, you'll need to define a
project ID (opens in a new tab)
inside your Cypress config file, or alternatively it can be defined via the
CYPRESS_PROJECT_ID
environment variable.
The project ID can be any 6 character string (ex. "000000"), as our API routes calls based on your API key alone and not the project ID. However, a project ID must be defined in your configuration as part of being compatible with Cypress's parallelization API.
Use ds
CLI Instead of cypress
Instead of cypress run --record --parallel
use ds run --record --parallel
(both --record
and --parallel
flags are required for parallelism to be
enabled). Additionally, you'll need to ensure that the
CYPRESS_DEPLOYSENTINEL_KEY
environment variable is set.
Local Example
CYPRESS_DEPLOYSENTINEL_KEY=YOUR_API_KEY CYPRESS_PROJECT_ID=000000 npx ds run --record --parallel --ci-build-id JUST_TESTING_LOCALLY
Github Action Step Example
- name: Run Tests in Parallel
uses: cypress-io/github-action@v4
with:
command: npx ds run --parallel --record --headless --browser chrome
env:
CYPRESS_DEPLOYSENTINEL_KEY: ${{ secrets.CYPRESS_DEPLOYSENTINEL_KEY }}
CircleCI Step Example
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/install:
build: npm run build
- cypress/run:
requires:
- cypress/install
command: npx ds run --parallel --record --headless --browser chrome
parallelism: 4