[Feature]: Skip PNG decode and diff when a screenshot matches its baseline byte for byte
メンテナーはふだん 1 日以内に返信
@microsoft-playwright-automation がすでに取り組んでいます。
2026年11月24日 から。
- #44336 @microsoft-playwright-automation による — オープン
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 100k
- フォーク
- 6.9k
- 平均マージ
- 16時間 18分
- マージ済み PR(30日)
- 281
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/playwright のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/playwright#44340 ·
メンテナーはふだん 1 日以内に返信
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)対応中かも @lazerg が 2 日前に担当しました。 オープンagent-triage-done
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/playwright#44289 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: expose per-project workers on FullProject for reporters対応中かも @microsoft-playwright-automation が今日担当しました。 オープンagent-triage-done
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/playwright#44264 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: Test runner captures and source-maps stacks that it never uses対応中かも @microsoft-playwright-automation が今日担当しました。 オープンagent-triage-done
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
microsoft/playwright#44334 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: `.resolves.not` and `.rejects.not` pass when a promise settles the wrong way対応中かも @microsoft-playwright-automation が今日担当しました。 オープンagent-triage-done
難易度 3/5 半日 初心者へのやさしさ 55/100
microsoft/playwright#44331 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/playwright の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
sindresorhus/eslint-plugin-unicorn#4045 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CreadorLanda/yo#316 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
awslabs/social-messaging-agent-runtime-toolkit#232 ·
メンテナーはふだん 3 日以内に返信
-
bug p2 platform:linux platform:macos platform:windows triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信