test(reconnecting): fix flaky rematch ready-card assertions - #1373
Merged
Conversation
The two "game over by conceded ... request rematch" tests asserted
`cy.get('[data-cy=lobby-ready-card]').should('be.visible')` with an
unscoped selector. That matches both the my- and opponent- rematch
indicators, but only the player who requested the rematch has a `.ready`
(face-up, visible) card — the other card-front is rotated away with
backface-visibility:hidden. Asserting be.visible on the 2-element set
only passed when Cypress happened to sample a transient window during
the flip transition, making the tests flaky (they began running in every
shard after #1140 removed skipOnGameStateApi).
Scope each assertion to the indicator that actually becomes ready and
check the stable `.ready` class on lobby-card-container -- the same
pattern the tests already use for their post-reload assertions.
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.
Problem
Two e2e tests in
tests/e2e/specs/in-game/reconnecting.spec.jsfail intermittently in CI:Dialogs persist after refreshing when game is over by conceded and opponent request rematchDialogs persist after refreshing when game is over by conceded and player request rematchFailure:
AssertionError: expected '[ <img.card-front>, 1 more... ]' to be 'visible'.Root cause
Both tests asserted:
lobby-ready-cardis the.card-front<img>inPlayerReadyIndicator.vue, which is only visible when its container has the.readyclass — otherwise it's rotatedy -180degwithbackface-visibility: hidden(flip redesign #852).The selector is unscoped, so it matches both the
my-rematch-indicatorandopponent-rematch-indicatorcards (GameOverDialog.vue). At that step only one player has requested a rematch, so only one card is.ready/visible. Assertingbe.visibleon the 2-element set only passed when Cypress happened to sample a transient window during the flip transition → flaky.These began running in every shard after #1140 removed
cy.skipOnGameStateApi()from the two tests.Fix
Scope each assertion to the indicator that actually becomes ready and check the stable
.readyclass onlobby-card-container— the exact pattern these same tests already use for their post-reload assertions (a few lines below each change).🤖 Generated with Claude Code