Define a Playwright Test project for each viewport you want to cover, then run the same screenshot assertion in every project. Playwright creates a reference image on the first run and compares later runs against it. Keep baseline creation and comparison in the same browser and operating environment to reduce rendering noise.
Configure projects for the viewports you need
Playwright projects let one test run with several configurations. Give each viewport a distinct project name, set its dimensions in use.viewport, and include the project name in the snapshot path so each configuration has a separate baseline.
As an Amazon Associate I earn from qualifying purchases.
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
projects: [
{
name: 'desktop-1280',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 800 },
},
},
{
name: 'tablet-768',
use: {
...devices['Desktop Chrome'],
viewport: { width: 768, height: 1024 },
},
},
{
name: 'mobile-390',
use: {
...devices['Desktop Chrome'],
viewport: { width: 390, height: 844 },
},
},
],
expect: {
toHaveScreenshot: {
pathTemplate: '{testDir}/__screenshots__{/projectName}/{testFilePath}/{arg}{ext}',
},
},
});
The dimensions here are illustrative, not an official device matrix. Choose widths and heights that exercise your site’s supported layouts and responsive breakpoints. The Desktop Chrome profile supplies a browser configuration; overriding viewport changes the page dimensions, but does not turn it into a full phone simulation. For more on projects, see the Playwright projects guide; device descriptors are documented in the emulation guide.
Write a screenshot assertion
Use toHaveScreenshot() from Playwright Test. The screenshot assertion requires the Playwright Test runner, rather than being a standalone browser capture assertion.
#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
import { test, expect } from '@playwright/test';
test('homepage visual layout', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveScreenshot('homepage.png');
});
Run every configured project with npx playwright test. To run just one, select its project name: npx playwright test --project=mobile-390. The same test file runs once per selected project, with each project’s viewport and browser configuration.
Create, compare, and review baselines
On the first run, when no reference screenshot exists, Playwright generates a baseline. On later runs, it compares the current rendering with that image. The assertion waits until two consecutive screenshots produce the same result before comparing, rather than relying on one immediate capture. See the visual comparisons guide and screenshot assertion API.
- Run the test to generate baseline images for the configured projects.
- Inspect the images and commit accepted reference snapshots with the code.
- When a visual change is intentional, run
npx playwright test --update-snapshots. - Review the regenerated images before committing them; a successful command does not establish that every change is correct.
Including {projectName} in pathTemplate prevents viewport projects from sharing the same image path. Playwright documents the template variables in its test configuration API.
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
Choose viewport-only coverage or device emulation
A viewport project sets the CSS layout area. It is useful for checking responsive breakpoints, but width and height alone do not model every phone behavior. A named device descriptor can supply settings such as user agent, screen size, viewport, and touch capability. Playwright also supports emulation settings for locale, timezone, color scheme, geolocation, and permissions. These simulate browser behavior; they do not establish that a page has been tested on every real device or operating system.
To use a phone profile, spread its descriptor in the project and override its viewport afterward only if you deliberately want different dimensions:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'phone-profile',
use: {
...devices['iPhone 13'],
viewport: { width: 390, height: 844 },
},
},
],
});
Use a device descriptor available in the Playwright version installed in your project. The emulation guide explains the settings profiles can provide. For responsive CSS alone, a small set of representative viewport projects is usually easier to understand and maintain than treating every possible screen size as a separate test.
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.
Keep screenshots stable without hiding real regressions
Screenshot output can differ with the host operating system, browser version and settings, hardware, power source, or headless mode. Generate and compare baselines in the same environment where possible; changing the environment may create pixel differences unrelated to your code. Playwright’s visual comparison guidance describes these sources of variation.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Control dynamic content
Make the page state repeatable before capture. If known dynamic regions are irrelevant to the visual check, use a screenshot stylesheet through stylePath to hide or adjust them. Apply that narrowly: hiding a large part of the page can conceal a real defect. The supported screenshot assertion options are listed in the API reference.
Use tolerance only for known noise
threshold allows a perceived color difference, while maxDiffPixels allows a specified number of differing pixels. A higher tolerance can let genuine visual changes pass, so use the smallest allowance that addresses an identified source of harmless variation. The assertion disables animations by default. Hover states still affect the image; move the pointer away if hover appearance is not part of the state under test.
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
Resize a page in a test when projects are not appropriate
page.setViewportSize() can resize a page within a test, but Playwright’s Page API notes that it also resets screen size. Set the viewport before navigation because many sites do not expect their viewport to change after load. For reusable coverage across named browser configurations, projects make the configuration and per-viewport baselines easier to see; use in-test resizing when the test specifically needs to inspect a sequence of sizes on the same page.
Choose a practical test matrix
There is no universal set of dimensions that covers every site. Base projects on the layouts your site supports and the visual risks you need to catch.
- Representative widths: choose sizes around important responsive transitions and supported layouts, rather than adding arbitrary dimensions.
- Browser engines: add browser projects when cross-browser rendering is part of the requirement; each additional configuration means more test runs and baselines to review.
- Device profiles: use these when user agent, screen dimensions, or touch behavior matters in addition to CSS viewport layout.
- Comparison strictness: start with strict visual comparison, and introduce a narrow tolerance only for a known source of irrelevant pixel variation.
Troubleshooting common failures
The first run reports a missing snapshot or writes a new one
This is expected when a reference image has not yet been created. Inspect the generated image, then commit it as the baseline if it represents the intended page.
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.
Different viewport projects appear to overwrite one another
Check that the screenshot path includes {projectName}, and that each project has a distinct name. Without separate paths, different configurations may target the same reference location.
Snapshots fail on a different machine or CI worker
Rendering can vary across host environments and browser configurations. Run comparison jobs in the same environment used to generate baselines, including a consistent browser version and headless setup where practical. If the environment must change, review any resulting diffs rather than loosening thresholds automatically.
The screenshot changes between runs
Check whether content, hover state, animation, or other page state changes during capture. Stabilize the page, move the pointer away if hover is incidental, and use a targeted stylePath adjustment for known dynamic regions. The assertion waits for consecutive identical screenshots, but that does not make genuinely changing page content deterministic.
A phone-width test misses a mobile-only behavior
A viewport-only project covers CSS dimensions, not the full set of device characteristics. Use a suitable device descriptor when user agent, screen size, or touch behavior is relevant, and describe the result as browser emulation rather than a test on physical hardware.
Or skip the browser setup
If you need an image or PDF of a page without configuring Playwright projects and screenshot baselines, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return PNG, JPEG, WebP, or PDF; the example below requests a WebP capture.
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 and setup. ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or 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 provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →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.




