Course contentsShow
← React
Lesson 2180 of 2,39648. End-to-End TestingFree lesson

Running Tests in CI: Parallelization and Video Recording

Configuring Cypress for continuous integration, parallel execution, and capturing test artifacts for debugging.

Running Tests in CI: Parallelization and Video Recording

You'll learn how to configure Cypress to run efficiently in CI pipelines with parallel execution and automatic debugging artifacts.

When your Cypress test suite grows, running tests sequentially in CI becomes painfully slow. Parallelization splits your tests across multiple machines, dramatically reducing feedback time. Video recording captures test runs for post-mortem debugging when tests fail in CI but pass locally.

The Core Problem

CI environments are headless and ephemeral. You can't watch tests run or inspect the browser. Without videos, debugging CI-only failures means guessing or trying to reproduce locally—often unsuccessfully.

Configuring for CI

In your cypress.config.js, enable video recording and set CI-specific options:

export default defineConfig({
  e2e: {
    video: true, // Records video of test runs
    screenshotOnRunFailure: true, // Captures failure screenshots
    videoCompression: 32, // Balances quality and file size
    videosFolder: 'cypress/videos',
    screenshotsFolder: 'cypress/screenshots'
  }
})

Parallelization

With Cypress Cloud (or similar services), split tests across multiple CI workers:

# GitHub Actions example
strategy:
  matrix:
    containers: [1, 2, 3, 4] # Four parallel workers
steps:
  - run: npx cypress run --record --parallel --group "UI Tests"

Each worker receives a balanced subset of tests. The service coordinates to avoid duplication.

Artifacts as Evidence

Videos and screenshots become your debugging evidence. Most CI systems let you upload them as artifacts:

- uses: actions/upload-artifact@v3
  if: failure()
  with:
    name: cypress-artifacts
    path: cypress/videos

Think of videos as black box flight recorders—when something crashes in production (CI), you have the recording to understand what happened before the failure.

Key Takeaway: CI-optimized Cypress uses parallelization to speed up test runs and captures videos/screenshots to debug failures that only happen in headless environments—turning blind CI runs into observable, debuggable executions.