Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Cypress Visual Testing for Lazy-Loaded Pages: Wait for the Right State

A reliable Cypress screenshot starts with an intentional scroll, an explicit wait for the relevant request or UI state, and an assertion before capture.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture lazy-loaded content reliably in Cypress, trigger the behavior that loads it, wait for the relevant request or an application-level readiness signal, assert that the expected content is present, and only then take the visual snapshot. A DOM query alone does not scroll an element into view, and cy.visit() waiting for the browser’s load event does not mean later asynchronous content has finished rendering.

Why lazy-loaded content is missing from Cypress screenshots

A screenshot records the pixels on screen at the instant it is captured. If data, layout, images, fonts, or animations are still changing, the capture can show an intermediate state and create a false visual failure. Cypress recommends confirming that the page has updated with a functional assertion before taking a snapshot.

As an Amazon Associate I earn from qualifying purchases.

cy.visit() waits for the browser page load event. That does not cover every later XHR or Ajax request, and Cypress does not automatically wait for all such requests. In addition, viewport-triggered loading may not begin until the relevant section is scrolled into view. Finding an element with cy.get() does not itself scroll that element into view.

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.

A reliable Cypress sequence

Intercept the request that supplies the deferred content, deliberately scroll the relevant section into view, wait for that request, and assert the resulting UI before calling your visual snapshot command.

#1 Best Overall
cy.intercept('GET', '/api/products*', { fixture: 'products.json' }).as('products')
cy.visit('/catalog')
cy.get('[data-testid="deferred-section"]').scrollIntoView()
cy.wait('@products')
cy.get('[data-testid="product-card"]').should('have.length', 3)
cy.get('[data-testid="deferred-section"]').then(($section) => {
  // Invoke the project's visual snapshot command here.
})

Replace the route, selectors, fixture, expected item count, and snapshot call with those from your application and visual-testing plugin. The example demonstrates the ordering; it is not a universal, tested recipe. Put the snapshot after retryable assertions that prove the specific state being captured has settled. If the application exposes a loading indicator or stable state attribute, assert that condition too.

Wait for the cause of the content change

Use cy.intercept() and an alias when a known request loads the section, then wait for that alias. This ties the test to the event that matters rather than an arbitrary pause. Cypress documentation favors explicit route waits and retryable assertions over fixed-duration waits such as cy.wait(1000).

Rank #2
Network LAN Cable Tester, VDV Tester, LAN Explorer with Remote
  • Cable tester with single button testing of RJ11, RJ12 and RJ45 terminated voice and data cables
  • Tests CAT3, CAT5e and CAT6/6A cables
  • Fast LED responses indicate cable status (Pass, Miswire, Open-Fault, Short-Fault, and Shield)
  • Test remote stores securely in tester body
  • Compact tester easily fits in your pocket

Trigger viewport-based loading deliberately

Scroll the lazy section or a relevant target into view with scrollIntoView(). Then wait for its request or a UI signal—for example, a loading indicator disappearing or an application-set attribute changing. A selector query by itself is not a scroll action.

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

Assert the state immediately before capture

Choose an assertion that corresponds to what the screenshot must show: the expected cards exist, a loading state is gone, or a stable attribute indicates readiness. The assertion is not a substitute for waiting on a known request, but it guards against capturing a page whose visible state is still incomplete.

Requests are not the same as rendered readiness

A network alias confirms the request it represents; it does not prove every image has decoded, every font has rendered, or every animation has stopped. If layout depends on images, use an application-level readiness signal or assert the relevant image or UI condition before capture. Cypress’s general visual-stability guidance does not specify one universal readiness API for lazy images.

Likewise, waitForAnimations and animationDistanceThreshold affect action commands such as clicks. They do not freeze an unrelated animation elsewhere on the page while a screenshot is taken.

