iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Give a Cypress screenshot a custom name by passing that name to cy.screenshot():
cy.screenshot('checkout-confirmation')
Cypress writes the resulting PNG beneath its screenshots directory and the path associated with the spec. Use slash-separated names for subfolders, overwrite: true when replacement is intentional, and the screenshot callback or Node events when another process needs the exact path Cypress resolved.
Use a custom name with cy.screenshot()
The first argument is the file name. Cypress treats it as a path relative to the configured screenshots folder, so you normally omit the .png extension.
describe('Checkout', () => {
it('shows a successful payment', () => {
cy.visit('/checkout')
cy.get('[data-cy=pay-now]').click()
cy.screenshot('checkout-confirmation')
})
})
The file is saved as a PNG unless your Cypress setup or command options specify another supported behavior. A name containing slashes creates directories:
#1 Best Overall
- MADE FOR THE MAKERS: Create; Explore; Store; The T7 Portable SSD delivers fast speeds and durable features to back up any endeavor; Build your video editing empire, file your photographs or back up your blogs all in an instant
- SHARE IDEAS IN A FLASH: Don’t waste a second waiting and spend more time doing; The T7 is embedded with PCIe NVMe technology that brings fast read and write speeds up to 1,050/1,000 MB/s¹, making it almost twice as fast as the T5
- ALWAYS MAKE THE SAVE: Compact design with massive capacity; With capacities up to 4TB, save exactly what you need to your drive – from large working files to game data and everything in between
- ADAPTS TO EVERY NEED: Whether using a PC or mobile phone, count on the T7 for extensive compatibility²; It’s a true team player when it comes to heavy-duty application usage or file-saving
- HI RESOLUTION VIDEO RECORDING: Record Ultra High Resolution (4K 60fs) videos directly onto the T7 Portable SSD with your favorite camera or mobile devices; Supports iPhone 15 Pro Res 4K at 60fps video and more³
cy.screenshot('checkout/payment-success')
That produces a checkout/payment-success.png path below the location Cypress assigns to the current spec.
Where Cypress actually stores the file
By default, Cypress uses cypress/screenshots. The effective path is built from three pieces:
{screenshotsFolder}/{adjustedSpecPath}/{name}.png
screenshotsFolder: the project-wide root,cypress/screenshotsunless changed.- Adjusted spec path: Cypress places the image under a path derived from the spec location. Common ancestor directories can be removed, so moving specs can change the result.
- Your name: the string passed to
cy.screenshot(), including any slash-delimited folders.
For example, a screenshot named actions/login/clicking-login is nested below the current spec directory and keeps that logical hierarchy. If you need a predictable layout, keep specs under a consistent common directory rather than relying on paths that may change when the project is reorganized.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Prevent or accept duplicate-name suffixes
If Cypress encounters an existing file with the same name, it appends a numeric suffix such as (1) by default. This protects earlier captures, which is useful when a test intentionally records several states.
cy.screenshot('checkout-confirmation')
// A later capture can become checkout-confirmation (1).png
To replace the existing artifact deliberately, pass overwrite: true:
cy.screenshot('checkout-confirmation', { overwrite: true })
Use overwrite only when a single stable artifact is the goal. In parallel or retry-heavy runs, replacing files can hide which attempt produced an image; unique names or Cypress’s default suffixing preserve that information.
Choose names that remain useful in a test suite
Prefer explicit state names
A name such as cart-with-discount tells a reviewer what the image represents. It is easier to search than a name generated only from a long suite and test title.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRank #2
- Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
- Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
- Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
- Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
- Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
Use folders for dimensions that repeat
Organize by feature, flow, or visual state:
cy.screenshot('checkout/empty-cart')
cy.screenshot('checkout/payment-success')
cy.screenshot('account/profile-validation-error')
Avoid accidental collisions
If a test runs more than once in the same output directory, either give each state a distinct name or accept Cypress’s numbered suffixes. Do not add a timestamp unless an external consumer truly needs it; changing names on every run makes automated collection and comparison harder.
Rename screenshots captured after a failed test
During cypress run, Cypress automatically captures a screenshot when a test fails. Those files use a test-based name and append (failed). They are not renamed by adding a cy.screenshot() call after the failure, because test execution has already stopped.
Disable automatic failure images with this project configuration:
import { defineConfig } from 'cypress'
export default defineConfig({
screenshotOnRunFailure: false,
})
Keep the automatic files when CI diagnosis matters. If you need a different naming convention, collect or rename them in a post-processing step using the authoritative path Cypress reports, rather than guessing from a test title.
Retries change failure names
When retries are enabled, Cypress adds an attempt suffix to screenshots from each retry. Consequently, the same test can produce different filenames on different attempts. Treat the suffix as meaningful metadata and do not assume one fixed failure path.
Change the screenshots root directory
Set screenshotsFolder in cypress.config.js or cypress.config.ts to move all Cypress screenshots, including failure captures:
import { defineConfig } from 'cypress'
export default defineConfig({
screenshotsFolder: 'artifacts/cypress/screenshots',
})
After this change, a named capture still follows the spec-relative layout, but its root is artifacts/cypress/screenshots. The setting affects screenshots generated by cy.screenshot() and screenshots created after failures; it does not change the name supplied to the command.
Rank #3
- Capacity Display Variance: 250GB external ssd often appears as around 232GB on Windows. MacOS can show full 250 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
- 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
- Data Security: Solid state drives S.M.A.R.T. health diagnostics and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
- USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
- Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
Preserve files between runs
Before cypress run, Cypress clears the screenshots folder by default, including nested files. If a workflow intentionally keeps artifacts from earlier runs, set:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →import { defineConfig } from 'cypress'
export default defineConfig({
trashAssetsBeforeRuns: false,
})
Retaining files makes historical comparison possible, but it also means old files can collide with current names. Pair this setting with run-specific storage or an explicit cleanup policy.
Get the exact path Cypress resolved
Reconstructing a path yourself is fragile because spec common-ancestor handling, retries, overwrite behavior, and configuration all affect the final location. For per-screenshot processing, use onAfterScreenshot:
cy.screenshot('checkout-confirmation', {
onAfterScreenshot(_element, props) {
console.log(props.path)
},
})
The callback receives the resolved path in props.path. You can use it to upload the file, attach it to a report, or pass it to an image-processing utility.
For run-level integrations, Cypress also exposes resolved paths through the after:screenshot and after:spec Node events in the configuration file. Those events are preferable when collection belongs in the Node process rather than in a test command.
Free tools Windows power users keep installed
One-click scans. No signup required.
Example: log every screenshot from the Node event
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
setupNodeEvents(on) {
on('after:screenshot', (details) => {
console.log(`Saved screenshot: ${details.path}`)
})
},
},
})
Use the callback when the action is local to one capture; use the event when a CI collector should handle all screenshots centrally.
CI, source control, and artifact handling
Expect the folder to be cleaned
A clean run removes prior screenshots unless trashAssetsBeforeRuns is disabled. Configure your CI artifact step to run after Cypress exits so it can collect both named images and failure images.
Rank #4
- 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.
Keep generated output out of source control
Screenshots, videos, and downloads are normally generated artifacts. Exclude their directories from version control and publish them through the CI system when needed.
Make uploads path-driven
Use props.path or the after:screenshot event data as the upload key. This remains correct if a spec moves, the screenshots root changes, or Cypress adds a retry suffix.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteTroubleshooting renamed screenshots
The file has (1) or another number
Cause: a file with that name already exists. Fix: choose a unique name, clean the output directory, or pass overwrite: true when replacement is intentional.
The screenshot is in an unexpected subfolder
Cause: Cypress incorporates the adjusted spec path, and slashes in your name create additional directories. Fix: inspect the resolved callback path, then decide whether to reorganize specs, remove slashes from the name, or change screenshotsFolder.
Old screenshots disappear at the start of CI
Cause: Cypress clears the screenshots folder before cypress run. Fix: set trashAssetsBeforeRuns: false only when retention is required, and prevent stale files from colliding with current artifacts.
Failure screenshots do not use my custom name
Cause: automatic failure capture is generated after the test fails and follows Cypress’s test-based naming. Fix: keep the automatic artifact, disable it with screenshotOnRunFailure: false, or process the reported path after the run.
Recommended Free Tools
A retry produced a different filename
Cause: Cypress appends an attempt suffix for retry captures. Fix: identify files from event metadata instead of assuming one filename, and retain the suffix when it distinguishes attempts.
Best Value
- NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
- IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
- POCKET-SIZED – fits easily in pockets and small bags.
- SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
- 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.
An upload script cannot find the image
Cause: the script reconstructed a path that differs from Cypress’s adjusted spec layout or configuration. Fix: pass props.path from onAfterScreenshot or consume the after:screenshot event.
Or skip the browser setup
If your goal is a rendered image of a URL rather than a Cypress test artifact, ScreenshotNeo can return the screenshot through one request. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.
For a direct capture, see the ScreenshotNeo API documentation:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in 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)
And in 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 also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.
FAQ
Can the custom name include an extension?
Use a name such as checkout-confirmation and let Cypress create the image file. The documented naming model treats your value as relative to the screenshots folder and appends the image extension.
Does changing screenshotsFolder rename existing files?
No. It changes where future screenshots are written. Move or archive existing artifacts separately if you need one consolidated directory.
Which hook is best for an external uploader?
Use onAfterScreenshot for a single command and after:screenshot for centralized Node-side handling of every capture.
Frequently Asked Questions
Can the custom name include an extension?
Use a name such as checkout-confirmation and let Cypress create the image file. The documented naming model treats your value as relative to the screenshots folder and appends the image extension.
Does changing screenshotsFolder rename existing files?
No. It changes where future screenshots are written. Move or archive existing artifacts separately if you need one consolidated directory.
Which hook is best for an external uploader?
Use onAfterScreenshot for a single command and after:screenshot for centralized Node-side handling of every capture.
Quick Recap
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.

