diff --git a/README.md b/README.md index f185bac..3fc6e01 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/docs/how-it-works.md b/docs/how-it-works.md index c28633f..2e348f6 100644 --- a/docs/how-it-works.md +++ b/docs/how-it-works.md @@ -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 diff --git a/skills/renderdiff/reference.md b/skills/renderdiff/reference.md index 7704c77..b96a73e 100644 --- a/skills/renderdiff/reference.md +++ b/skills/renderdiff/reference.md @@ -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. diff --git a/src/report.ts b/src/report.ts index 01c2d9c..9c84d5e 100644 --- a/src/report.ts +++ b/src/report.ts @@ -469,7 +469,8 @@ const neutralized = (meta: RunMeta) => `

Pinned on both sides: clock starts at ${esc(meta.clock)} on every load, a seeded Math.random, timezone ${CONTEXT_OPTIONS.timezoneId}, locale ${CONTEXT_OPTIONS.locale}, ${CONTEXT_OPTIONS.colorScheme} 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" : "" }.

Unstable pixels — ones that changed between two shots of the same load — are painted diff --git a/src/run.ts b/src/run.ts index 5b63df2..9e4f04c 100644 --- a/src/run.ts +++ b/src/run.ts @@ -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()}.`, ); diff --git a/tests/fixtures/pages/README.md b/tests/fixtures/pages/README.md index c7febd0..8354436 100644 --- a/tests/fixtures/pages/README.md +++ b/tests/fixtures/pages/README.md @@ -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 diff --git a/tests/fixtures/pages/animated/left.html b/tests/fixtures/pages/animated/left.html index 50406f3..06231b9 100644 --- a/tests/fixtures/pages/animated/left.html +++ b/tests/fixtures/pages/animated/left.html @@ -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; } } @@ -40,6 +40,8 @@

Motion guard rail

Everything on this page moves. Both origins serve it identically, so a score below parity means motion survived into the screenshot.

+ +
@@ -49,6 +51,7 @@

Motion guard rail

Notes

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.

+

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.

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.

diff --git a/tests/fixtures/pages/animated/right.html b/tests/fixtures/pages/animated/right.html index 50406f3..06231b9 100644 --- a/tests/fixtures/pages/animated/right.html +++ b/tests/fixtures/pages/animated/right.html @@ -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; } } @@ -40,6 +40,8 @@

Motion guard rail

Everything on this page moves. Both origins serve it identically, so a score below parity means motion survived into the screenshot.

+ +
@@ -49,6 +51,7 @@

Motion guard rail

Notes

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.

+

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.

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.

diff --git a/tests/fixtures/shared/img/blink.gif b/tests/fixtures/shared/img/blink.gif new file mode 100644 index 0000000..e97f093 Binary files /dev/null and b/tests/fixtures/shared/img/blink.gif differ diff --git a/tests/helpers/server.ts b/tests/helpers/server.ts index c220693..830e687 100644 --- a/tests/helpers/server.ts +++ b/tests/helpers/server.ts @@ -33,6 +33,7 @@ const CONTENT_TYPES: Record = { ".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",