Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cypress saves screenshots to cypress/screenshots by default. Change that location by setting the project-level screenshotsFolder option in cypress.config.js or cypress.config.ts. The same setting controls screenshots you take with cy.screenshot() and screenshots Cypress creates for failed tests during cypress run.

Set the screenshot folder in Cypress

Open the configuration file Cypress loads for the project. Put screenshotsFolder at the top level of defineConfig. A relative path such as artifacts/screenshots keeps the project portable between developers and CI machines.

JavaScript or CommonJS configuration

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  screenshotsFolder: 'artifacts/screenshots',
})

Save this as cypress.config.js when your project uses JavaScript or CommonJS.

TypeScript or ESM configuration

import { defineConfig } from 'cypress'

export default defineConfig({
  screenshotsFolder: 'artifacts/screenshots',
})

Use this form in cypress.config.ts (or the equivalent ESM configuration). Do not put the option inside an individual test file. Cypress reads it from the loaded project configuration.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Choose a path deliberately

A project-relative directory is normally the easiest choice for local work and continuous integration because the same repository layout works on every machine. An absolute path can be useful when an external build system requires a fixed location, but it is less portable and may not exist on another runner. Whichever path you choose, the Cypress process must be able to create it.

What screenshotsFolder controls

Manual screenshots

Every cy.screenshot() call writes beneath the configured directory. For example:

cy.screenshot('actions/login/clicking-login')

With screenshotsFolder: 'artifacts/screenshots', this produces a screenshot under that folder, with the spec path and the requested name included in Cypress’s normal layout.

Failure screenshots from cypress run

When a test fails during cypress run, Cypress places the failure image in the same configured folder. Automatic failure screenshots are not taken while using cypress open. To turn failure capture off for run-mode tests, set:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
module.exports = defineConfig({
  screenshotsFolder: 'artifacts/screenshots',
  screenshotOnRunFailure: false,
})

Disabling failure capture does not disable screenshots that your tests explicitly request with cy.screenshot().

Rank #2
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Understand the resulting file names

Cypress organizes screenshots using the spec’s path and the screenshot name. Its documented patterns are:

  • {screenshotsFolder}/{adjustedSpecPath}/{name}.png for a named screenshot.
  • {screenshotsFolder}/{adjustedSpecPath}/{testName}.png for an unnamed screenshot.

The name argument can contain path segments, so a name such as checkout/payment/card-declined creates nested directories. This is useful when you want stable groups such as actions/login or regressions/checkout, but it also means a single test can create more folders than expected.

Duplicate names

If Cypress encounters the same screenshot name more than once, it adds a numbered suffix. Pass overwrite: true when the intended behavior is to replace an existing image rather than preserve both files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cy.screenshot('checkout/summary', { overwrite: true })

Prevent CI runs from deleting earlier screenshots

trashAssetsBeforeRuns defaults to true. Before cypress run, Cypress clears the contents of screenshotsFolder, including nested files and directories. That prevents stale images from being mistaken for output from the current run, but it also removes artifacts you intended to keep.

Set it to false when a workflow must retain screenshots from earlier runs:

Rank #3
Sale
WD 2TB Elements Portable External Hard Drive for Windows, USB 3.2 Gen 1/USB 3.0 for PC & Mac, Plug and Play Ready - WDBU6Y0020BBK-WESN
  • High capacity in a small enclosure – The small, lightweight design offers up to 6TB* capacity, making WD Elements portable hard drives the ideal companion for consumers on the go.
  • Plug-and-play expandability
  • Vast capacities up to 6TB[1] to store your photos, videos, music, important documents and more
  • SuperSpeed USB 3.2 Gen 1 (5Gbps)
module.exports = defineConfig({
  screenshotsFolder: 'artifacts/screenshots',
  trashAssetsBeforeRuns: false,
})

The cleanup applies to the run command. Cypress does not trash these assets when you use cypress open. If your CI system uploads screenshots, arrange the upload after the run and decide whether preserving multiple runs is more valuable than starting with an empty directory each time.

Keep generated screenshots out of source control

Screenshot output is normally a generated artifact rather than source code. Add the chosen directory to .gitignore when the images should be recreated locally or uploaded by CI instead of committed. Cypress’s organizing-tests guidance uses cypress/screenshots/ as an example of a generated directory to ignore; use the same pattern for a custom location such as artifacts/screenshots/.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If your team reviews visual changes in pull requests, use the CI artifact system to retain the files for that run rather than checking every generated image into the repository. The important distinction is whether the directory is disposable after the run or is the hand-off location for another job.

