Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ banner, your verdict, crops embedded) to attach to a ticket or publish as proof:
- **Refuses to start** unless both origins answer: two error pages would score ~100%.
- **Refuses a shot** with an HTTP status ≥ 400, or where both sides look blank.
- **Blocks analytics, consent and A/B tooling** at the network layer, on both sides.
- **Pins what varies between loads**: clock, `Math.random`, timezone, locale, colour scheme, reduced motion, video frames and video.js overlays.
- **Pins what varies between loads**: clock, `Math.random`, timezone, locale, colour scheme, reduced motion, animated image frames, video frames and video.js overlays.
- **Kills animation, transitions and caret blink**, and hides common consent banners and dev toolbars.
- **Settles the page**: lazy images, fonts and network idle before the shot.
- **Shoots until stable**, and excludes pixels still moving as `unstable`.
Expand Down
3 changes: 2 additions & 1 deletion docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ honestly. This is what renderdiff does to make sure of that.
`prefers-reduced-motion` are fixed, and videos are kept from playing (each shows its poster) with video.js captions and control bars hidden (`--no-freeze-video` opts out). A clock that shows
seconds can still tick between the two sides and may need a mask.
- **Kills animation, transitions and caret blink**, and hides common consent banners and
dev toolbars.
dev toolbars. Animated images (GIF, WebP, APNG) and SVG animations show their first frame;
it is a Blink setting, so cross-origin and CSS background images freeze too.
- **Settles the page** — makes native lazy images eager, scrolls every viewport-height
slice a frame at a time, to the bottom even as the page grows, so script lazy loaders fire, waits for every image to decode,
`document.fonts.ready` (at most 5s) and up to 3s for the network to go 250ms with nothing in flight
Expand Down
3 changes: 2 additions & 1 deletion skills/renderdiff/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ For scripts and drilling into one route; the loop doesn't need it. One result pe
- **Browser:** if the bundled Chromium won't launch, the system Chrome is used on both sides
and the run says so; otherwise it prints the `npx playwright install chromium` hint.
- **Pinned on both sides:** clock (one instant per run, floored to the minute), seeded
`Math.random`, UTC, en-US, light scheme, reduced motion; animations and transitions stilled.
`Math.random`, UTC, en-US, light scheme, reduced motion; animations and transitions stilled,
animated images and SVG animations held on their first frame.
A clock showing seconds can still tick between sides.
- **Pixel sensitivity:** pixelmatch threshold 0.05, anti-aliasing ignored. A half-pixel shift
(`translate(-50%)` landing on `.5`) shows as a thin region.
3 changes: 2 additions & 1 deletion src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ const neutralized = (meta: RunMeta) => `<details>
<p>Pinned on both sides: clock starts at <code>${esc(meta.clock)}</code> on every load, a seeded
<code>Math.random</code>, timezone <code>${CONTEXT_OPTIONS.timezoneId}</code>, locale
<code>${CONTEXT_OPTIONS.locale}</code>, <code>${CONTEXT_OPTIONS.colorScheme}</code> colour
scheme, reduced motion, CSS animations and transitions off${
scheme, reduced motion, CSS animations and transitions off, animated images and SVG animations held on their
first frame${
meta.freezeVideo ? ", videos kept from playing with video.js overlays hidden" : ""
}.</p>
<p>Unstable pixels — ones that changed between two shots of the same load — are painted
Expand Down
9 changes: 7 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,21 @@ const browserOf = (l: { browser: Browser; channel: string | null }) => ({
version: l.browser.version(),
});

// Replaces Playwright's own headless --blink-settings, so its hover/pointer values are repeated.
const ARGS = [
"--blink-settings=imageAnimationPolicy=2,primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4",
];

/**
* A missing browser binary is the likeliest first-run failure, so fall back to the system
* Chrome (both sides share it, so the comparison stays symmetric), then name the fix.
*/
async function launch() {
try {
return { browser: await chromium.launch(), channel: null };
return { browser: await chromium.launch({ args: ARGS }), channel: null };
} catch (e) {
try {
const browser = await chromium.launch({ channel: "chrome" });
const browser = await chromium.launch({ channel: "chrome", args: ARGS });
console.log(
`Bundled Chromium failed to launch; using the system Chrome ${browser.version()}.`,
);
Expand Down
7 changes: 4 additions & 3 deletions tests/fixtures/pages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ Breaking any of these produces a flaky suite, and the flake looks like a renderd
900px tall, so a block it inserts moves the bands instead of the height, and where the
page crosses 900px depends on the platform's monospace font. Make such a page taller
than 900px from fixed heights alone, as `inserted` does.
9. **No animation** except in `animated`, which exists to prove `STILL_CSS` kills it, `ticker`,
whose timer exists to be caught by the stability check, and `unsettled`, which recolours
the whole page to trip the unstable-pixel cap.
9. **No animation** except in `animated`, which exists to prove `STILL_CSS` and the
image-animation launch flag kill it, `ticker`, whose timer exists to be caught by the
stability check, and `unsettled`, which recolours the whole page to trip the
unstable-pixel cap.

## Adding a route

Expand Down
5 changes: 4 additions & 1 deletion tests/fixtures/pages/animated/left.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
below parity is if the animation is still running when the shot is taken — the rotation
angle at an arbitrary moment differs between two loads seconds apart.
The marker is deliberately off-centre and large: any residual rotation moves thousands of
pixels, not a handful. */
pixels, not a handful. The GIF and the SMIL fill must hold their first frame. */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { to { transform: translateX(640px); } }
@keyframes pulse { 50% { opacity: 0.1; } }
Expand Down Expand Up @@ -40,6 +40,8 @@
<h1>Motion guard rail</h1>
<p class="lede">Everything on this page moves. Both origins serve it identically, so a score below parity means motion survived into the screenshot.</p>

<img src="/shared/img/blink.gif" width="64" height="64" alt="">
<svg width="64" height="64"><rect width="64" height="64" fill="#1f6feb"><animate attributeName="fill" values="#1f6feb;#16202b" dur="0.9s" repeatCount="indefinite"/></rect></svg>
<div class="spinner"></div>
<div class="track"><div class="runner"></div></div>
<div class="track"><div class="runner"></div></div>
Expand All @@ -49,6 +51,7 @@ <h1>Motion guard rail</h1>
<section class="notes">
<h2>Notes</h2>
<p>A spinner at one and a tenth seconds per revolution is at an effectively arbitrary angle whenever the shot lands. Two captures taken seconds apart would disagree on almost every pixel inside the circle, which makes this the cheapest possible check that motion is actually being frozen rather than merely slowed.</p>
<p>The GIF cycles four frames and the SVG fill interpolates without pause, so any two shots of either disagree unless both hold their first frame.</p>
<p>The caret matters for the same reason and is easy to forget: a text cursor blinks on a timer of its own, independent of any CSS animation on the page.</p>
</section>
</div>
Expand Down
5 changes: 4 additions & 1 deletion tests/fixtures/pages/animated/right.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
below parity is if the animation is still running when the shot is taken — the rotation
angle at an arbitrary moment differs between two loads seconds apart.
The marker is deliberately off-centre and large: any residual rotation moves thousands of
pixels, not a handful. */
pixels, not a handful. The GIF and the SMIL fill must hold their first frame. */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { to { transform: translateX(640px); } }
@keyframes pulse { 50% { opacity: 0.1; } }
Expand Down Expand Up @@ -40,6 +40,8 @@
<h1>Motion guard rail</h1>
<p class="lede">Everything on this page moves. Both origins serve it identically, so a score below parity means motion survived into the screenshot.</p>

<img src="/shared/img/blink.gif" width="64" height="64" alt="">
<svg width="64" height="64"><rect width="64" height="64" fill="#1f6feb"><animate attributeName="fill" values="#1f6feb;#16202b" dur="0.9s" repeatCount="indefinite"/></rect></svg>
<div class="spinner"></div>
<div class="track"><div class="runner"></div></div>
<div class="track"><div class="runner"></div></div>
Expand All @@ -49,6 +51,7 @@ <h1>Motion guard rail</h1>
<section class="notes">
<h2>Notes</h2>
<p>A spinner at one and a tenth seconds per revolution is at an effectively arbitrary angle whenever the shot lands. Two captures taken seconds apart would disagree on almost every pixel inside the circle, which makes this the cheapest possible check that motion is actually being frozen rather than merely slowed.</p>
<p>The GIF cycles four frames and the SVG fill interpolates without pause, so any two shots of either disagree unless both hold their first frame.</p>
<p>The caret matters for the same reason and is easy to forget: a text cursor blinks on a timer of its own, independent of any CSS animation on the page.</p>
</section>
</div>
Expand Down
Binary file added tests/fixtures/shared/img/blink.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/helpers/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const CONTENT_TYPES: Record<string, string> = {
".js": "text/javascript; charset=utf-8",
".svg": "image/svg+xml",
".png": "image/png",
".gif": "image/gif",
".webm": "video/webm",
".html": "text/html; charset=utf-8",
".pdf": "application/pdf",
Expand Down
Loading