fix: wait for images before photographing a story - #26
Merged
Merged
Conversation
Five of the six screenshots differed between two runs of the same build, one by 4,528 pixels, which made the browser check unable to say whether a change had moved anything. The run waited for the document and for fonts but never for an image. Three things had to be covered: a decode that had not finished, a frame the outer page does not own, since the manager preset shoots a story through an iframe, and a lazy image below the fold that never started loading at all — that last one is why a screenshot could come back with Buddy's portrait missing rather than half drawn. Eight runs now produce identical screenshots across 42 comparisons. A run costs about ten seconds.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe screenshot verification flow adds Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
This was referenced Sep 19, 2026
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.
Change
node .storybook/verify.mjscould not tell whether a change had moved anything, because its screenshots moved on their own. Five of the six differed between two runs of the same build —buddy-welcome-320by 4,528 pixels, which is the whole Buddy portrait present in one run and absent in the next.The run waited for the document (
waitUntil: "load") and for text (document.fonts.ready) but never for an image. Three separate causes had to be covered:currentSrcfirst was not enough — an image that has not started looks the same as one with nothing to load.So the wait now runs in every frame, promotes
loading="lazy"to eager, waits forloadorerror, then decodes. Each image is raced against a five-second timeout so a broken asset cannot hold a run open; reporting a broken image stays the job of the asset check.This is test infrastructure only. No product code changes.
Validation
just checkpasses (exit 0): lint, tests, type check, site build and Storybook build.Stability, measured by running the verifier repeatedly against one unchanged build and comparing every screenshot to the first run:
The fix settles on the correct state rather than a consistently wrong one: the portrait is present in the screenshots it now produces, which was checked by eye against the run where it was missing.
A run takes about ten seconds, and still reports 55 stories rendering with no page errors.
Two intermediate versions of this fix were measured and rejected as incomplete, which is how the frame and lazy-loading causes were found: waiting on the top document alone left
storybook-phone-reviewandbuddy-welcome-desktopmoving, and adding frames leftbuddy-welcome-320swinging by the full 4,528.No Changeset: the site is not a published package.