test: stabilize range-mode popover tests against async render#410
Merged
tomasz-tomczyk merged 1 commit intomainfrom May 1, 2026
Merged
test: stabilize range-mode popover tests against async render#410tomasz-tomczyk merged 1 commit intomainfrom
tomasz-tomczyk merged 1 commit intomainfrom
Conversation
Stack popover renders a "Loading…" placeholder synchronously and re-renders .stack-popover-item only after /api/picker resolves (~2s). Tests that snapshotted DOM immediately after clicking the stack chip raced the re-render and surfaced as undefined labels in slower CI runners. - focus-picker.rangemode.spec.ts: wait for .stack-popover-item visibility before reading; replace evaluateAll snapshot with toHaveCount(4) auto-retry on the order test - stack-popover.rangemode.spec.ts: same wait gate for the two tests that read allTextContents / buttons.count() right after click Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #410 +/- ##
==========================================
+ Coverage 67.26% 67.31% +0.05%
==========================================
Files 26 26
Lines 9650 9650
==========================================
+ Hits 6491 6496 +5
+ Misses 2649 2646 -3
+ Partials 510 508 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Two range-mode e2e tests intermittently fail in CI with
expect(labels[0]).toMatch(/main/)receivingundefined— the assertion races the popover's async re-render. Surfaced on an unrelated PR (#409, pure git.go diff parsing).Root cause: the stack popover renders a synchronous "Loading…" placeholder, then re-renders
.stack-popover-itemnodes only after/api/pickerresolves (~2s on slower runners). Tests that snapshot the DOM viaevaluateAll/allTextContents/count()immediately after clicking#stackChipBtnsee the empty placeholder state.Fix: gate the DOM reads on
.stack-popover-itemvisibility before snapshotting. On the order assertion, replace the non-retryingevaluateAllsnapshot withtoHaveCount(4)so Playwright auto-retries until the popover settles.Files:
e2e/tests/focus-picker.rangemode.spec.ts— both failing tests (lines 29, 46)e2e/tests/stack-popover.rangemode.spec.ts— two tests with the same raceSweep of
e2e/tests/found no other instances: zerowaitForTimeout, zeronetworkidle-only waits, only oneevaluateAll(the failing one).Review
Test plan
npx playwright test focus-picker.rangemode.spec.ts stack-popover.rangemode.spec.ts --project=range-mode→ 17/17 pass locally🤖 Generated with Claude Code