- How Cypress captures screenshots of test failures automatically
- How to manually capture your own screenshot
- How Cypress can record a video of the entire run
- Some options of what to do with screenshot and video artifacts
Cypress comes with the ability to take screenshots, whether you are running in interactive mode using
cypress open or run mode using
cypress run, even in CI.
To take a manual screenshot you can use the
Additionally, Cypress will automatically capture screenshots when a failure happens during runs outside of interactive mode.
This behavior can be turned off by setting
false in the Cypress.Screenshot.defaults().
Screenshots are stored in the
screenshotsFolder which is set to
cypress/screenshots by default.
Cypress clears any existing screenshots before
cypress run. If you do not want to clear your screenshots folder before a run, you can set
Cypress also records videos when running tests.
Video recording is currently only supported when running Cypress from the Electron browser. See this issue for more information.
Video recording can be turned off entirely by setting
false from within your configuration.
Videos are stored in the
videosFolder which is set to
cypress/videos by default.
cypress run completes, Cypress automatically compresses the video in order to save on file size. By default it compresses to a
32 CRF, but this is configurable with the
When using the
--record flag while running your tests, videos are processed, compressed, and uploaded to the Dashboard Service after every spec file runs, successful or not. To change this behavior to only process videos in the case that tests fail, set the
videoUploadOnPasses configuration option to
Cypress clears any existing videos before a
cypress run. If you do not want to clear your videos folder before a run, you can set
So you are capturing screenshots and recording videos of your test runs, now what?
Something you can take advantage of today is the Cypress Dashboard Service: our companion enterprise service that stores your artifacts for you and lets you view them from any web browser, as well as share them with your team.
Another possibility is visual regression testing: comparing screenshots of past runs with the current run to ensure that nothing changed. Read about how to implement visual testing.