Repository navigation
Add element snapshots - #43
Merged
Merged
Conversation
brynary
added this pull request to stack #55
October 5, 2026 13:05
brynary
force-pushed
the
element-snapshots
branch
from
October 5, 2026 13:21
11a425a to
fd8e81b
Compare
SNAPSHOT name locator compares one element instead of the full page, as in SNAPSHOT cart testid:cart. The locator follows the name and takes prefixed segments only, like an ACT scope. It must match exactly one element and resolves again for every capture. Masks still resolve from the page, and percentages count the element's pixels. Playwright 1.62.1 resolves the element once per locator.screenshot() and throws when the page replaces it, so the shim retries detached, zero-size, and not-visible captures within the step timeout. After a stable mismatch, a capture that times out checks the target once without waiting: a missing or hidden target fails as a timeout instead of a mismatch on old pixels. The snapshot command carries a required target, so the shim protocol moves to 4. JSON and HTML reports record the target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test page replaced the snapshot target every 30 ms forever, so on the slower CI runners a capture never found a steady element within the step's 3 s. The page now stops replacing it after the first second, and the step gets 5 s: early captures still have to find the replaced target again, and a slow machine still gets a stable one in time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brynary
force-pushed
the
element-snapshots
branch
from
October 5, 2026 14:02
fd8e81b to
155ca09
Compare
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.
Stacked on #34. This branch was pushed earlier as the base of #35 without a PR of its own; this PR makes it reviewable.
SNAPSHOT name locatorcompares one element instead of the full page, as inSNAPSHOT cart testid:cart.ACTscope. It must match exactly one element, and Whirl resolves it again for every capture, scrolls it into view, and crops the image to it. Chains,nth:, and frames work.snapshot-max-diffpercentage counts the element's pixels.locator.screenshot()and throws when the page replaces it, so the shim retries detached, zero-size, and not-visible captures within the step timeout.--update-snapshotsafter adding or removing a locator.The last commit fixes a test that failed on every CI runner in this stack (#35–#42): the test page replaced the snapshot target every 30 ms forever, so on the slower runners a capture never found a steady element within the step's 3 s. The page now stops after the first second and the step gets 5 s; early captures still have to find the replaced target again.
Validation:
mise run check.🤖 Generated with Claude Code