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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Playwright has no documented global disableScreenshotAssertions switch. Screenshot checks run only when your test executes an assertion such as await expect(page).toHaveScreenshot(), await expect(locator).toHaveScreenshot(), or expect(await page.screenshot()).toMatchSnapshot(). To disable one, prevent that call from running: remove it, gate it behind an environment variable, skip the visual test, or run a project that does not include visual assertions. Settings such as timeouts, diff tolerances, snapshot paths, and --update-snapshots change comparison behavior or baselines; they do not switch the assertion off.

What “disable” means in Playwright

Playwright screenshot assertions are explicit methods supplied by the Playwright test runner. They are not automatically attached to every screenshot. A normal screenshot created with page.screenshot() is just an image; it becomes a test assertion only when you compare its buffer with toMatchSnapshot() or use one of the toHaveScreenshot() matchers.

That distinction determines the fix. If the visual check should not run in a particular test or CI job, stop the assertion call from executing while leaving functional checks in place. If visual testing is permanently outside the test’s purpose, delete the assertion and any now-unused snapshot files.

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

The three assertion forms

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

test('page screenshot', async ({ page }) => {
  await expect(page).toHaveScreenshot('home.png');
});

test('locator screenshot', async ({ page }) => {
  const card = page.getByTestId('product-card');
  await expect(card).toHaveScreenshot('card.png');
});

test('buffer snapshot', async ({ page }) => {
  const image = await page.screenshot();
  expect(image).toMatchSnapshot('home.png');
});

These screenshot assertions work through the Playwright test runner. A script that calls page.screenshot() without an assertion does not perform a visual comparison.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Remove one screenshot assertion

Use this when the test is still valuable as a functional check and the visual comparison is no longer required.

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

test('checkout works', async ({ page }) => {
  await page.goto('/checkout');
  await expect(page.getByRole('heading', { name: 'Checkout' })).toBeVisible();
  await expect(page.getByRole('button', { name: 'Pay now' })).toBeEnabled();
  // Screenshot assertion intentionally omitted.
});

Remove the corresponding toHaveScreenshot or toMatchSnapshot line, not the other assertions. If no test references the snapshot after this change, remove the obsolete baseline through your normal source-control review; do not silently replace it with a newly generated image.

Gate the assertion with an environment variable

Gating is useful when the same test file must run in a fast functional job and a dedicated visual job. The default below keeps visual checks off unless PW_VISUAL=1 is present.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { test, expect } from '@playwright/test';

const visualChecks = process.env.PW_VISUAL === '1';

test('checkout works', async ({ page }) => {
  await page.goto('/checkout');
  await expect(page.getByRole('heading', { name: 'Checkout' })).toBeVisible();

  if (visualChecks) {
    await expect(page).toHaveScreenshot('checkout.png');
  }
});

Run the two modes

# Functional run: the screenshot assertion is not executed
npx playwright test

# Visual run: the assertion is executed
PW_VISUAL=1 npx playwright test

On Windows PowerShell, set the variable for the command with $env:PW_VISUAL="1"; npx playwright test. In a CI system, define the variable only in the visual job and document that policy beside the pipeline configuration. A visible condition is easier to audit than an unexplained comment or a permanently skipped test.

Separate visual and functional projects

A project split gives you a CI-level switch and keeps visual coverage available without branching test logic throughout every test. Put visual tests in a named directory or use a project-specific test match.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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
import { defineConfig } from '@playwright/test';

export default defineConfig({
  projects: [
    {
      name: 'functional',
      testIgnore: '**/*.visual.spec.ts'
    },
    {
      name: 'visual',
      testMatch: '**/*.visual.spec.ts'
    }
  ]
});
# Run only functional tests
npx playwright test --project=functional

# Run visual tests when you want screenshot coverage
npx playwright test --project=visual

The exact testMatch and testIgnore patterns should reflect your repository. The important part is scope: a project selection prevents the visual test files from being executed, while the assertions remain available for the visual project.

Skip or quarantine a visual test

Use Playwright’s normal skip mechanisms for a temporary outage, an unstable environment, or a known rendering issue. Include a reason and an owner or issue reference in your code review process so the skip does not become permanent by accident.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { test, expect } from '@playwright/test';

test.skip('checkout visual regression', 'Temporarily disabled while the new payment UI settles');

test('checkout visual regression', async ({ page }) => {
  await page.goto('/checkout');
  await expect(page).toHaveScreenshot('checkout.png');
});

A conditional form can target a known environment:

test('checkout visual regression', async ({ page, browserName }) => {
  test.skip(browserName === 'webkit', 'WebKit baseline is being regenerated');
  await page.goto('/checkout');
  await expect(page).toHaveScreenshot('checkout.png');
});

Prefer a project-level exclusion or an environment gate when the intent is “not in this run.” Prefer test.skip when the test itself is temporarily unavailable. In either case, make the reason visible.

Why common configuration changes do not disable assertions

Timeout set to zero

