Proposal: a noise-tolerant compare mode with pixelmatch 8's windowSize
Maintainer thường phản hồi trong vòng 1 ngày
@plum117 đang làm issue này rồi.
Từ ngày 9/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
@wswebcreation, this is a proposal for v11, and I would like your approval (or your changes) before any code is written.
Problem
Today a check counts all different pixels and compares the percentage with a tolerance. This mixes 2 different things:
- Noise: anti-aliasing, GPU dithering or font rendering change many single pixels all over the screenshot. The total can be larger than a small tolerance, so the check fails, and users increase the tolerance or use
ignoreAntialiasing. - A real change in a small area (an icon, a badge, a few letters) changes few pixels in total, so a tolerance can hide it.
What pixelmatch 8 gives us
Since #1289 we use pixelmatch 8. It has a new option: with windowSize: N, pixelmatch returns the highest number of different pixels in any N×N square instead of the total (README). Scattered noise never fills one small square; a real change usually does.
Measured with pixelmatch 8.0.0 on a 1366×768 image, threshold: 0.1:
| Change | Total (what we report today) | Max in one 16×16 window |
|---|---|---|
| A: 3 000 scattered single-pixel changes (like noise) | 3 000 px = 0.286 % | 6 |
| B: one missing 16×16 icon | 256 px = 0.024 % | 256 |
With a tolerance of 0.05 %, today A fails and B passes. With windows, A is clearly noise and B is clearly a change.
Proposal
A new, optional compare option. Nothing changes when it is not set.
await expect(browser).toMatchScreenSnapshot('home', {
windowSize: 16, // compare in 16×16 windows
})
When windowSize is set:
- The check returns the worst window as a percentage of the window area (6 / 256 = 2.3 % for A, 256 / 256 = 100 % for B). The existing tolerance semantics and matchers stay the same: "fail above X %", but X now means "of one window".
- One pixelmatch pass is enough: pixelmatch still writes the diff image, and we already read the different pixels from it for the diff bounding boxes.
- Ignore regions keep working: since #1301 they are a pixelmatch
ignoreMask, so masked pixels are not in any window. - The diff image does not change (all different pixels are still marked).
- With
returnAllCompareData, the result also has the total, so users can see both numbers.
Questions for you
- Do you agree with this feature for v11?
- Name and place:
windowSizeas a compare option (method and service level), like the other compare options? - Result: the worst window as a percentage of the window area (proposal above), or the pixel count (with a separate option for the limit)?
- Defaults: off by default (my proposal), or a recommended value in the docs (pixelmatch's example uses 16)?
- Reporter: show "worst window" next to the total in the visual reporter now, or later?
Scope
- In: the option in
@wdio/image-comparison-coreand@wdio/visual-service, unit tests, a local e2e check with known images, docs (compare options on webdriver.io), the v11 guide, a minor changeset. - Out (later): the reporter display, if you prefer to keep it separate.
- Ngôn ngữ chính
- TypeScript
- Star
- 156
- Fork
- 62
- Merge trung bình
- 2 giờ 2 phút
- Pull request đã merge (30 ngày)
- 111
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 webdriverio/visual-testing
-
bug: the visual service fails on Android Chrome through Appium 3 in the default WebDriver BiDi session (workaround: `wdio:enforceWebDriverClassic`)Có thể đã có người làm @plum117 đã nhận 4 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
webdriverio/visual-testing#1232 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feat: support element screenshots of elements in a frame in WebDriver BiDi sessions (v9 `switchFrame()`, v10 `context.frame()`)Có thể đã có người làm @plum117 đã nhận 4 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 50/100
webdriverio/visual-testing#1228 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Wait for Screenshot to MatchCó thể đã có người làm @plum117 đã nhận 3 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
webdriverio/visual-testing#690 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Using checkFullPageScreen method, capturing images with duplicate viewport and is not scrolling to the bottom of the pageCó thể đã có người làm @plum117 đã nhận 3 ngày trước. Đang mởhelp wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
webdriverio/visual-testing#125 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của webdriverio/visual-testing
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
high priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
CI-CMG/deep-sea-corals-exb#84 · 1 bình luận ·
-
Create/import wallet form shows raw "password must be at least 1 characters" instead of the translated messageCó thể đã có người làm @CapThunder19 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
joinmarket-webui/jam#1538 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
t0ggles
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
nolimits4web/swiper#8240 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày