Skip to main content
Cypress App

Run Cypress in CircleCI

The Cypress CircleCI Orb is the official CircleCI Orb of Cypress. Although you don't need to use the orb to run your tests in CircleCI, the benefit of using the orb is that it allows you to easily install, cache and run Cypress tests in CircleCI with less effort. The orb abstracts common steps necessary for running your tests in CircleCI in order to make your life as a developer better!

Basic Setup​

The Cypress CircleCI Orb is a piece of configuration set in your .circleci/config.yml file to correctly install, cache and run Cypress with very little effort.

For the Orb Quick Start Guide and usage cases, view the CircleCI Cypress orb documentation.

A typical project can have:

.circleci/config.yml
version: 2.1
orbs:
# "cypress-io/cypress@6" installs the latest published
# version "s.x.y" of the orb. We recommend you then use
# the strict explicit version "cypress-io/[email protected]"
# to lock the version and prevent unexpected CI changes
cypress: cypress-io/cypress@6
workflows:
build:
jobs:
- cypress/run: # "run" job comes from "cypress" orb
start-command: 'npm run start'

That's it! Your repo's dependencies will be installed and cached and your Cypress tests will run in CircleCI

Parallelization​

A more complex project that needs to install dependencies, start a server, and run tests across 4 CI machines in parallel may have:

.circleci/config.yml
version: 2.1
orbs:
cypress: cypress-io/cypress@6
workflows:
build:
jobs:
- cypress/run:
start-command: 'npm run start'
cypress-command: 'npx cypress run --parallel --record --group all tests'
parallelism: 4

Using the orb brings simplicity and static checks of parameters to CircleCI configuration.

You can find additional examples at our orb examples page.

info

The Cypress Real World App (RWA) uses the Circle CI Cypress Orb, Codecov Orb, and Windows Orb to test over 300 test cases in parallel across 25 machines, multiple browsers, multiple device sizes, and multiple operating systems with full code-coverage reporting and Cypress Cloud recording.

Check out the full RWA Circle CI configuration.

Additional Examples​

Component Testing Example​

.circleci/config.yml
version: 2.1
orbs:
cypress: cypress-io/cypress@6
workflows:
test:
jobs:
- cypress/run:
cypress-command: 'npx cypress run --component'

Yarn Example​

.circleci/config.yml
version: 2.1
orbs:
cypress: cypress-io/cypress@6
workflows:
test:
jobs:
- cypress/run:
package-manager: 'yarn'
start-command: 'yarn start'

Chrome Example​

The install-browsers flag installs Chrome, Chrome for Testing, Edge, Firefox and the geckodriver. Use it together with the --browser flag in your cypress-command to run your tests in an installed browser.

.circleci/config.yml
version: 2.1
orbs:
cypress: cypress-io/cypress@6
workflows:
test:
jobs:
- cypress/run:
install-browsers: true
start-command: 'npm run start'
cypress-command: 'npx cypress run --browser chrome'