Skip to content
Latchkey

Running Cypress Tests in GitHub Actions

Run Cypress e2e tests in CI with your app started and results recorded.

The official cypress-io/github-action handles installation, caching, starting your app, and running tests. It can wait for the server to be ready and record results to Cypress Cloud for parallelization. This guide covers the standard wire-up.

What you need

  • Cypress installed with a cypress.config.
  • A command to start your app (npm start) and a URL to wait on.
  • Optionally a CYPRESS_RECORD_KEY for Cypress Cloud.

The workflow

Start the app, wait for it, and run tests in one action.

.github/workflows/e2e.yml
- uses: cypress-io/github-action@v6
  with:
    start: npm start
    wait-on: "http://localhost:3000"
    record: true
  env:
    CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Common gotchas

  • Without wait-on, tests start before the server is up and fail with connection refused.
  • Parallelization requires record: true plus a Cypress Cloud key.
  • The action caches the Cypress binary; a cache miss re-downloads it each run.

Key takeaways

  • cypress-io/github-action installs, starts the app, and runs tests.
  • Use wait-on so tests do not race the server startup.
  • record: true with a key enables Cloud parallelization.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →