Skip to content

test(reconnecting): fix flaky rematch ready-card assertions - #1373

Merged
itsalaidbacklife merged 1 commit into
mainfrom
fix/flaky-rematch-ready-card-tests
Aug 10, 2026
Merged

test(reconnecting): fix flaky rematch ready-card assertions#1373
itsalaidbacklife merged 1 commit into
mainfrom
fix/flaky-rematch-ready-card-tests

Conversation

@itsalaidbacklife

Copy link
Copy Markdown
Contributor

Problem

Two e2e tests in tests/e2e/specs/in-game/reconnecting.spec.js fail intermittently in CI:

  • Dialogs persist after refreshing when game is over by conceded and opponent request rematch
  • Dialogs persist after refreshing when game is over by conceded and player request rematch

Failure: AssertionError: expected '[ <img.card-front>, 1 more... ]' to be 'visible'.

Root cause

Both tests asserted:

cy.get('[data-cy=lobby-ready-card]').should('be.visible');

lobby-ready-card is the .card-front <img> in PlayerReadyIndicator.vue, which is only visible when its container has the .ready class — otherwise it's rotated y -180deg with backface-visibility: hidden (flip redesign #852).

The selector is unscoped, so it matches both the my-rematch-indicator and opponent-rematch-indicator cards (GameOverDialog.vue). At that step only one player has requested a rematch, so only one card is .ready/visible. Asserting be.visible on 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 .ready class on lobby-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

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>
@itsalaidbacklife itsalaidbacklife added version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1) bug Something isn't working dev experience Improvements to the code base that make it easier/better/more enjoyable to contribute to Cuttle labels Aug 10, 2026
@itsalaidbacklife
itsalaidbacklife merged commit b3f7188 into main Aug 10, 2026
9 checks passed
@itsalaidbacklife
itsalaidbacklife deleted the fix/flaky-rematch-ready-card-tests branch August 10, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dev experience Improvements to the code base that make it easier/better/more enjoyable to contribute to Cuttle version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant