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

To use Percy with a JavaScript-rendered Next.js page, run the app in your test environment, open the route with Playwright, wait until the specific content you want to test is visible and stable, then capture it with Percy’s Playwright SDK. The important distinction is that Percy captures the DOM after JavaScript has run in the test browser; Percy’s separate snapshot renderer then renders that captured state, with JavaScript disabled by default. The official Percy guidance covers Playwright generally, not a special Next.js mode.

How Percy captures a JavaScript-rendered page

Your test browser executes the Next.js app, including client-side rendering and hydration. When the test calls Percy’s snapshot function, Percy serializes the current DOM and discovers the resources needed to render it. Percy then renders the snapshot in its own environment for visual comparison. Its renderer has JavaScript disabled by default, so enabling JavaScript there is not required just because your app used JavaScript to produce the captured DOM. BrowserStack Docs explains this capture and rendering workflow at Percy SDK and screenshot capture workflow.

These are two distinct stages: app JavaScript must have produced the intended page state before capture, while JavaScript in Percy’s later re-render is a separate configuration choice. Turning on JavaScript during Percy rendering can introduce side effects such as redirects or animation, and may interfere with serialized state. The default and its implications are described in Percy configuration options.

Set up a Playwright snapshot for a Next.js route

Use the Playwright setup and test command already used by your project. Start the Next.js app in the test environment, navigate to the route, wait for a condition that proves the JavaScript-rendered state under test is present, and then call Percy with a stable, unique snapshot name. The package and command pattern below follow BrowserStack Docs’ Playwright integration guide; adapt the route, readiness condition, and test command to your project.

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.
#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.

1. Install the Percy Playwright SDK

Add the SDK to the project that runs your Playwright tests:

npm install --save-dev @percy/playwright

Configure the Percy project token in the environment used for the test run. Do not commit the token to source control. Use the token provided for the Percy project you intend to update.

2. Wait for the actual page state, then capture it

For example, if the route renders a product panel after client-side data loads, wait for that panel rather than assuming navigation alone means the page is ready:

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.
import { test, expect } from '@playwright/test';
import percySnapshot from '@percy/playwright';

test('product page visual state', async ({ page }) => {
  await page.goto('http://localhost:3000/products/example');

  const productPanel = page.getByTestId('product-panel');
  await expect(productPanel).toBeVisible();
  await expect(productPanel).toContainText('Example product');

  await percySnapshot(page, 'Product page — loaded state');
});

Replace the example URL and selectors with the route and visible state your test is meant to protect. If content depends on an API response, a client-side transition, or a user action, make the test perform that work and wait for its expected result before capturing. Percy’s guide shows a navigation followed by a snapshot call; it is the application’s responsibility to identify the correct readiness condition.

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

3. Run the test command under Percy

Wrap the project’s existing browser test command with Percy:

npx percy exec -- npx playwright test

If your project uses a different Playwright command or script, put that command after --. Ensure the app is started and ready before the test command runs; the way to do that depends on your project and CI configuration. Percy’s integration documentation describes the project-token and percy exec workflow.

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.

4. Review the snapshot and baseline

Open the Percy build produced by the run, inspect the captured render and any diffs, and approve changes only when they reflect the intended UI. The integration guide says Percy compares against the previous build by default, and supports configuring a different base build. That matters when a branch or deployment should compare against a particular approved baseline rather than whichever build ran most recently.

Choose a capture workflow and coverage

Percy Web or Percy with Automate

Percy project setup offers Percy Web and Percy with Automate paths. Choose according to where you need the browser to run and how you want browser selection controlled; the Playwright integration documentation outlines these options. Keep the same core capture sequence either way: produce the desired state in the test browser, wait for it, and snapshot it.

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

One browser or cross-browser coverage

A single browser can be sufficient when the requirement is protecting a shared layout in one target environment. Add browser coverage when browser-specific behavior or layout differences are part of what you need to verify. Browser selection is a workflow choice, not a Next.js-specific Percy setting.

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

Responsive widths

Select snapshot widths that represent layouts you actively need to protect, such as the breakpoints where navigation or content structure changes. Percy’s responsive visual testing documentation explains that each selected width counts as a separate screenshot toward monthly usage. Avoid adding widths that do not cover a meaningful layout requirement.

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

Configuration and reliability considerations

Do not treat network idle as a universal ready signal

A Next.js page may continue making requests, poll, stream, or hydrate after initial navigation. Conversely, network activity ending does not prove that the particular text or UI state you care about has appeared. Prefer an explicit locator, expected text, state assertion, or completion condition tied to the intended snapshot. Use a delay or network-idle wait only when it matches the page’s behavior.

Authenticated pages and assets

Percy’s snapshot render happens outside the test suite’s browser session. If assets require authentication, the renderer may not automatically have the same access as the Playwright page. The Percy SDK documentation describes discovery configuration options for request headers, authorization, and cookies; configure what the renderer needs for those resources rather than assuming the test browser’s session carries over.

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.

Dynamic content and animation

Unstable data, timestamps, rotating content, and animations can produce diffs unrelated to a meaningful UI change. Stabilize test data and animation behavior where possible, and use Percy’s supported configuration options for dynamic regions or rendering behavior when appropriate. These are visual-test stability concerns, not defects unique to Next.js.

When to enable JavaScript in Percy’s renderer

Only consider enabling JavaScript if the captured snapshot genuinely requires scripts to run during Percy’s separate rendering step. First confirm that the test browser captured the intended post-JavaScript DOM. The renderer’s JavaScript setting defaults off, and turning it on can cause redirects, animations, or conflicts with serialized page state. See Percy configuration options before changing it.

Common problems and fixes

  • The snapshot is missing content rendered by JavaScript: the test may have captured before hydration or asynchronous data finished. Wait for a specific visible element or expected value that represents the state under test, then take the snapshot.
  • The snapshot looks different from the Playwright page: remember that Percy re-renders a serialized snapshot separately and disables JavaScript there by default. Check whether required assets are accessible to Percy, and whether the page relies on scripts running again after capture.
  • Images, fonts, or other assets fail to appear: if requests require authentication, configure the needed headers, authorization, or cookies for Percy’s asset discovery/rendering workflow as documented by the SDK.
  • Diffs change from run to run: stabilize data and animations, and avoid capturing rotating or time-dependent content unless that variability is what the test should cover.
  • Too many snapshots are being consumed: each selected responsive width counts as a separate screenshot. Keep only widths that correspond to layouts or breakpoints you need to protect.
  • A build compares against the wrong visual state: review the selected baseline. The previous build is the documented default; configure a base build when your workflow requires a different approved comparison point.

Or skip the browser setup:

If your goal is to get a page image or PDF rather than run Percy visual-baseline tests, ScreenshotNeo is a screenshot API and MCP server. A single GET request captures a URL; its capture options include accepting consent banners and removing known consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.

Example cURL request, with the ScreenshotNeo API documentation at screenshotneo.com/docs/:

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

ScreenshotNeo includes 1,000 screenshots per month on its free plan with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free plan.

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.