[Feature]: Skip PNG decode and diff when a screenshot matches its baseline byte for byte
Los mantenedores suelen responder en 1 día
@microsoft-playwright-automation ya está trabajando en esto.
Desde el 24/11/2026.
- #44336 de @microsoft-playwright-automation — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- performance, testing-qa
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 100k
- Forks
- 6.9k
- Merge medio
- 16 h 18 min
- PR fusionados (30 d)
- 281
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/playwright
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microsoft/playwright#44340 ·
Los mantenedores suelen responder en 1 día
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Posiblemente ocupada @lazerg la tomó hace 2 días. Abiertoagent-triage-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
microsoft/playwright#44289 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Feature]: expose per-project workers on FullProject for reportersPosiblemente ocupada @microsoft-playwright-automation la tomó hoy. Abiertoagent-triage-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/playwright#44264 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Feature]: Test runner captures and source-maps stacks that it never usesPosiblemente ocupada @microsoft-playwright-automation la tomó hoy. Abiertoagent-triage-done
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
microsoft/playwright#44334 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Bug]: `.resolves.not` and `.rejects.not` pass when a promise settles the wrong wayPosiblemente ocupada @microsoft-playwright-automation la tomó hoy. Abiertoagent-triage-done
Dificultad 3/5 Medio día Aptitud para principiantes 55/100
microsoft/playwright#44331 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/playwright
Issues similares
-
chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
drydocs/meridian#1503 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
refactor review: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
1lck/Lithe-IDEA#2376 ·
Los mantenedores suelen responder en 1 día
-
bug extension mcp
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
primer/primitives#1426 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
danielmiessler/LifeOS#2941 ·
Los mantenedores suelen responder en 4 días