sincecutoff.com
← all changes

Playwright screenshots support WebP snapshots

Introduced 2026-07-24 · score 0.97

HOW TO USE IT

When storing visual comparison snapshots or standalone screenshots as WebP in Playwright v1.62.0, use a `.webp` snapshot name or screenshot path; for standalone screenshots, optionally set `type: 'webp'` and `quality` below 100 for lossy compression.

await expect(page).toHaveScreenshot('homepage.webp');
await expect(locator).toHaveScreenshot('image.webp');
await page.screenshot({ path: 'homepage.webp', quality: 50 });

WHY THIS HELPS

Store visual comparison snapshots or standalone screenshots as WebP in a test workflow.

REQUIREMENTS AND LIMITATIONS

  • Version: v1.62.0
  • name (required): Snapshot name; `.webp` selects WebP format. Both PNG and WebP snapshots are lossless.
  • path: Output file path; screenshot type is inferred from its extension. A `.webp` path selects WebP.
  • type: Screenshot type; accepts `png`, `jpeg`, or `webp`. Defaults to `png`.
  • quality: Image quality from 0 to 100. For WebP, 100 (default) is lossless; lower values use lossy compression.
  • Prerequisite: Screenshot assertions work only with the Playwright test runner.
  • Visual comparisons store the golden snapshot as lossless WebP.
  • Standalone screenshots can use lossy WebP; quality `100` is lossless by default and lower values use lossy compression.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card