[Feature]: Skip PNG decode and diff when a screenshot matches its baseline byte for byte
I maintainer di solito rispondono entro 1 giorno
@microsoft-playwright-automation ci sta già lavorando.
Dal 24/11/2026.
- #44336 di @microsoft-playwright-automation — aperta
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- performance, testing-qa
Direzione di ricerca
Start in packages/utils/comparators.ts at compareImages() and trace how toHaveScreenshot() calls it. Read the comparator unit tests and the existing implementation in PR #44325; this issue says that PR is ready and reopening it is the fastest path, so a newcomer should review rather than duplicate. Done means byte-equal buffers skip PNG decode, equal decoded pixels skip the diff, unknown comparator values still throw, and the screenshot comparator tests pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
compareImages() in packages/utils/comparators.ts decodes both images and runs the diff on every call, also when the two buffers are byte-equal. toHaveScreenshot() calls the comparator several times per assertion, and Chromium encodes the same pixels to the same bytes. Most matching assertions therefore decode two PNGs to find no difference.
This is the "do buffer comparison as a fast check before parsing png" item from https://github.com/microsoft/playwright/issues/27068#issuecomment-1741308597.
Measurements
Apple Silicon, Chromium headless shell, 1 worker, median of 5 alternating runs:
| Case | Now | With a byte-equal check |
|---|---|---|
| One compare, same bytes, 1280×720 PNG | 51.5 ms | 0.001 ms |
| One compare, same pixels, different encoding | 51.9 ms | 48.6 ms |
Suite: 30 tests, 120 matching toHaveScreenshot() |
10.39 s | 7.28 s |
Proposed approach
- In
compareImages(), return a match before decoding whenactualBuffer.equals(expectedBuffer). - After decoding, return a match before the diff when the sizes and pixel data are equal.
- Validate the
comparatoroption first, so an unknown comparator still throws.
Already implemented and tested in #44325, which was closed only to file this issue first. This is a small, low-risk performance fix with no behavior change. Reopening #44325 is the fastest path; it is ready for review.
- Lingua principale
- TypeScript
- Stelle
- 100k
- Fork
- 6.9k
- Merge medio
- 16h 18m
- PR unite (30g)
- 281
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/playwright
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/playwright#44340 ·
I maintainer di solito rispondono entro 1 giorno
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Forse già presa @lazerg l’ha presa 2 giorni fa. Apertaagent-triage-done
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
microsoft/playwright#44289 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: expose per-project workers on FullProject for reportersForse già presa @microsoft-playwright-automation l’ha presa oggi. Apertaagent-triage-done
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/playwright#44264 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: Test runner captures and source-maps stacks that it never usesForse già presa @microsoft-playwright-automation l’ha presa oggi. Apertaagent-triage-done
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
microsoft/playwright#44334 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `.resolves.not` and `.rejects.not` pass when a promise settles the wrong wayForse già presa @microsoft-playwright-automation l’ha presa oggi. Apertaagent-triage-done
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
microsoft/playwright#44331 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/playwright
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
primer/primitives#1426 ·
-
Sign-in-only setup dialog describes API-key verificationForse già presa @roboclaw-bot l’ha presa oggi. Apertaclawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
openclaw/openclaw#204323 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
virtue-initiative/virtue-initiative#953 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
fumicode/bublys-org#261 ·
I maintainer di solito rispondono entro 12 giorni