To reduce Cypress screenshot storage, first capture only the page area you need; then, if necessary, optimize PNG files after capture. Cypress’s documented screenshot options do not include a compression-quality setting, so image compression requires an external tool. Keep failure screenshots if your team relies on them to diagnose CI problems, and validate any lossy optimization before using images as visual-test evidence.
1. Avoid captures you do not need
Cypress can take screenshots explicitly with cy.screenshot() and can capture automatically when a test fails during cypress run. Automatic failure capture is enabled by default; set screenshotOnRunFailure to false if your workflow does not need those files.
As an Amazon Associate I earn from qualifying purchases.
const { defineConfig } = require('cypress')
module.exports = defineConfig({
screenshotOnRunFailure: false,
})
This setting affects automatic failure screenshots only. It does not stop explicit calls to cy.screenshot(). Before disabling it, consider whether developers use those captures to investigate CI failures: fewer files also means less diagnostic evidence.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →2. Capture a smaller area
If the test concerns one component, take an element screenshot instead of capturing the whole page:
#1 Best Overall
- 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
cy.get('[data-cy=checkout-summary]').screenshot('checkout-summary')
Use a selector that identifies the relevant element reliably. Cypress also documents crop support, but screenshot options can vary by capture mode and Cypress version. Check the screenshot command documentation for the version installed in your project before applying crop options.
Reserve full-page capture for full-page questions
A full-page capture scrolls through the page and stitches sections together. That is useful when the issue spans the page, but it includes more image area than a focused component screenshot. Avoid capture: 'fullPage' when the diagnostic question concerns only a small region.
Rank #2
- Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
- Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
- Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
- Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
- From Sandisk, a brand professional photographers trust to take on assignments.
3. Distinguish file size from retained artifact count
Cypress clears the configured screenshots folder before cypress run by default. Setting trashAssetsBeforeRuns: false changes whether prior assets are retained; it does not compress screenshots. If the directory is growing across runs, check this cleanup setting separately from the byte size of each PNG.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches4. Optimize PNGs after capture
Cypress’s documented screenshot API does not expose a screenshot compression-quality control. If reducing the bytes of existing captures matters, post-process copies and compare their sizes and appearance before changing your pipeline.
Rank #3
- 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.
Try lossless optimization first
OptiPNG attempts to reduce PNG size without semantic loss. It may produce no savings for a particular file, so do not assume every screenshot will shrink. Preserve the original and inspect the output before replacing anything.
Use lossy palette reduction only when acceptable
pngquant reduces the number of colors in a PNG and is lossy. Its --quality=min-max option lets you set a quality range. Color changes may be visible in gradients, antialiasing, and color-rich interfaces, and can cause pixel-diff tests to fail. Keep originals and validate representative outputs in the same visual-testing workflow that consumes them.
Rank #4
- 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.
5. Measure the result in your own workflow
- Choose representative screenshots, including complex pages and failure cases.
- Keep an untouched copy of each original.
- Compare original and processed byte counts; savings are not guaranteed.
- Inspect the processed images at normal viewing size and compare them with your originals.
- Run the actual debugging or visual-diff workflow that uses these files before adopting the optimization.
No universal reduction percentage is established for Cypress screenshots. The result depends on the image and the optimizer settings.
Troubleshooting common approaches
- Failure screenshots still appear after setting
screenshotOnRunFailure: false: check for explicitcy.screenshot()calls. The setting controls automatic captures on failure, not manual ones. - The screenshots folder keeps growing: check whether
trashAssetsBeforeRunsis disabled. That setting affects retention across runs, not individual image compression. - A full-page image is much larger than expected: use an element capture or supported crop when the test only needs a smaller region.
- PNG optimization does not change the file: lossless optimization may not find a smaller encoding for that image. Compare bytes rather than assuming a saving.
- Visual tests fail after pngquant: palette reduction can change pixels. Restore the original or adjust the visual-testing process only if those differences are acceptable for your use case.
Or skip the browser setup
If you need a screenshot from a URL rather than a Cypress test artifact, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API can return an image or PDF:
Quick Recap
Best Value
- Easily store and access 5TB of 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 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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed; and an MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card.
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.




