Skip to content

fix(test): Fix flaky MetricsTabContent sidebar toggle test#111847

Closed
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
fix/flaky-metrics-tab-spec-v2
Closed

fix(test): Fix flaky MetricsTabContent sidebar toggle test#111847
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
fix/flaky-metrics-tab-spec-v2

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

Wait for the SearchQueryBuilderCombobox inside the re-expanded sidebar to finish initialising. Without this, its async state updates fire after the test ends and trigger an act() warning that jest-fail-on-console catches, causing flaky failures.

The test toggles the query builder sidebar with the expand control collapses and re-expands the sidebar, but only waited for the toolbar testId to reappear. The SearchQueryBuilderCombobox inside the toolbar was still running async initialisation, so its state updates leaked past the test boundary. Adding a waitFor on the combobox role inside the toolbar ensures all updates have settled before the test completes.

This test failed 4 times on master in the last 30 days.

Made with Cursor

Wait for the SearchQueryBuilderCombobox inside the re-expanded sidebar
to finish initialising. Without this, its async state updates fire after
the test ends and trigger an act() warning that jest-fail-on-console
catches, causing flaky failures (4 occurrences in the last 30 days).

Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
Made-with: Cursor
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 30, 2026
@JoshuaKGoldberg JoshuaKGoldberg deleted the fix/flaky-metrics-tab-spec-v2 branch March 31, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant