A button that passes every check and still hides
A checkout button can satisfy every functional assertion on the page and remain invisible to a person using it. Chromatic's own documentation describes the case: a CSS bug pushes the button behind a notification banner, and the functional test still reports it as clickable, because technically it is. Functional tests verify logic and behaviour; they do not read rendered pixels. The gap between "the handler fired" and "the control was actually on screen" is where screenshot comparison earns its place. That example is a vendor illustration, not a measured defect rate, and keeping the distinction in view prevents a statistic that was never collected from being invented.
What a pixel comparison actually asserts
Playwright's expect(page).toHaveScreenshot() establishes a reference image on its first run. The method captures several screenshots in a row and only saves the last one once two consecutive captures agree; later runs diff against that reference. Updating it is explicit through --update-snapshots. Under the hood the comparison uses pixelmatch, and two numbers do most of the arguing. threshold is the acceptable per-pixel colour difference in the YIQ colour space, running from 0 (strict) to 1 (loose), with a default of 0.2. maxDiffPixels and maxDiffPixelRatio are unset by default.
That default of 0.2 is regularly misread as zero tolerance. It is a perceptual colour-difference allowance, so small shifts in anti-aliasing or font rasterisation pass straight through it. Equally, "unset" for maxDiffPixels does not mean a cap of zero; it means no cap is applied unless a team sets one. These are Playwright's documented defaults (current docs, fetched 2026-11-22; the API is marked Added in v1.23), not constants of the technique. A threshold is a team decision with a cost on both sides, not a switch that makes a suite strict.
| Setting | Playwright default | Noise it contains |
|---|---|---|
threshold | 0.2, YIQ colour space | minor per-pixel colour drift; a looser value also hides small real changes |
maxDiffPixels / maxDiffPixelRatio | unset | no fixed ceiling on the count of differing pixels |
animations | "disabled" | finite animations fast-forwarded, infinite ones cancelled |
caret / scale | "hide" / "css" | blinking text cursor; one pixel per CSS pixel |
| baseline name suffix | e.g. chromium-darwin | ties the reference to one browser and platform |
The baseline belongs to a browser and a platform
Same code, different image — the usual cause is the environment, not the commit. Browser rendering shifts with the host operating system, its version and settings, the hardware, whether the machine is on battery or on the power adapter, and whether the run is headless. Playwright encodes this in snapshot names such as chromium-darwin, a suffix that states plainly that a reference captured in one browser and platform is not valid in another. Fonts and device pixel ratio alone make cross-environment comparison noisy, so each browser and platform keeps its own baseline.
Device pixel ratio and scale are two separate dimensions and get tangled together constantly. scale="css" produces one pixel per CSS pixel; switching to scale="device" produces one per device pixel, which can make a high-density screenshot twice as large or more. That is a change in image geometry, not a reason to double threshold. Treating the two as one knob produces thresholds that no longer mean what the documentation says.
Dynamic content needs containment rather than repetition. Playwright offers mask to cover a locator's bounding box in pink (#FF00FF, added in v1.35), stylePath to inject a stylesheet that hides volatile elements and reaches into shadow DOM and nested frames (added in v1.41), moving the pointer to (-1,-1) before capture so a hover state does not linger, and simply waiting for the view to settle. The point of these controls is to make one capture deterministic. Rerunning an unstable screenshot until it goes green does not stabilise the image; it picks a frame that happens to match and trains a team to mistrust the suite.
Where the honest boundary sits
Three limits are worth stating plainly. First, the defaults above belong to Playwright; another tool may hide the caret, freeze animations or name its baselines differently, and none of these should be presented as universal defaults. Second, relaxing a tolerance buys fewer false alarms at the price of letting genuine small regressions through, and Chromatic's own claims about reducing flake are vendor self-reporting rather than an independent evaluation. Third, cumulative layout shift (CLS) is a field metric drawn from real user sessions, measuring the layout instability people actually encounter; it is not a screenshot diff. A visual regression run happens in a controlled environment, and neither number substitutes for the other. Writing "visual regression reduced CLS" collapses two measurement systems into a causal claim the data does not support.
A pixel difference only says that the image changed; it does not say that a business rule is wrong. Merging the two produces the untenable claim that visual regression guarantees functional correctness. Functional assertions and pixel diffs divide work between them, and neither absorbs the other's blind spot.
Where the shared runtime fits
A shared runtime and an open catalog change where a visual check can be reused, not what it proves. Component-level visual tests sit close to development: isolate a component's states in stories, render them and diff each one, which is fast and cheap to triage. End-to-end screenshots drive a real flow and capture the assembled page, closer to the user path but noisier and slower. In the branching model a baseline is the last accepted snapshot for a given branch and mode, updated only after a person accepts it, with branches maintained separately — so a stale baseline on one branch manufactures false positives that look like real regressions.
For a product spanning host surfaces, the useful move is to keep one component's visual contract stable and reuse it wherever the component is mounted, rather than re-deriving an appearance baseline per surface. That is a mechanism for containing repetition. There are no first-hand mini-program screenshot thresholds, baseline counts or defect-reduction figures behind it, and inventing any of them would repeat the exact category error this article has been picking apart.