[Feature]: Support compression effort option for WebP screenshots and visual regression
Maintainers usually reply within 1 day
@yury-s is already working on this.
Since Oct 5, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript, wasm
- Domain
- testing-qa
Research direction
Start by tracing WebP encoding for page.screenshot(), locator.screenshot(), and expect(page).toHaveScreenshot(), including the playwright.config.ts expect settings and bundled libwebp WASM module. Done means all listed APIs accept an integer effort from 0 to 6 with a default of 0, and lossless screenshots remain pixel-identical while supporting the requested compression setting.
Written by the indexing model from the issue text.
Description
🚀 Feature Request
Add an effort option (integer from 0 to 6, defaulting to 0) for WebP screenshots across:
-
page.screenshot() -
locator.screenshot() -
expect(page).toHaveScreenshot()- Per assertion
- Via
playwright.config.ts
Example
playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
expect: {
toHaveScreenshot: {
type: 'webp',
effort: 4, // Baseline snapshots encoded with method 4
},
},
});
Per screenshot / assertion
// Direct screenshot
await page.screenshot({
path: 'snapshot.webp',
type: 'webp',
effort: 6,
});
// Visual regression
await expect(page).toHaveScreenshot('landing.webp', {
effort: 4,
});
Motivation
WebP is already supported in Playwright for both direct screenshots and visual regression snapshots (toHaveScreenshot()). Lossless WebP snapshots can provide 20–30%+ file size reductions compared to PNG.
In libwebp, the compression effort (method, range 0–6) controls how intensively the encoder searches for spatial and entropy redundancies.
Because the compression is strictly lossless:
effort: 0andeffort: 6produce 100% pixel-identical RGBA buffers.effort: 0encodes quickly with minimal CPU usage, making it suitable for test-run screenshots and comparisons.effort: 4–6can significantly reduce file size, making it suitable for baseline/golden files committed to Git repositories.
Currently, Playwright's bundled libwebp WASM module does not expose the method parameter.
Adding this option would allow users to:
- Store smaller WebP baseline snapshots in their repositories and reduce repository bloat.
- Keep CI runs fast by generating comparison screenshots with
effort: 0while validating against high-effort baselines with zero pixel difference.
- Dominant language
- TypeScript
- Stars
- 100k
- Forks
- 6.9k
- Avg merge
- 16h 8m
- Merged PRs (30d)
- 281
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/playwright
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/playwright#44289 ·
Maintainers usually reply within 1 day
-
agent-triage-done
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/playwright#44264 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
microsoft/playwright#44290 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
microsoft/playwright#44288 ·
Maintainers usually reply within 1 day
-
[Bug]: page.goto never returns for a load started as a newer service worker takes over (Chromium)Open
Difficulty 5/5 Over a week Newbie friendliness 12/100
microsoft/playwright#44287 ·
Maintainers usually reply within 1 day
All issues in microsoft/playwright
Similar issues
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openclaw/openclaw#203385 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nwverse/persona#12800 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 Half a day Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
WISE-Community/WISE-Client#2404 ·
Maintainers usually reply within 1 day