Link Search Menu Expand Document

How to use Cypress

Advices and “must-know” things regarding Cypress usage.


Table of contents


Overview

Cypress is a tool that helps performing end-to-end (E2E) tests that aim at testing the UI and the user workflows.

It is open source and free to use from the command line (doesn’t count as Tests recording).

Several utility scripts have been configured to help with E2E testing, each script takes an optional CYPRESS_STAGE environment variable, which defines the config file (in cypress/) that will be used (development by default):

  • yarn e2e:open: Runs the test suite in a local browser
    • Requires Cypress to be installed first using yarn e2e:install
    • Targets localhost development website. (uses cypress/config-development.json)
  • yarn e2e:run: Runs the test suite in a local console
    • Targets localhost development website. (uses cypress/config-development.json)

It is also possible to test all the apps at once:

  • yarn e2e:all:production: This will run each production e2e test run (in series, parallel is not free)

We used the following Cypress <> Next.js tutorial to get started.

Note that our current installation doesn’t provide test coverage. It’s a bit harder to setup, here is a tutorial if ever needed.

Resources