Skip to content

Cypress Videos

Cypress can record a video of an entire headless test run, giving you a full replay of what happened, not just a single failure snapshot. This lesson covers configuring and using video recordings effectively.

How Video Recording Works

During a headless cypress run, Cypress records the whole spec file's execution as a video, saved to cypress/videos by default. This complements automatic failure screenshots by showing the sequence of events leading up to a failure, not just the final moment.

// cypress.config.js
export default defineConfig({
  video: true, // default
  videosFolder: 'cypress/videos',
  videoCompression: 32,
});

Video recording only applies to headless runs; the interactive Test Runner does not record video since you're already watching it live.

Video Configuration Options

video: true | false
videosFolder: 'cypress/videos'
videoCompression: 32   // 0 (none) to 51 (max), lower is higher quality
  • video: false disables recording entirely, which can slightly speed up CI runs but removes a valuable debugging aid.
  • videoCompression trades file size against quality; lower values mean better quality but larger files.
  • Videos are recorded per spec file, one video per spec, not one giant video per full run.
  • Many teams configure CI to only keep videos for failed specs, saving storage space.

Video Recording Cheat Sheet

Common video configuration decisions and their trade-offs.

Setting Trade-off
video: true Full run history available; uses more CI storage/time
video: false Faster CI, no visual replay available for any failure
Low videoCompression Higher quality, larger file size
High videoCompression Smaller file size, lower quality
Keep only failed-spec videos Balances storage cost against debugging value

When Disabling Video Recording Makes Sense

For very large suites where CI time and storage costs are a real constraint, and screenshots plus detailed logging already provide enough failure context, disabling video (or only enabling it selectively) can meaningfully reduce CI resource usage.

  • Consider disabling video for suites with hundreds of fast, well-understood specs.
  • Keep video enabled for suites still stabilizing, where full replay context is more valuable.
  • Reassess this trade-off periodically as suite size and CI costs change.

Combining Videos with Screenshots for Faster Diagnosis

A practical CI debugging workflow starts with the automatic failure screenshot for a quick first look, then falls back to the full video when the screenshot alone doesn't make the cause obvious, since the video shows the events leading up to that final moment.

Common Mistakes

  • Disabling video recording without first confirming screenshots and logs provide sufficient failure context.
  • Never configuring CI to actually preserve and expose the videos folder as an artifact.
  • Keeping full, high-quality video for every single passing test, wasting storage without any debugging benefit.
  • Assuming a video alone is enough context without also checking the command log for exact assertion details.

Key Takeaways

  • Cypress records a video per spec file during headless runs by default.
  • Videos complement failure screenshots by showing the full sequence of events, not just the final moment.
  • videoCompression trades file size against quality; storage-conscious teams tune this deliberately.
  • Disabling or selectively keeping only failed-spec videos is a valid trade-off for large, mature suites.

Pro Tip

If CI storage costs are a concern, configure your pipeline to delete videos for passing specs automatically after the run (many CI providers support conditional artifact retention), keeping full replay capability exactly where it's actually useful: failed tests.