expect.toHaveScreenshot.timeout controls how long the matcher waits for the assertion to pass. A zero or very small value can produce a failure; it does not turn the matcher into a no-op. If the call executes, Playwright still attempts the comparison.

Diff tolerances

maxDiffPixels, maxDiffPixelRatio, and threshold relax the definition of an acceptable difference. They are appropriate for measured rendering noise, not for disabling coverage. An overly generous tolerance can allow a real regression through while still consuming time and producing comparison output.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

Animation handling

animations: 'allow' changes how animations are treated during capture. It does not suppress the screenshot assertion or its baseline comparison.

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

Snapshot paths and templates

snapshotPathTemplate and expect.toHaveScreenshot.pathTemplate change where expected images are stored. Moving a file does not stop the assertion from looking for and comparing a baseline at the new location.

Updating snapshots

npx playwright test --update-snapshots is a baseline-maintenance operation. It replaces expected images with the current output (subject to the command’s normal behavior); it does not skip the assertion. Use it only after reviewing why the rendering changed.

Choosing the right method

Method Scope Reversible Functional coverage Best use
Remove the assertion One assertion or test Manual Preserved if other checks remain Visual coverage is no longer part of the test’s purpose
Environment gate One or many assertions Yes Preserved in non-visual runs Different CI modes use the same test files
Project selection Entire visual project Yes Functional project remains independent Large suites with clearly separated visual tests
test.skip or conditional skip One test or condition Yes That test is absent from the run Temporary quarantine or environment-specific failure

Disable screenshot assertions in CI safely

  1. Decide whether the pause is temporary. If it is permanent, remove the assertion; otherwise choose a gate, project selection, or skip.
  2. Keep URL, role, text, state, and API assertions running so the job still checks application behavior.
  3. Make the disabled scope explicit in the CI command, such as --project=functional or the absence of PW_VISUAL=1.
  4. Record the reason, affected browsers or environments, and a re-enable condition in the change or issue tracker.
  5. Run a visual job separately before merging UI changes that could affect pixels.

Troubleshooting

“I removed the call, but the test still fails on a snapshot.”

Search the test and imported helpers for every toHaveScreenshot and toMatchSnapshot call. A fixture or helper may be making the assertion on your behalf. Also check that the failing test is not a different project or duplicate spec file.

“The assertion runs even though my variable is off.”

Log the value and check the exact string comparison. The example enables checks only when process.env.PW_VISUAL === '1'. CI variables can be inherited from a parent job, and values such as true or yes do not equal 1. Confirm which project and command the job actually ran.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

“The visual project is still selected.”

List the command-line projects in your CI configuration and remove --project=visual for the functional job. Verify the project’s testMatch and testIgnore patterns so a visual spec is not included accidentally.

“Can I make the timeout zero to skip CI work?”

No. A timeout changes waiting behavior and generally creates a fast failure. Gate or skip the assertion instead.

“Should I use update snapshots to get past a failure?”

Only when the new rendering is intentional and reviewed. Updating a baseline can hide an unintended UI change; it is not a disable switch.

“The assertion is flaky because of animations or dynamic content.”

First make the page deterministic: wait for the relevant state, control data, and use the documented screenshot options that address animation or tolerances. If the visual test cannot be stabilized immediately, quarantine it with a reason rather than silently removing all visual coverage.

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.

“A non-test script calls page.screenshot().”

That call captures an image but does not assert against a baseline. If the script itself should stop capturing, remove or gate the screenshot call separately; Playwright’s test assertion settings do not control arbitrary application code.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Capturing screenshots without maintaining Playwright baselines

If your goal is an artifact for documentation, monitoring, or an AI workflow rather than a pass/fail visual regression test, a screenshot API can avoid browser setup and baseline management. ScreenshotNeo is the first option to try: it removes consent banners, newsletter popups, and chat widgets before capture, bills only clean shots, and its lowest paid plan is $5.

Or skip the browser setup

One GET request returns a PNG, JPEG, WebP, or PDF. The API can accept the URL directly and is documented at https://screenshotneo.com/docs/.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo removes cookie banners, popups, and chat widgets before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and each response identifies the page and billing result in X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. You get 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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

Version and scope notes

The guidance here covers the Playwright JavaScript/TypeScript test-runner APIs described in the documentation current on September 29, 2026. Playwright may add options in later releases, so check the documentation bundled with your installed version before relying on a newly introduced setting. Regardless of version, the documented patterns above work by controlling whether the explicit assertion call executes.

Frequently Asked Questions

Is there a global Playwright setting named disableScreenshotAssertions?

No documented global switch exists. Prevent the assertion call from executing by removing, gating, skipping, or excluding its project.

Does page.screenshot() itself fail a test?

No. It only captures an image. A failure requires a comparison such as toHaveScreenshot() or toMatchSnapshot().

What is the least disruptive temporary option?

Use an environment gate or run a functional project that excludes visual tests, so the assertions remain available for a dedicated visual run.

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

Will changing maxDiffPixels disable visual regression testing?

No. It changes tolerance while the comparison still runs.

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.