Use Playwright Test’s expect(page).toHaveScreenshot() assertion to compare a page with a reviewed, committed baseline image. In GitHub Actions, install the project dependencies and Playwright’s matching browser, then run the tests in a consistent environment. The first run creates the baseline; later runs report visual differences for review.
Set up a screenshot comparison test
Screenshot assertions are part of Playwright Test. A minimal test navigates to a page and asserts that its screenshot matches a named reference:
As an Amazon Associate I earn from qualifying purchases.
import { test, expect } from '@playwright/test';
test('homepage visual baseline', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveScreenshot('homepage.png');
});
The relative URL in this example assumes your Playwright configuration defines a baseURL. Otherwise, navigate to an absolute URL. Your test setup must also start the application or point the test at an already-running instance; the correct command depends on the project. See the Playwright configuration reference for baseURL and screenshot assertion settings.
Create and maintain visual baselines
Generate the first baseline
- Run the test. If the expected screenshot does not exist, Playwright reports a missing snapshot and writes the actual image.
- Open and review the generated image. Confirm it represents the intended design and that the test reached the expected page state.
- Add the snapshot files to version control and commit them with the test. Playwright’s visual comparisons guide recommends committing and reviewing snapshots.
Update a baseline after an intentional change
When a deliberate UI change makes the reference obsolete, regenerate it with:
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
npx playwright test --update-snapshots
Review the changed images before committing them. An updated snapshot is a change to the test’s expected behavior, not just routine test output.
Name and organize screenshots clearly
Use descriptive names such as homepage.png or checkout-confirmation.png. Playwright also incorporates test and browser-project context into snapshot naming. If you test multiple browser projects, expect separate references where rendering differs.
Run the tests in GitHub Actions
A basic workflow checks out the repository, installs dependencies using the committed lockfile, installs the browsers and system dependencies required by Playwright, runs the tests, and uploads the HTML report. This example uses npm; adapt the Node version, package manager, application startup, test command, and browser projects to your repository.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
name: Playwright visual tests
on:
push:
pull_request:
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx playwright install --with-deps
# Start your app here, or configure Playwright's webServer option.
- run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
Playwright’s GitHub Actions guide provides an official workflow pattern and discusses container-based execution for visual regression testing. Check action versions and any container image tag against the project’s installed Playwright version when maintaining your workflow.
Keep the baseline and CI environment aligned
Playwright cautions: “For consistent screenshots, run tests in the same environment where the baseline screenshots were generated.” Operating system, its version and settings, hardware, power source, and headless mode can affect rendering. Generate and update baselines in the same OS and browser environment used in CI, and pin Playwright through your dependency lockfile so the installed browser version stays associated with that package.
GitHub-hosted runners such as ubuntu-latest are convenient, but the label can move to a newer runner image. A pinned Playwright container can provide a more controlled environment; it adds image-version maintenance, and the image and installed Playwright version must remain compatible. Whichever route you choose, use the same environment for baseline creation and comparison.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Scale test runs with shards
Playwright documents sharding and report merging for GitHub Actions in its CI guide. Keep every shard on the same operating-system and browser environment, and preserve the committed snapshot files so each shard compares against the same references.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteReduce flaky screenshot differences
Wait for stable rendering
Playwright’s screenshot assertion waits for two consecutive screenshots to produce the same result before comparing them. By default, it disables animations: finite animations are fast-forwarded and infinite animations are canceled for the capture. These behaviors reduce some instability but cannot make different environments render identically.
Control dynamic content and application state
Use stable test data and deterministic application state. Timestamps, rotating content, random values, and other changing UI can create diffs unrelated to a code regression. The visual comparison guide documents stylePath for applying styles that filter or normalize volatile elements. Hiding or masking content makes comparisons quieter, but can also conceal a real visual bug; limit it to content known to be irrelevant to the assertion.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Choose the right screenshot scope
Use page.toHaveScreenshot() when the whole page is the behavior under test. Use a locator screenshot when a component or region is the relevant visual unit. A locator narrows the comparison and avoids unrelated page content, and its assertion also waits for consecutive stable screenshots. See the screenshot assertion documentation for details.
Set tolerances without hiding regressions
Playwright compares screenshots pixel by pixel. The screenshot assertion options let you tune what counts as an acceptable difference:
Free tools Windows power users keep installed
One-click scans. No signup required.
maxDiffPixelsallows a fixed maximum number of differing pixels.maxDiffPixelRatioallows a permitted proportion of differing pixels.thresholdchanges the acceptable per-pixel perceived color difference.
These settings can be applied globally in the expect.toHaveScreenshot configuration or per project, and can also be set for an individual assertion. Consult the visual comparisons guide and page assertion API reference for option details. Start with the defaults; when a comparison fails, first determine whether the difference is a real product change, unstable content, or an environment mismatch. Increasing tolerance just to clear a failure can turn a useful regression check into a weaker one.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Troubleshoot common failures
- Missing snapshot on the first run: This is the baseline-creation step. Inspect the generated image, then commit it if it is correct.
- Snapshot mismatch in CI but not locally: Check for differences in operating system, browser version, headless mode, or other rendering conditions. Generate baselines in the same environment CI uses.
- Repeated diffs on content that changes: Stabilize test data and page state. If appropriate, use a narrowly scoped
stylePathrule, while checking that it does not hide a meaningful change. - Browser or system dependency errors: Install the browsers and dependencies for the project’s Playwright version with
npx playwright install --with-depsin the workflow. - Navigation to
/fails: ConfigurebaseURL, use an absolute URL, and ensure the application is started before the test runs. - Large or noisy diffs: Verify that the page is in the expected state and that the reference was reviewed. Prefer a locator assertion if the test concerns one component rather than the whole page; do not raise tolerances until you understand the difference.
Or skip the browser setup
For a one-call screenshot API alternative, ScreenshotNeo accepts a URL and returns an image or PDF. It is not a replacement for Playwright’s committed-baseline workflow when you need pull-request visual assertions, but it can be useful when you want captures without installing and managing a browser in your own script.
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 request options. Cookie banners are accepted and removed along with 60+ known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf 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 to try 1,000 screenshots a month without a card.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Quick Recap
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.




