Skip to content
Latchkey

How to Run Cypress End-to-End Tests with GitHub Actions

The official cypress-io/github-action installs Cypress, caches the binary, starts your app, waits for it, and runs the specs.

Use cypress-io/github-action, passing start to launch your dev server and wait-on to block until it answers. Upload screenshots on failure so flaky UI tests are debuggable.

Steps

  • Use cypress-io/github-action, which installs and caches the binary.
  • Set start to your app command and wait-on to the URL it serves.
  • Upload cypress/screenshots/ with if: failure().

Workflow

.github/workflows/ci.yml
jobs:
  e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - uses: cypress-io/github-action@v6
        with:
          start: npm start
          wait-on: 'http://localhost:3000'
      - uses: actions/upload-artifact@v4
        if: failure()
        with:
          name: cypress-screenshots
          path: cypress/screenshots/

Gotchas

  • Without wait-on, Cypress may hit the server before it is listening and fail with a connection refused error.
  • The action installs dependencies for you, so a separate npm ci step is usually redundant.

Related guides

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