Skip to content

Commit 9f36ce9

Browse files
JoshuaKGoldbergClaude Sonnet 4
andcommitted
fix(test): Fix flaky MetricsTabContent sidebar toggle test
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
1 parent d7f2bcd commit 9f36ce9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

static/app/views/explore/metrics/metricsTab.spec.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,5 +731,14 @@ describe('MetricsTabContent (tracemetrics-ui-refresh)', () => {
731731
await waitFor(() => {
732732
expect(screen.getAllByTestId('metric-toolbar')).toHaveLength(1);
733733
});
734+
735+
// Wait for the SearchQueryBuilderCombobox inside the re-expanded sidebar to
736+
// finish initialising, otherwise its async state updates fire after the test
737+
// ends and trigger an act() warning that jest-fail-on-console catches.
738+
await waitFor(() => {
739+
expect(
740+
within(screen.getAllByTestId('metric-toolbar')[0]!).getByRole('combobox')
741+
).toBeInTheDocument();
742+
});
734743
});
735744
});

0 commit comments

Comments
 (0)