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 desk6 min

How to Compare Puppeteer Screenshots for Visual Regression Testing

Puppeteer captures the page; a matcher or image-diff library compares it with a reviewed baseline. Learn how to keep renders stable, inspect diffs, and update screenshots safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Puppeteer to capture a page, then compare its screenshot with a reviewed baseline using a visual-diff tool. Puppeteer’s page.screenshot() produces image bytes; a matcher such as jest-image-snapshot or the lower-level Pixelmatch library performs the comparison. The test is meaningful only when the page state and rendering environment are repeatable.

What Puppeteer does—and what performs the comparison

Puppeteer captures a rendered page; it does not itself decide whether two screenshots are visually equivalent. Its Page.screenshot() method returns image bytes (Uint8Array) by default, or a base64 string when requested. You can save the bytes or pass them to a comparison library. See the Puppeteer screenshot API.

This is visual regression testing, not ordinary Jest snapshot testing. Visual regression compares page images. Jest’s serialized snapshots instead compare textual representations. See Jest’s snapshot-testing documentation.

Choose a comparison approach

Approach Best fit How it compares Trade-offs
jest-image-snapshot Teams already using Jest that want matcher and baseline integration Uses Pixelmatch by default; SSIM is also available Handles baseline and diff workflow, but requires Jest and package configuration. Its README describes SSIM as experimental. See project documentation.
Pixelmatch directly Teams building a custom test harness Pixel-level comparison with configurable threshold and optional diff output You provide image decoding, baseline management, and failure review. Inputs must have equal dimensions. See Pixelmatch documentation.
Playwright screenshot assertions Teams willing to use Playwright’s test runner instead toHaveScreenshot provides screenshot assertions and baseline handling This is a framework alternative, not a Puppeteer comparator. Its environment guidance is also useful when designing Puppeteer tests. See Playwright visual comparisons and Page assertions.

For a Jest project, jest-image-snapshot is usually the shortest route to a baseline-and-diff workflow. Choose Pixelmatch directly when you want to own that workflow or are not using Jest. There is no universal correct threshold: select one by reviewing diffs from your own stable environment, not by copying an unexplained value.

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Capture a screenshot and compare it with a baseline

The following illustrates the core Jest matcher flow. It assumes a Jest test, an existing Puppeteer page, and a page already brought to a stable state. Adjust imports, browser setup, and package options to the versions installed in your project; the matcher’s documentation describes its baseline behavior and configuration.

const { toMatchImageSnapshot } = require('jest-image-snapshot');
expect.extend({ toMatchImageSnapshot });

// In a Jest test after creating `page` and bringing the page to a stable state:
const image = await page.screenshot({
  type: 'png',
  fullPage: true,
});
expect(image).toMatchImageSnapshot({
  // Start strict, inspect generated diffs, then set an allowance
  // only if reviewed renderer noise warrants one.
  failureThreshold: 0,
});

On the first run, jest-image-snapshot creates a PNG baseline; later runs compare new image buffers with it. Keep that baseline as an assertion artifact representing an appearance the team has reviewed and accepted. The matcher can use Pixelmatch or SSIM and provides configuration for snapshot, diff, and received-image handling. Check the installed release’s documentation for exact options.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Set capture scope deliberately

  • Full document: use fullPage: true when the test should cover the entire page, including content below the fold.
  • Viewport: use a fixed viewport and the default fullPage: false when the visible screen is the intended contract.
  • Specific region: use the screenshot clip option to capture a defined page rectangle.

The screenshot API documents PNG as the default image type and fullPage: false as the default full-page setting. Set important options explicitly so a change in test setup does not silently change what the baseline means. See Puppeteer screenshot options.

Use Pixelmatch without the Jest matcher

For a custom harness, decode the baseline and received image into pixel arrays of the same width and height, then call Pixelmatch with a diff buffer or null. Fail the test if its returned mismatch count exceeds the allowance your team has chosen. Pixelmatch requires equal image dimensions and exposes a per-pixel threshold from 0 to 1, defaulting to 0.1; lower values make comparison more sensitive. Its README documents the API and diff output at Pixelmatch.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Make renders repeatable before adjusting sensitivity

Differences can come from the page or from the machine rendering it. Playwright’s visual-testing guidance identifies operating system, browser version, browser settings, hardware, power source, and headless mode as possible sources of screenshot variation. Apply the same caution to Puppeteer: use the same environment for baseline creation and CI runs wherever possible. See Playwright’s visual-testing guidance.

  • Pin the browser build and OS or container image; keep headless mode consistent.
  • Set the same viewport and device scale factor, fonts, locale, timezone, and test data.
  • Wait for the page to reach a stable state before capturing. Control app state and network-dependent content where your test permits.
  • Disable animations or freeze volatile elements when appropriate. Playwright documents stylesheet injection to filter volatile elements as one example of this general technique; it is not a Puppeteer matcher feature. See the Playwright guide.
  • When using Pixelmatch, ensure both decoded images have identical dimensions before comparison.

Do not begin by increasing the allowed mismatch count to make a noisy test pass. First determine whether the change is an unintended rendering difference, unstable content, or a legitimate product change. A threshold should accommodate only the variation you have observed and reviewed in the target environment.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Review a failure and update baselines safely

  1. Open the expected baseline, the newly received screenshot, and the generated diff. Configure the matcher to retain received images on failure and place diffs where your team can inspect them.
  2. Identify the source of the difference: page behavior, content or test data, capture scope, or environment drift.
  3. If the visual change is intended, review the updated screenshot and commit the baseline change alongside the code. If it is not intended, fix the page or test setup instead of accepting the new image.

Jest recommends committing snapshot artifacts with code and reviewing them. Apply the same review discipline to screenshot baselines: updating an image is an assertion change, not routine cleanup. See Jest’s snapshot guidance and jest-image-snapshot’s options.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common problems and fixes

Symptom Likely cause What to check or change
Pixelmatch rejects the inputs or cannot compare them Images have different dimensions, or were not decoded into compatible pixel data Use identical viewport and capture settings; decode both images into same-size pixel arrays before calling Pixelmatch.
Many pixels fail on an apparently unchanged page Rendering environment or page state is inconsistent Match browser and OS, headless setting, viewport, device scale factor, fonts, locale, timezone, and test data; wait for stable content before capture.
Small antialiasing or rendering changes fail a strict test The comparison is more sensitive than the observed environment can support Inspect baseline, received image, and diff first. Only then set a justified threshold or allowance based on reviewed diffs.
The screenshot misses content or includes unexpected content Capture scope does not match the test’s intent Choose explicitly between full-page capture, fixed viewport, and a defined clip region.
Every run differs in a dynamic area Volatile data, animation, or timing affects the render Stabilize test data and state, wait for the relevant page condition, and disable or filter volatile content where appropriate.
A baseline changes without a corresponding reviewed UI change Baseline updates are being accepted without inspecting artifacts Require review of expected, received, and diff images; commit accepted baseline changes with the related code.

Or skip the browser setup

If you need an image capture rather than a Puppeteer-based visual-regression harness, ScreenshotNeo offers a one-call screenshot API. This does not replace maintaining and comparing reviewed baselines in your test suite. For API details and options, see the ScreenshotNeo documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

What’s the difference between snapshot testing and visual regression testing?

Visual regression testing compares rendered page screenshots as images. Jest snapshot testing compares serialized textual representations.

How do I resolve conflicts within snapshot files?

For screenshot baselines, inspect the expected image, newly received image, and diff, then keep the intended result and commit the reviewed baseline with the related code. Do not accept an image update without visual review.

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. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.