feat(browser): data-image-type and data-visual-test-wait-bg-img stabilization helpers#334
Merged
Merged
Conversation
The pauseGifs stabilizer only recognized GIFs from their URL (a `.gif` extension or a `data:image/gif` URI), so GIFs served from extension-less URLs (e.g. a CDN endpoint) animated through the screenshot. Let authors opt an image in explicitly with `data-image-type="gif"`, which is the only reliable way to flag those cases without fetching and sniffing the bytes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ttribute The waitForBackgroundImages stabilizer was opt-in because a full-document `getComputedStyle` sweep is expensive. Instead, enable it by default but scope the scan to elements flagged with the `data-visual-test-wait-bg-img` attribute (and their descendants), keeping the sweep cheap while covering the common case out of the box. `waitForBackgroundImages: true` still widens the scan to the whole document, and a `selector` still overrides it. Since it was the only consumer, the now-unused `optIn` plugin mechanism is removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The pauseGifs cleanup restores `img.src`, which the browser resolves to an absolute URL, so the extension-less endpoint comes back as `file:///…/masked-gif-endpoint` rather than the literal relative string. Assert on the suffix instead of exact equality. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two ways for authors to opt individual elements into image stabilization when the SDK's automatic detection can't cover them.
data-image-type="gif"(pauseGifs)The
pauseGifsstabilizer only recognized GIFs from their URL (a.gifextension or adata:image/gifURI), so GIFs served from extension-less URLs (e.g. a CDN endpoint like/media/1234) kept animating through the screenshot. Authors can now flag those explicitly:This is the only reliable way to catch them without fetching and byte-sniffing every image.
data-visual-test-wait-bg-img+waitForBackgroundImageson by defaultwaitForBackgroundImageswas opt-in because a full-documentgetComputedStylesweep is expensive. It's now enabled by default, but scoped to elements flagged withdata-visual-test-wait-bg-img(and their descendants) — keeping the sweep cheap while covering the common case out of the box:waitForBackgroundImages: truestill widens the scan to the whole document.{ selector }still overrides the scan target.falsedisables it.Since it was the only consumer, the now-unused
optInplugin mechanism is removed.Tests
Playwright e2e coverage for both: a GIF served from an extension-less endpoint flagged with the attribute gets frozen to a PNG, and a
data-visual-test-wait-bg-imgelement blocks stabilization by default until its background image loads.Docs
Documented in argos-ci/docs#221 (should not merge before this ships).
🤖 Generated with Claude Code