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.

Cypress saves screenshots in cypress/screenshots by default. You can change that directory with the screenshotsFolder setting in your Cypress configuration. Manual cy.screenshot() captures work in both cypress open and cypress run; automatic screenshots after a test failure are created during cypress run only.

This guide explains the folder setting, generated paths and filenames, cleanup behavior, Git handling, troubleshooting, and an API alternative when you need screenshots outside a test runner.

Where Cypress puts screenshots

The documented default value of screenshotsFolder is cypress/screenshots. The folder is relative to your project root unless you configure another path. Both screenshots created by cy.screenshot() and failure screenshots produced by a headless run are written below this configured root.

Check the setting in the Cypress configuration reference. A typical project therefore looks like this after a capture:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
your-project/
├── cypress/
│   └── screenshots/
│       └── example.cy.js/
│           └── displays correctly.png
├── cypress.config.js
└── package.json

The exact subfolders and filename depend on the spec and test that generated the image.

Change the screenshot directory

Set screenshotsFolder in the configuration file used by your installed Cypress version. In a JavaScript configuration:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  screenshotsFolder: 'artifacts/cypress-screenshots',
  e2e: {
    baseUrl: 'http://localhost:3000'
  }
})

With an existing configuration, add the property at the top level rather than replacing your other options. Use a path that your CI job can archive, or an absolute path when your build system requires one. Keep the value consistent across local and CI environments unless you intentionally want separate artifact locations.

Verify the active configuration

  1. Open the configuration file Cypress loads for the project (for current Cypress projects this is commonly cypress.config.js or cypress.config.ts).
  2. Confirm that screenshotsFolder is spelled exactly as shown and is at the configuration’s top level.
  3. Run a test that calls cy.screenshot('configuration-check').
  4. Inspect the configured directory after the run. If the file is elsewhere, check for a different project root, an environment-specific configuration, or a command-line setup that points Cypress at another folder.

When Cypress creates screenshots

Mode Manual cy.screenshot() Automatic failure screenshot Folder cleanup before execution
cypress open Yes No No run-level cleanup
cypress run Yes Yes, unless disabled Yes, by default

Cypress documents screenshot support in both interactive and run modes. A test can call the command in either mode:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
describe('checkout', () => {
  it('shows the payment form', () => {
    cy.visit('/checkout')
    cy.screenshot('payment-form')
  })
})

During cypress run, Cypress also captures a screenshot when a test fails. It does not create those automatic failure images in cypress open. Set screenshotOnRunFailure: false when failure images are not wanted:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  screenshotOnRunFailure: false
})

The related behavior is described in Cypress’s screenshots and videos guide.

How Cypress chooses paths and filenames

Cypress builds a path beneath the configured root from the spec and test context. The generated path can change when the set of specs in a run changes because Cypress removes the longest common ancestor shared by the specs being executed. Treat the configured folder as the stable part; do not hard-code every generated subdirectory in scripts unless you control the exact run set.

Named screenshots

Passing a name replaces the suite-and-test-derived name. Names may contain subdirectories, so this is valid:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cy.screenshot('checkout/payment-form')

That call creates a checkout subdirectory below the screenshot root. Use names that are safe on your build agents and avoid characters your operating system treats specially.

Duplicate names

If a screenshot with the same path already exists, Cypress adds a numbered suffix. To replace an existing file instead, pass the overwrite option:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
cy.screenshot('payment-form', { overwrite: true })

Failure screenshots use the normal generated test name with (failed) appended, making them distinguishable from intentional captures.

Why old screenshots disappear after cypress run

The trashAssetsBeforeRuns option defaults to true. Before a run, Cypress clears the contents of the screenshots, videos, and downloads folders, including nested files and subfolders, while preserving the folders themselves. This is why an image from a previous run may be missing even though the test produced a new screenshot.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

To retain existing artifacts, set the option to false:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  trashAssetsBeforeRuns: false
})

The cleanup applies to cypress run, not to interactive cypress open. On Linux Cypress removes contents directly; on macOS and Windows it moves items to the system Trash or Recycle Bin. If a CI workspace is reused, explicitly choose whether preserving old files is useful or whether stale artifacts could mislead you.

