October 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Add Visual Testing to an Existing Test Suite

A practical guide to adding screenshot comparisons to an existing Playwright Test suite, reviewing baselines, and keeping CI renders consistent.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add visual checks gradually: keep your existing functional journey, choose a few high-value states that render consistently, and add screenshot assertions there. For a Playwright Test suite, the built-in expect(page).toHaveScreenshot() compares screenshots with approved baseline images. Review new baselines before accepting them, then run comparisons in a consistent CI environment. The implementation below is specific to Playwright Test; other frameworks need their own documented comparison tools.

Start with a few stable, important screens

Visual testing checks whether a rendered page or component differs from an approved reference. It complements functional assertions: a test can confirm that a button works while a screenshot check catches an unintended layout or styling change.

As an Amazon Associate I earn from qualifying purchases.

Do not add a screenshot to every existing test at once. Choose a small number of checkpoints where a visual defect would matter and where the page can be brought to a repeatable state. For example, add a check after an existing test has loaded a key page, completed its relevant interaction, and waited for the interface to settle.

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.
  • Prefer screens that represent important user-facing layout, styling, or content presentation.
  • Control the application state and data so the screenshot is comparable from run to run.
  • Choose a consistent viewport and browser environment before expanding to more combinations; each extra combination adds snapshots to review and maintain.
  • Keep functional assertions in place. A screenshot comparison is not a substitute for checking that the application behaves correctly.

Add a screenshot assertion to a Playwright Test

Playwright Test provides the native assertion await expect(page).toHaveScreenshot(). Its documentation describes creating an initial reference screenshot and comparing subsequent screenshots against it. See the Playwright visual comparisons documentation; check the documentation and the version installed in your project before adapting the example.

Example: add a checkpoint to an existing test

Keep the journey and its functional checks, then add the screenshot assertion once the page reaches the state you intend to protect:

import { test, expect } from '@playwright/test';

test('account page renders correctly', async ({ page }) => {
  await page.goto('/account');
  await expect(page.getByRole('heading', { name: 'Your account' })).toBeVisible();

  // Keep any existing interactions and functional assertions here.
  await expect(page).toHaveScreenshot();
});

The first run may create the baseline image. Inspect that image and confirm it represents the intended UI before treating it as approved. Later runs compare the rendered page with the saved reference.

Rank #2

Review changes before updating baselines

A changed screenshot is a signal to investigate, not an instruction to refresh the reference. Inspect the diff, decide whether the change is intentional, and update the baseline only after approving the UI change. An indiscriminate baseline update can make a regression the new expected result. Playwright documents its snapshot comparison and update workflow in its snapshot guide.

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

Make screenshot runs repeatable in CI

Screenshot comparisons are most useful when the baseline and the CI render are produced under comparable conditions. Install the browser binaries and operating-system dependencies needed by the CI worker, then run the Playwright suite. Playwright’s CI documentation recommends setting workers to one in CI to prioritize stability and reproducibility, and describes sharding when a team needs to distribute work more widely.

  • Keep the browser and operating-system environment consistent between baseline creation and comparison where possible.
  • Use the same viewport, fonts, test data, application state, and relevant configuration for both runs.
  • Start with one CI worker if stability is more important than parallel throughput. Consider sharding if wider parallel execution is needed, following Playwright’s CI guidance.
  • When a CI screenshot differs, first check whether the render conditions changed before approving a new baseline.

When to consider a hosted visual-review workflow

Local Playwright snapshots may be sufficient when your team can manage reference images and review changes in its current workflow. A hosted service may be worth evaluating if you need a different snapshot-review process or want checks integrated into an existing CI pipeline. The documented integration shapes differ:

Approach Documented integration Questions to evaluate
Playwright native Screenshot assertions with locally managed snapshot baselines. Playwright documentation. How will the team store, review, and approve baseline changes? Does the existing CI process fit?
Chromatic Extends Playwright’s test and expect utilities; snapshots are reviewed in Chromatic’s cloud environment, and CI setup is manual. Chromatic Playwright documentation. Does the cloud review workflow fit your access-control, CI, and code-change requirements?
Percy Documents a drop-in route for existing toHaveScreenshot() assertions and a baseline setup workflow. Percy Playwright documentation. How will you seed baselines, handle the project token, and review or gate changes?
Applitools Eyes Documents adding Eyes to existing Playwright tests and running checks within the existing configuration and CI pipeline. Applitools Playwright tutorial and Eyes Playwright documentation. What checkpoint or API changes, comparison method, reporting, and review workflow does your team need? Applitools’ claims about its own comparison behavior should be assessed as product claims, not independent benchmark results.

These documented integration patterns are not an independent quality or performance comparison, so they do not establish that one hosted option is better than another. Before adopting one, confirm its current package versions, supported framework versions, service terms, and security and data-handling details in the vendor’s current documentation.

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 screenshot of a URL rather than a visual regression assertion inside your test suite, ScreenshotNeo is a website screenshot API and MCP server for developers. It returns an image or PDF from one GET request; it does not replace Playwright’s baseline comparison workflow.

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

For setup details and supported parameters, see the ScreenshotNeo API documentation. Example request:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie banners are accepted and removed before capture, along with known consent platforms, newsletter popups, and chat widgets; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
  • An MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

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 *

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.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
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.