Troubleshoot a path that does not behave as expected

Screenshots still appear in cypress/screenshots

  • Confirm that the option is spelled exactly screenshotsFolder (plural screenshots).
  • Check that you edited the configuration file for the project being run: cypress.config.js or cypress.config.ts.
  • Keep the option at the top level of defineConfig, alongside other project settings.
  • Make sure the command is using that project directory and that there is not another configuration file being loaded.

The folder is empty after a run

Check whether trashAssetsBeforeRuns is still true. Cypress removes the old contents before cypress run; an upload or inspection step that occurs before the new screenshots are created will therefore find nothing. Also verify that the tests actually call cy.screenshot() or that a failure occurred while failure capture is enabled.

No automatic screenshot appears while debugging

This is expected in cypress open. Cypress’s automatic failure screenshots apply to cypress run. Add an explicit cy.screenshot() call if you need an image while working interactively.

More subdirectories appear than expected

Cypress includes an adjusted spec path in its layout, and a screenshot name can add its own path segments. Inspect both the spec location and the string passed to cy.screenshot(). Use a simple name when you want one file per test area, or intentionally include segments when the hierarchy is useful.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Files receive numeric suffixes

That means the same name was written more than once. Keep the suffixes when each capture matters, or pass overwrite: true when the latest capture should replace the previous one.

The process cannot create the directory

Use a location that exists or that the Cypress process can create in both local and CI environments. A machine-specific absolute directory may work on one runner and fail on another; a project-relative directory is usually safer. Check the runner’s permissions and the parent directory before changing test code.

A practical layout for local and CI work

Decision Typical choice What to check
Folder path artifacts/screenshots Available and writable on every runner
Manual captures cy.screenshot('area/state') Names are stable and path segments are intentional
Failure captures Enabled during cypress run Set screenshotOnRunFailure: false only when images are not wanted
Cleanup trashAssetsBeforeRuns: true Change to false if previous artifacts must survive
Version control Ignore the generated directory Upload or retain images through CI when reviews need them
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot of a web page rather than a Cypress test artifact, ScreenshotNeo provides a one-request API. It accepts the page as a visitor would, removes cookie-consent banners, newsletter popups and chat widgets before capture, and returns PNG, JPEG, WebP or PDF output. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed; the response identifies the page verdict and billing status in its X-Page-Verdict and X-Billed headers. Its MCP server also exposes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.

The following requests use https://stripe.com; replace that value with the page you need.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cURL

See the ScreenshotNeo API documentation for the complete parameter list.

Best Value
Sale
UnionSine 1TB Ultra Slim Portable External Hard Drive HDD-USB 3.0
  • 【Upgraded version】 - The mirror logo strip is combined with the striped non-slip design. The rounded corners of the shell are more suitable for holding. The strips play a heat dissipation function to ensure a stable and fast transmission process.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes full-page capture with lazy images loaded, CSS-selector element capture, device presets and custom viewports, dark mode, retina scale, PDF paper and margin controls, custom CSS or JavaScript, selector hiding, waits, request blocking, headers, cookies, user-agent and authorization controls, geolocation and timezone settings, transparent backgrounds, resizing, configurable caching, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. Existing integrations can also use the parameter names accepted by other screenshot APIs.

The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to get started.

FAQ

Does changing the folder move screenshots that already exist?

No. The setting determines where future captures are written; organize or move existing files separately if you need one consolidated archive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use a different folder for manual and failure screenshots?

No. Both capture types use the single project-level screenshotsFolder location. Separate them afterward with your artifact workflow if required.

Why does a clean run contain fewer files than an earlier run?

The default trashAssetsBeforeRuns: true cleanup removes prior contents before cypress run. Set it to false when retaining earlier output is intentional.

Frequently Asked Questions

Does changing the folder move screenshots that already exist?

No. The setting determines where future captures are written; organize or move existing files separately if you need one consolidated archive.

Can I use a different folder for manual and failure screenshots?

No. Both capture types use the single project-level screenshotsFolder location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does a clean run contain fewer files than an earlier run?

The default trashAssetsBeforeRuns setting removes prior contents before cypress run.

Quick Recap

SaleBestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.99
Bestseller No. 2
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
SaleBestseller No. 3

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.