maxDiffPixelRatio
A Playwright screenshot option giving the fraction of pixels, from 0 to 1, that may differ before the comparison fails.
In more detail
maxDiffPixelRatio: 0.01 allows 1% of pixels to change, absorbing tiny rendering noise such as subpixel anti-aliasing while still catching real layout changes. A related option, threshold, sets how different one pixel's colour must be to count.
Related terms
- Playwright — Microsoft's open-source tool for automating Chromium, Firefox and WebKit browsers, widely used for end-to-end and visual tests.
- anti-aliasing — Softening the jagged edges of text and shapes by drawing edge pixels in in-between shades.
- flaky test — A test that sometimes passes and sometimes fails on the same code, because it depends on something it does not control.
Taught in
- Visual Regression Testing: Playwright & Snapshot Differencing — Design Systems & Component Engineering