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

Playwright has no documented global switch for disabling screenshot assertions. To turn them off, prevent the relevant assertion call from running: remove it, guard it with an environment or project condition, or skip the visual test or project. Settings that adjust screenshot timeouts, comparison tolerance, animation handling, or snapshot paths do not disable the comparison.

Which Playwright checks count as screenshot assertions?

Screenshot assertions compare a captured image with an expected snapshot. In Playwright’s JavaScript and TypeScript test runner, the common forms are page and locator assertions using toHaveScreenshot, and buffer snapshots using toMatchSnapshot. The Playwright documentation notes that screenshot assertions work with the Playwright test runner.

  • await expect(page).toHaveScreenshot('home.png') checks a page screenshot.
  • await expect(locator).toHaveScreenshot('component.png') checks a screenshot of a locator.
  • expect(await page.screenshot()).toMatchSnapshot('home.png') compares screenshot bytes with a snapshot.

Find the assertion call that is causing the visual comparison. The issue is not simply that a test takes or saves a screenshot: it is whether the test invokes a screenshot matcher. Removing a screenshot assertion does not require removing functional checks such as visibility, text, URL, or application-state assertions.

Remove one screenshot assertion and keep the rest of the test

If the test’s purpose no longer includes visual comparison, delete or comment out the matcher call. Keep the rest of the test intact if it still verifies user-visible behavior or application logic.

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

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

This is the simplest choice when the visual check is permanently out of scope. It also has the largest maintenance cost if you later want visual coverage again: someone must restore the assertion and make sure the expected snapshot is available. If you are pausing the check rather than retiring it, use a reversible gate or skip method instead.

Keep visual checks available, but gate when they run

An environment condition can leave a visual assertion in the test while letting functional runs omit it. Set the environment variable to 1 in a run that should include visual checks; leave it unset or set to another value for runs that should omit them.

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');
  }
});

The condition must control the matcher itself. Setting a screenshot tolerance or timeout does not substitute for this guard. Keep the variable name and its intended value visible in your CI configuration or test instructions so that a run’s visual coverage is understandable during review.

A project-level split is often easier to audit for a larger suite: keep visual tests in a named Playwright project, then select a run that excludes that project when you want functional tests only. The assertion remains in the visual project and can still run in a dedicated visual job. Use the actual project name and selection command from your Playwright configuration; a project split only helps if the tests are assigned to the intended project and the CI job selects the intended set.

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

Skip a visual test temporarily

When a visual test cannot run for a temporary reason, use Playwright’s regular skip mechanisms, such as test.skip, conditional test.describe, or project selection. Record why it is skipped and create a follow-up issue. A skip without a reason or owner can quietly become permanent and leave a visual coverage gap.

Choose the narrowest skip that matches the problem. Skip one test if only that test is affected; use a condition or project selection if a whole group should be absent from a particular run. If the functional assertions in the same test still matter, consider keeping them active and gating only the screenshot assertion rather than skipping the entire test.

Choose a method by scope and reversibility

Method Scope Reversibility Coverage effect Best fit
Remove the matcher call One assertion Requires restoring the code to re-enable Other test assertions can continue The test no longer needs visual comparison
Guard the matcher with an environment condition One or more guarded assertions Change the run condition Visual comparison runs only when enabled; unguarded checks can continue One test suite or CI job needs a reversible switch
Skip a test or describe group One test or a group Remove or change the skip Skipped tests do not run, including their other checks The visual test is temporarily unavailable as a whole
Select a non-visual project A configured project Select the visual project again Tests in the excluded project do not run in that run Functional and visual runs should be separate and auditable

For a temporary CI-only pause, a condition or project split generally preserves the visual test for a later run. For a permanent change, remove the assertion only after confirming that visual comparison is no longer part of the test’s purpose. If the test is skipped, make the reason and follow-up visible to the team.

What does not disable Playwright screenshot assertions?

Playwright’s screenshot matcher configuration changes how the assertion runs or how it compares images; it is not a documented global enable/disable control. The following changes still leave the screenshot check in place if the matcher call executes:

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.
  • expect.toHaveScreenshot.timeout controls how long the matcher waits. It is not an off switch.
  • maxDiffPixels, maxDiffPixelRatio, and threshold adjust comparison tolerance. A more permissive comparison is still a comparison.
  • animations: 'allow' changes animation handling; it does not suppress the assertion.
  • snapshotPathTemplate and expect.toHaveScreenshot.pathTemplate change where snapshots are stored, not whether a check runs.
  • npx playwright test --update-snapshots is for updating expected snapshots. It is a baseline-maintenance operation, not a way to skip the assertion.

The Playwright documentation describes matcher options and snapshot-path settings, but does not document a global disableScreenshotAssertions flag. If a setting appears to make a failure disappear, check whether the test still calls the matcher and whether it actually ran in the selected test or project.

Troubleshoot screenshot assertions that still run

“How do I disable expect(page).toHaveScreenshot()?”

Remove that call or put it behind a condition that is false in the run where you want it disabled. If it is inside a helper or shared test setup, find and gate the call at the point where the matcher executes. Changing snapshot filenames or tolerances will not stop it.

“Can I turn off Playwright visual regression tests?”

For a single check, guard the matcher. For a visual-only test, skip that test when appropriate. For a broader separation, put visual tests in a named project and run a project selection that excludes it. Confirm that the selection matches your configured project names; otherwise the visual tests may still be in the run.

“How do I skip screenshot assertions in CI?”

Use an explicit CI condition such as the PW_VISUAL gate above, or run only the configured non-visual project. Make the CI setting easy to inspect and ensure the dedicated visual job enables the check. If you skip an entire test rather than only its screenshot assertion, remember that its functional assertions will also be skipped.

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.

“Does setting the screenshot timeout to zero disable the check?”

No. The timeout controls waiting behavior; it is not a documented disable option. Prevent the matcher call from executing instead.

“I updated snapshots, but the assertion still runs. Why?”

--update-snapshots updates expected images; the test still contains and executes its assertion. Use a gate, skip, or project selection if the comparison should not run in that execution.

“I changed the tolerance, but the test is still failing.”

Tolerance settings affect the comparison rather than disabling it, and they may not address the cause of the difference. If visual comparison should remain part of the test, investigate the image difference; if it should not run in this job, gate the assertion or exclude the visual project.

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 your goal is to capture website images outside a Playwright test, ScreenshotNeo is a separate website screenshot API and MCP server for developers. It does not disable Playwright assertions or replace a visual-test policy; it offers a one-request way to obtain a screenshot or PDF without setting up a browser capture script. Its API accepts one GET request with a URL and can return PNG, JPEG, WebP, or PDF. The parameter names used by other screenshot APIs also work, which can make switching easier. See the ScreenshotNeo website and API documentation.

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

For example, using cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

For equivalent requests in Python and Node.js:

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}`);

Replace YOUR_API_KEY with your key and the example URL with the page you want to capture. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; an MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents; and the Free plan includes 1,000 screenshots per month with no card, while paid plans start at $5 for 3,000. These are separate capture-service features, not Playwright test controls.

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

Version and scope

The Playwright guidance here concerns the JavaScript and TypeScript test-runner APIs documented as current on September 29, 2026. API options can change; check the documentation for the Playwright version installed in your project before relying on a newly added option.

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.

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