October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Ignore Changes in Visual Regression Testing Without Hiding Bugs

Stabilize visual tests before suppressing differences. Learn when to mask, hide, ignore, or use layout matching—and how to keep important dynamic values tested.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stop false visual-regression failures, first make the screenshot capture repeatable, then suppress only the unstable pixels: mask a small locator, apply narrowly scoped capture-time CSS, or use your tool’s ignore-region feature. Keep important dynamic values under functional assertions, because ignored pixels are no longer being visually checked.

Make the screenshot repeatable before ignoring differences

A screenshot can change even when the application code has not. Playwright notes that rendering can vary with the host operating system, browser version, settings, hardware, power source, and headless mode. Generate and compare baselines in a consistent environment before relaxing the comparison. See Playwright’s visual comparisons guide.

As an Amazon Associate I earn from qualifying purchases.

  • Use the same browser and version for baseline generation and test runs.
  • Keep the host environment and screenshot settings consistent.
  • Control test data and third-party content where practical; if it cannot be controlled, target only the unstable region.
  • Check that animations or transitions are not creating nondeterministic captures.

Confirm that the APIs shown below are available in your installed tool version; integrations and options evolve.

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

Choose the narrowest suppression that solves the problem

Method Scope What remains checked Main caution
Locator mask or element ignore One element or rectangle The rest of the screenshot The value is not visually validated; some tools also ignore the element’s bounds or position.
Capture-time CSS or style override Selectors matched by the injected stylesheet The screenshot after styling Hidden or altered content is not visually validated. Keep the stylesheet narrowly scoped.
Disable a story snapshot An entire story or test No screenshot comparison for that story Use only when the story is not a useful snapshot target or during a deliberate staged adoption.
Layout-oriented matching A broad comparison mode Layout or structure as defined by that vendor Semantics vary by tool; content changes you care about may be tolerated.
Increase pixel threshold or tolerance The comparison’s acceptance rule Changes that exceed the configured threshold Real low-area visual defects can become accepted noise.

These approaches are not interchangeable: each vendor defines its own comparison behavior. Stabilize capture first, inspect the actual diff, then choose the smallest exclusion that makes the test reliable.

Playwright: mask a locator or use capture-time styling

Mask one dynamic value

For a timestamp whose exact pixels are unimportant, mask just its locator with Playwright’s screenshot assertion:

await expect(page).toHaveScreenshot({ mask: [page.locator('.timestamp')] });

Playwright covers the locator’s bounding box with a colored overlay. The rest of the screenshot is still compared, but the timestamp’s appearance is not checked. Avoid masking a whole card or page section when only one value changes.

Hide or normalize content with a stylesheet

Playwright’s visual-comparisons guide documents stylePath for applying styles at screenshot time. For example, put a narrowly scoped rule in a stylesheet and pass its path to the assertion:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await expect(page).toHaveScreenshot({ stylePath: './visual-test.css' });

The documentation presents this as a way to improve determinism. Any content the stylesheet hides or changes is not visually checked in that capture. Keep the file under review alongside the affected visual test.

Playwright’s PageAssertions API documents disabled animations as the screenshot assertion default: finite animations are fast-forwarded and infinite animations are canceled for capture, then resumed. See PageAssertions for the current assertion options.

How other visual-testing tools handle dynamic regions

Applitools

The Applitools Playwright integration accepts ignoreRegions, including a locator. Applitools also documents ignore regions and layout matching for dynamic content. When an element moves but its appearance remains meaningful, its guidance describes checking an element region independently of its changed position. See Integration with Playwright, Adding Ignorable Regions, Dynamic content, and Visual Testing of dynamically positioned elements.

Chromatic

Chromatic supports ignoring a DOM element with the .chromatic-ignore class or data-chromatic="ignore". It says the ignored element’s pixels, bounding box, and position are ignored, so this can conceal more than an appearance change. To omit a whole story instead, Chromatic documents disabling snapshots for that story. See Ignore elements and Disable snapshots.

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

Percy

The Percy Playwright client documents ignoreRegionSelectors, ignoreRegionXpaths, and custom rectangular boundaries for ignored regions. Check the client documentation for the integration-specific configuration: percy/percy-playwright.

Keep important dynamic content covered

Ignoring a region trades visual coverage for stability. If the content matters, test it separately: for example, assert that a displayed price or account status has the expected value, even if its visual rendering is masked in the screenshot. If the content varies but the page structure is what matters, a layout-oriented mode may fit better where your tool provides one; check that tool’s semantics rather than assuming it behaves like a pixel mask.

When reviewing a newly accepted baseline, inspect the diff and treat the change as a code-review decision. Do not accept every changed image automatically.

Troubleshoot persistent visual diffs

  1. Different browser or host setup: align the baseline and comparison environments before changing thresholds.
  2. Dynamic values or third-party content: freeze or stub the data if practical. Otherwise suppress only the unstable target and assert important values separately.
  3. Animations or transitions: use the framework’s animation handling or a supported capture stylesheet to neutralize motion.
  4. A moving element still matters visually: do not discard its coverage by ignoring it wholesale; use an element-region check or an appropriate layout-aware strategy if available.
  5. A broad ignore or raised tolerance hides a defect: shrink the ignored scope and inspect the diff before accepting a baseline.

Playwright documents environment sensitivity, mask and style options, and comparison thresholds in its visual comparisons guide and PageAssertions API. Applitools, Chromatic, and Percy have product- and integration-specific behavior; do not assume their regions, modes, or availability match one another.

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.
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 screenshots from a URL without configuring a browser capture flow, ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request can return a PNG, JPEG, WebP, or PDF; its options include CSS-selector element capture, custom CSS and JavaScript, and wait conditions. It is a capture service, not a replacement for visual-diff assertions: you still need to compare screenshots and decide what differences matter.

Cookie and consent banners, newsletter popups, and chat widgets are removed before capture, and each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; responses identify the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

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 setup and parameters. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for free.

Frequently Asked Questions

Can I ignore a dynamic region on only one screen?

Yes. Scope the mask or ignore rule to the target element or region in that screen’s test rather than applying a broad global exclusion.

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

Does a screenshot mask test the hidden text or image?

No. A mask or ignored region removes that visual content from comparison, so use a separate functional assertion if its value matters.

Are ignore-region settings identical across visual testing tools?

No. Each integration defines its own behavior; for example, Chromatic documents ignoring an element’s pixels, bounds, and position.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.