Make visual comparisons deterministic

  • Use the same viewport and consistent browser, operating-system, and font environment for baseline and comparison runs.
  • Stub changing API data with fixtures or controlled responses where practical, and wait for the relevant intercepted request.
  • Reduce or complete animations in the test environment when practical; action-command animation settings alone do not freeze the page.
  • Mask a small, genuinely uncontrollable third-party or time-varying region rather than weakening the comparison threshold for the entire page.
  • Prefer focused component or element snapshots when they answer the regression question; full-page snapshots include more unrelated changes to review.

Cypress’s visual-testing guide recommends snapshotting only after confirming the page is done changing. It also explains that useful visual tests distinguish actual application changes from changes caused by test data, timing, fonts, or rendering environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose a visual-testing workflow that fits the test

Cypress describes two broad approaches: open-source plugins that capture screenshots and compare them locally or in CI, and hosted visual-testing services. Local plugins commonly compare captures against baselines stored with the code. Hosted tools may render in cloud infrastructure and provide review workflows. The descriptions below reflect vendor and Cypress documentation, not independent comparative testing.

Best Value
Sale
iMBAPrice - RJ45 Network Cable Tester for Lan Phone RJ45/RJ11/RJ12/CAT5/CAT6/CAT7 UTP Wire Test Tool
  • Automatically runs all tests and checks for continuity, open, shorted and crossed wire pairs. Visible LED status display.
  • Cable state testing (2-wire): Line DC detecting, anode and cathode determination,Ringing signal detecting open, short and cross circuit testing
  • Cable Type: RJ11 Telephone cable and RJ45 LAN cable
  • Connectors: Ethernet Cat 5, Ethernet Cat 5e, Ethernet Cat 6, Ethernet Cat 7, RJ11 6P and RJ45 8P
  • Power Source: DC9V Battery Required (not included)
Option Documented approach
Chromatic Captures an archive during Cypress tests and renders and diffs it in its cloud.
Happo Supports full-page and component snapshots across browsers and sizes.
LambdaTest SmartUI Compares across browsers and resolutions.
Percy Captures DOM snapshots and renders across browsers and responsive widths.
Sauce Labs Visual Includes managed baseline creation, region ignoring, and DOM capture.
SmartBear VisualTest Supports full-page, element, and multi-device captures.
Wopee.io Manages baselines and review on its platform.

Before adopting a plugin, check its current compatibility with your Cypress version. The official Cypress plugin directory provides version and compatibility information for listed packages. Compare tools by where rendering and comparison run, capture scope, supported browsers and viewports, how baseline review and masking work, and whether your team prefers infrastructure in its own code and CI or a hosted workflow.

Or skip the browser setup

For a direct screenshot of a page, ScreenshotNeo provides a one-call API; it does not replace Cypress assertions or a visual baseline workflow. Its capture options can accept consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture, with each step optional. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. It also provides an MCP server for AI agents, with tools including take_screenshot, get_page_info, and capture_pdf.

cURL example (see the ScreenshotNeo API documentation):

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Learn about ScreenshotNeo or sign up for the free plan.

Quick Recap

SaleBestseller No. 1
Bestseller No. 2
Network LAN Cable Tester, VDV Tester, LAN Explorer with Remote
Network LAN Cable Tester, VDV Tester, LAN Explorer with Remote
Tests CAT3, CAT5e and CAT6/6A cables; Test remote stores securely in tester body; Compact tester easily fits in your pocket
$21.00
SaleBestseller No. 5
iMBAPrice - RJ45 Network Cable Tester for Lan Phone RJ45/RJ11/RJ12/CAT5/CAT6/CAT7 UTP Wire Test Tool
iMBAPrice - RJ45 Network Cable Tester for Lan Phone RJ45/RJ11/RJ12/CAT5/CAT6/CAT7 UTP Wire Test Tool
Cable Type: RJ11 Telephone cable and RJ45 LAN cable; Power Source: DC9V Battery Required (not included)
$9.99

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.