Repository navigation
Fix flaky SkillsScreen verdict-count assertions (#2941) - #2952
Merged
Merged
Conversation
…dict tests (#2941) findAllByText resolves on the first match, so a length assertion on it races the remaining matches. Wrap each findAllBy + toHaveLength(n > 1) pair in waitFor over getAllBy, per #1596's awaited-condition remedy. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the test-only change to wait for expected match counts.
No open issues 🎉
What changed in this PR
Fixes the SkillsScreen test race reported in #2941 by waiting for the expected number of matches, rather than asserting immediately after the first match appears.
Changes:
- Converts five
findAllByTextcount assertions towaitForwithgetAllByText. - Preserves expected counts without increasing timeouts or changing production code.
| File | Description |
|---|---|
clients/web/src/components/screens/SkillsScreen/SkillsScreen.test.tsx |
Waits for complete verdict and error-message counts before proceeding. |
Review effort: Balanced
Member
Author
|
Copilot review loop closed: round 1 was clean (no inline comments, no headline findings, no suppressed comments). |
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.
Closes #2941
What changed
findAllByTextresolves as soon as at least one match exists, soexpect(await screen.findAllByText(x)).toHaveLength(n)withn > 1races the remaining matches — the failure seen on #2940's CIbuildjob (expected [ <span> ] to have a length of 2 but got 1).Each such pair in
SkillsScreen.test.tsxnow waits for the asserted condition itself:That's the awaited-condition remedy #1596 prescribes, not added headroom. The issue named one test; the same shape appeared at five sites in the file (3×
verified,Could not read file,plain string), and all five are converted. No production code changes.Verification
SkillsScreen.test.tsx: 114/114 passnpm run local:gate: green🤖 Generated with Claude Code