test(esports): scroll to an affordance before hovering it, not by pressing it - #972
Merged
Conversation
… by pressing it The board specs carried this fault and it cost two rounds of red CI on #971: a pencil is hidden until what it belongs to is hovered, a click scrolls its target into view first, and that scroll takes the element out from under the pointer, so the click loses the hover it needs and reports the pencil as not visible. Whether the scroll is needed at all depends on where the page is sitting, which is what made it come and go. The esports specs have the same shape in four places and have not flaked, which is luck: their bands are shorter and the target is usually already in view. Scrolling first, hovering second and pressing third costs nothing and is the order a hand makes. 48 pass across the three files in both projections.
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.
Follow-up to #971, which hit this fault twice in the board specs. The esports specs have the
same shape and haven't flaked yet.
The problem
An edit pencil is
visibility: hiddenuntil the thing it belongs to is hovered. Playwrightscrolls an element into view as part of clicking it, and that scroll event is delivered
asynchronously — so the scroll moves the element out from under the pointer, the hover is lost,
the pencil disappears, and the click fails on an element it had already resolved:
Whether the scroll happens at all depends on where the page is sitting, which is what makes it
intermittent. On #971 this cost two rounds of red CI, once as a hidden pencil and once as a tap
undone by its own scroll (stacked, a scroll releases a tap by design).
The change
Four helpers, one pattern: scroll, hover, assert the affordance is visible, then press.
esports-game-edit.spec.ts—openGameEditor, and the band's own per-game pencilesports-game-remove.spec.ts—openGameEditoresports-lineup-edit.spec.ts—openLineupAn element already in view has nothing to scroll, so on the paths that were passing this is a
no-op; it removes the dependence on luck.
Testing
48 pass across the three files in both projections (chromium and mobile-chrome). No production
code is touched.
The board-side equivalents landed with #971:
boards.spec.ts(pressing a seat),board-seat-edit.spec.ts(openSeat) andboard-edit.spec.ts(openEditor). With this,every helper in the suite that presses a hover-revealed affordance does it the same way.
Diff breakdown —
█added░removed, scaled to the largest row.