DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk8 min

How to Capture Baseline Screenshots for Visual Regression Tests in Cypress

Cypress captures screenshots but does not compare baselines itself. Build a deterministic UI state, then use a visual-testing integration to capture, compare, and review changes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a baseline screenshot in Cypress, first drive the application into a known, meaningful state, then use a visual-testing plugin or service to capture the image and compare it with an approved baseline. Cypress’s built-in cy.screenshot() saves screenshots but does not compare them. Reliable comparisons depend on controlling the viewport, browser environment, data, time, and rendering state.

What a Cypress visual regression test needs

A screenshot is evidence of what a page looked like at one moment; it is not, by itself, a regression test. Cypress’s documentation puts the boundary plainly: “Cypress does not perform image comparison itself.” Use a visual-testing integration to store approved baselines, compare new captures, and provide a review or approval workflow.

As an Amazon Associate I earn from qualifying purchases.

The baseline should represent an approved image of a specific application state—not an arbitrary page load. Use ordinary Cypress commands and functional assertions to reach and confirm that state before invoking the selected tool’s snapshot command. The exact command and configuration vary by integration; do not assume a third-party command is built into Cypress.

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.

Build a stable Cypress test before capturing

  1. Choose a meaningful state. Identify the page, component, or user-visible state whose appearance matters. Prefer a focused component when its changes should be reviewed independently; use a full page when the whole layout is the intended comparison unit.
  2. Drive the UI to that state. Visit the app and use Cypress actions such as typing, clicking, and selecting. Add functional assertions for important content so a missing or unfinished page does not become a misleading baseline.
  3. Fix the rendering environment. Set an explicit viewport and use the same browser, browser version, operating-system image, fonts, and display scaling for baseline generation and later comparisons where possible. Differences in those conditions can change pixels without a product change.
  4. Control variable inputs. Stub changing API responses with cy.intercept() and fixtures. Use cy.clock() when dates, times, countdowns, or other time-dependent values appear in the image.
  5. Wait for the intended content to settle. Assert that key content is present and wait for relevant asynchronous work to finish. Avoid relying on arbitrary delays when a selector or application condition can establish readiness.
  6. Capture and compare. Call the snapshot command supplied by the chosen visual-testing integration. On the first run, its workflow may create a baseline; review and approve it using that tool’s process. On later runs, inspect reported differences and approve only intentional changes.

Illustrative test shape

This example shows how to establish a repeatable state. The final snapshot call is deliberately represented by a comment: its name and options belong to the plugin or service you choose, not to Cypress itself.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
it('renders a completed todo consistently', () => {
  cy.viewport(1280, 800)
  cy.visit('/')

  cy.get('.new-todo').type('write tests{enter}')
  cy.contains('.todo-list li', 'write tests')
    .find('.toggle')
    .check()
  cy.contains('.todo-list li.completed', 'write tests')
    .should('be.visible')

  // Invoke the selected visual-testing plugin or service here.
  // Its command captures and compares against an approved baseline.
})

Cypress documentation uses cy.compareSnapshot('completed-todo') to illustrate the general shape, but that is an example of a plugin-style command, not a built-in Cypress command. Confirm the actual API and baseline-approval steps in the documentation for the integration you install.

Choose the screenshot scope and Cypress capture behavior

Cypress’s cy.screenshot() command can save an image of the application and optionally the Cypress Command Log. It can be called directly from cy or chained from a command that yields one DOM element. The documented capture choices are viewport, fullPage, and runner; the command documentation lists fullPage as the default. An element screenshot ignores that option.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • Viewport: Useful when the contract is what a user sees in the current viewport. Keep the viewport dimensions fixed.
  • Full page: Useful for broad page-layout changes, but unrelated regions can create noise and make a diff harder to diagnose.
  • Element: Useful for a component or region with a clear owner. A focused capture can prevent unrelated page changes from failing the same check.
  • Runner: Includes Cypress runner context, which is generally a debugging-oriented view rather than a clean application-only baseline.

Cypress stores screenshots in cypress/screenshots by default. Named screenshots use the name you supply; duplicates receive a numeric suffix unless overwrite: true is set. Cypress organizes output relative to the spec path and test name. Those saved files are not automatically managed baselines for a visual-testing integration.

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

During cypress run, Cypress automatically captures screenshots when tests fail by default; it does not do this automatically during cypress open. Treat failure screenshots as debugging artifacts, not as approved visual comparisons.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Prevent flaky diffs without hiding real regressions

