[Feature]: Skip PNG decode and diff when a screenshot matches its baseline byte for byte
Maintainer thường phản hồi trong vòng 1 ngày
@microsoft-playwright-automation đang làm issue này rồi.
Từ ngày 24/11/2026.
- #44336 của @microsoft-playwright-automation — đang mở
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- performance, testing-qa
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 100k
- Fork
- 6.9k
- Merge trung bình
- 16 giờ 18 phút
- Pull request đã merge (30 ngày)
- 281
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/playwright
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/playwright#44340 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Có thể đã có người làm @lazerg đã nhận 2 ngày trước. Đang mởagent-triage-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
microsoft/playwright#44289 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature]: expose per-project workers on FullProject for reportersCó thể đã có người làm @microsoft-playwright-automation đã nhận hôm nay. Đang mởagent-triage-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/playwright#44264 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature]: Test runner captures and source-maps stacks that it never usesCó thể đã có người làm @microsoft-playwright-automation đã nhận hôm nay. Đang mởagent-triage-done
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
microsoft/playwright#44334 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: `.resolves.not` and `.rejects.not` pass when a promise settles the wrong wayCó thể đã có người làm @microsoft-playwright-automation đã nhận hôm nay. Đang mởagent-triage-done
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 55/100
microsoft/playwright#44331 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/playwright
Issue tương tự
-
chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
drydocs/meridian#1503 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
refactor review: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
1lck/Lithe-IDEA#2376 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug extension mcp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
primer/primitives#1426 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
danielmiessler/LifeOS#2941 ·
Maintainer thường phản hồi trong vòng 4 ngày