Should cypress/screenshots be committed to Git?

Cypress treats screenshots as generated artifacts rather than test source. Its test-organization documentation shows cypress/screenshots/ as an example .gitignore entry, alongside downloads and videos:

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
cypress/screenshots/
cypress/videos/
cypress/downloads/

Ignoring the directory is appropriate when CI stores artifacts elsewhere or when screenshots are disposable. Keep them outside source control when they are large, contain sensitive data, or change on every run. If visual approval images are part of a deliberate review process, store only the curated baseline set in a separately named directory and document how it is updated.

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

Preserve and publish screenshots in CI

Configure the folder to a path your CI provider collects as an artifact, or copy it after Cypress exits. Because a run normally clears the folder first, artifact collection should happen immediately after the test command and even when tests fail.

npx cypress run
status=$?
# Replace this command with your CI system's artifact upload step.
# Upload artifacts/cypress-screenshots/
exit $status

Use a cleanup policy that matches your debugging needs. Keeping trashAssetsBeforeRuns: true gives each run a clean, predictable artifact set. Turning it off can help when you intentionally accumulate evidence, but then add run identifiers to names or destination paths to prevent confusion.

Troubleshooting Cypress screenshot locations

No screenshot appears after cy.screenshot()

  • Confirm the command is reached; a preceding assertion or navigation error can stop the test.
  • Check the configured screenshotsFolder, not only the default directory.
  • Make sure you are inspecting the project root used by Cypress, which may differ from your shell’s current directory in a monorepo.
  • In interactive mode, wait for the command to finish before checking the filesystem.

A failure screenshot is missing

  • Failure screenshots are automatic in cypress run, not cypress open.
  • Verify screenshotOnRunFailure has not been set to false.
  • Check whether a plugin, CI wrapper, or custom configuration points to another folder.

Previous files vanished

Review trashAssetsBeforeRuns. Its default true value clears prior screenshot contents at the start of a run. Set it to false only when retaining old files is intentional, and make your artifact naming unambiguous.

The path changes between runs

Cypress shortens the spec path by removing the longest common ancestor among specs included in that run. Running one spec versus a whole suite can therefore produce different paths beneath the same screenshot root. Locate files by the configured root and generated test name, or use an explicit name with cy.screenshot().

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Duplicate files have suffixes

Repeated names are protected by numbered suffixes. Use a unique name per state, or pass { overwrite: true } when replacement is the intended result.

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 public URL rather than a Cypress test state, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL in one GET request and returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

Use the API documentation at https://screenshotneo.com/docs/ for all options. A minimal cURL request is:

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}`);

For AI workflows, its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients. Other available controls include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or a custom viewport, retina scale, PDF paper and page settings, custom CSS or JavaScript, pre-capture clicks, selector hiding, selector/delay/network-idle waits, ad and tracker blocking, custom headers/cookies/user agent/Authorization, timezone and geolocation, transparent backgrounds, image resizing, chosen TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work to ease migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Plan Included screenshots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Practical checklist

  • Use cypress/screenshots unless your CI or repository layout needs another root.
  • Set screenshotsFolder in the loaded Cypress configuration.
  • Remember that manual captures work in both modes, while automatic failure captures require cypress run.
  • Decide whether the default trashAssetsBeforeRuns: true cleanup matches your retention policy.
  • Use explicit screenshot names for stable paths and overwrite: true only when replacement is deliberate.
  • Ignore generated screenshots in Git unless they are curated review artifacts.

Frequently Asked Questions

Can I use an absolute path for Cypress screenshots?

Yes. Set screenshotsFolder to the absolute destination accepted by your operating system and ensure the Cypress process has permission to write there.

Does Cypress Cloud change the local screenshot folder?

No. Local screenshots are still created according to your Cypress configuration; Cypress Cloud is an optional place to store screenshots and videos with test results.

What image format does cy.screenshot() create?

The Cypress screenshot command writes image files according to Cypress’s screenshot implementation. The folder and naming rules are independent of the external ScreenshotNeo API, which can return PNG, JPEG, WebP, or PDF.

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

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.