Visual differences can come from unstable inputs rather than a code change. Cypress documents options related to timers and animations during screenshot capture, as well as blackout selectors for hiding sensitive content. Check the documentation for the precise Cypress version in use before relying on specific defaults or option behavior.

  • Animations: Cypress notes that waitForAnimations and animationDistanceThreshold apply to action commands; they do not guarantee that an unrelated animation cannot be in progress when a screenshot is taken. Suppress animations in a controlled test setup or wait until the relevant motion ends.
  • Network-driven content: Stub responses that vary between runs, and assert the expected rendered result before capture.
  • Time-driven content: Freeze time where displayed dates or timers affect pixels.
  • Unavoidable dynamic regions: If your chosen tool supports masking, mask only the region that cannot be made deterministic. A broad threshold is not a substitute for controlling known sources of variation.
  • Snapshot count: Capture deliberate, meaningful states. Every diff creates review work; too many broad snapshots can make careful review harder.
  • Accessibility: Image comparison does not establish that text contrast or other accessibility requirements are met. Keep functional and accessibility checks alongside visual tests.

Screenshot capture is asynchronous. Cypress says capture takes around 100 ms, and the application may change between issuing the command and completion. Stabilize the page before capture instead of assuming that the screenshot happens at the exact instant the command is called.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Choose a local plugin or a hosted visual-testing service

Approach What it means What to evaluate
Local open-source plugin Image comparison runs locally or in CI; the team manages baseline files and review artifacts. Where baselines live, how updates are reviewed, CI artifact handling, rendering consistency, and maintenance burden.
Hosted visual-testing service A service may manage capture or rendering, baseline storage, comparisons, and review. Some services support multiple browsers or viewport widths. Browser and viewport coverage, CI or pull-request workflow, rendering consistency, approval experience, current features, terms, and cost.

Cypress describes local plugins as free and self-managed, with the team responsible for baselines and review. Hosted services trade a subscription for managed capabilities, but the exact feature set differs by provider. Comparison approaches also differ: some tools use pixel differences and some hosted services describe other methods. Evaluate sensitivity to rendering noise, useful defect detection, explainability, masking, and threshold controls; no approach is universally best.

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

Cypress’s visual-testing guide names Applitools Eyes, Argos, Chromatic, Happo, LambdaTest SmartUI, Percy, Sauce Labs Visual, SmartBear VisualTest, and Wopee.io among commercial integrations. It also points to open-source options including Cypress Image Diff, Cypress Image Snapshot, Cypress Visual Regression, Visual Regression Diff, and Pixeleye. These tools do not necessarily share the same capture model, comparison method, supported test types, or review workflow. For example, Cypress describes Applitools Eyes as AI-assisted and Percy as capturing DOM snapshots and rendering across browsers and responsive widths. Check each provider’s current official documentation and Cypress compatibility information before adopting a specific implementation.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
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 clean screenshot of a public URL rather than a Cypress-controlled application state, ScreenshotNeo offers a one-request website screenshot API. It does not replace a Cypress visual-testing integration: this call captures a URL and returns an image; it does not drive Cypress interactions or compare the result with an approved baseline.

Install Python’s requests package, set your API key, then run:

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)

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

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

Sign up for ScreenshotNeo’s free plan to try it with 1,000 screenshots a month and no card.

Troubleshoot common baseline problems

Symptom Likely cause What to do
The test passes, but there is no baseline comparison cy.screenshot() only captures an image, or the selected integration’s comparison command is not configured. Install and configure a visual-testing plugin or service; use its documented snapshot and approval workflow.
The same page produces diffs on every run Viewport, browser, operating system, fonts, time, network data, or animation state varies. Standardize the rendering environment, stub variable responses, freeze relevant time, and wait for the UI to settle.
The screenshot shows loading or incomplete content Capture ran before the page reached the state being tested. Add assertions for the required content and wait on a meaningful selector or completion condition before snapshotting.
A full-page diff is difficult to diagnose Changes in unrelated page regions are included in one broad capture. Consider an element-level snapshot where that component is the intended failure and review unit.
An animation still appears mid-transition Action-command animation settings do not necessarily stop unrelated animation at capture time. Disable or settle animation in the test environment, or explicitly wait for the relevant transition to finish.
Duplicate screenshot files appear Repeated named captures are saved with numeric suffixes by default. Use distinct names for separate artifacts or set overwrite: true when replacing an existing file is intended.
Failure screenshots appear in CI but not interactive runs Automatic failure screenshots are enabled by default for cypress run, not cypress open. Use the integration’s deliberate snapshot command for visual tests; use failure screenshots as diagnostics.

FAQ

Should a visual baseline replace Cypress assertions?

No. Assertions verify that expected behavior and content exist; a visual comparison checks rendered appearance. Keep both, and add accessibility checks for requirements a pixel diff cannot judge.

Should every Cypress test take a screenshot?

No. Capture states that protect a meaningful visual contract and can be reviewed usefully. Excess captures increase diff-review workload without necessarily improving coverage.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.