Repository navigation
Document ending a hook by waiting for the state it opened - #109
Merged
Merged
Conversation
A click that lands but does nothing shoots the closed state on both sides, and they match. A hook that ends with locator.waitFor turns that into a route error naming the side, through the existing hook-error path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
A
beforehook whose click lands but does nothing (before hydration, or on the wrong element) shoots the closed state on both sides, and they match. Nothing about it looks wrong.This adds no
expectroute field. A hook that throws is already a route error naming the side and hook (before hook failed on left: …), and it is never retried. So ending the hook withawait page.locator(sel).waitFor({ timeout: 5_000 })already gives "state not reached". The only gap anexpectchecked at shot time would close is state that the settle's scroll pass undoes after abeforehook.beforeShotalready covers that: open and assert there, and nothing runs between the assertion and the shot. A new key would add validation, dedupe, cache-key and error-path code for a single Playwright line, and it would only handle selector assertions.Changes:
docs/scoping.md: the menu route example now ends withwaitFor. A new paragraph says when to guard (optional things like a cookie banner) and when not to (the state under test). It also notes thatwaitForis strict (use a unique selector or.first()), shows what a miss looks like, and says to move tobeforeShotwhen the scroll pass could undo the state.skills/renderdiff/reference.md: the hooks bullet gets thewaitForline, and thebefore hook failederrors row explains whatlocator.waitFor: Timeoutmeans.skills/renderdiff/SKILL.md: the open-menus note points to a hook that ends waiting for the open state.Verification:
npm run format:checkandnpm testpass (360/360). Nothing undersrc/changed, so I skipped the visual tier.Fixes #103
🤖 Generated with Claude Code