Skip to content

fix(test): stabilize flaky ResultsSearchQueryBuilder spec#111916

Merged
JoshuaKGoldberg merged 5 commits intomasterfrom
fix/flaky-results-search-query-builder-spec-v2
Apr 14, 2026
Merged

fix(test): stabilize flaky ResultsSearchQueryBuilder spec#111916
JoshuaKGoldberg merged 5 commits intomasterfrom
fix/flaky-results-search-query-builder-spec-v2

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 31, 2026

Applies a trio of strategies I've used in other flaky test cleanups:

  • Instead of broadly typing with userEvent.type, switches to calling userEvent.click to focus elements, screen.findByRole to wait until the listbox is populated, and then manually calling userEvent.keyboard to type. The granular events, each awaited, give more explicit waiting for async operations in-between each.
  • delay:null for userEvent.keyboard, to minimize the number of renders triggered by typing
  • After tests, waiting until the combobox role is found, to make sure async setup from the components is done.

Fixes ENG-7201

Made with Cursor

@JoshuaKGoldberg JoshuaKGoldberg added Scope: Frontend Automatically applied to PRs that change frontend components Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. labels Mar 31, 2026
@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(test): Fix flaky ResultsSearchQueryBuilder spec fix(test): stabilize flaky ResultsSearchQueryBuilder spec Mar 31, 2026
@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from fix/flaky-test-rerun-infra to master April 7, 2026 14:09
@JoshuaKGoldberg JoshuaKGoldberg added Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. and removed Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. labels Apr 7, 2026
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 8, 2026

Stabilize two flaky tests:

1. "does not show function tags in has: dropdown" — timed out at 5000ms
   because userEvent.type started typing before async API responses
   (feature flags, recent searches) had settled, causing re-renders
   mid-typing that slowed each keystroke. Split into click + findByRole
   (listbox) + keyboard to let initial renders complete before typing.

2. "shows normal tags in the dropdown" — act() warning from
   SearchQueryBuilderCombobox because pending state updates from API
   responses fired after test assertions completed. Add waitFor at end
   to flush pending React state updates before teardown.

Also add MockApiClient.clearMockResponses() in beforeEach to prevent
mock leakage between tests.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Made-with: Cursor
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the fix/flaky-results-search-query-builder-spec-v2 branch from 4423cc9 to d919935 Compare April 8, 2026 19:44
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review April 9, 2026 13:07
@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team as a code owner April 9, 2026 13:07
@JoshuaKGoldberg JoshuaKGoldberg requested review from a team and narsaynorath April 9, 2026 13:08
@JoshuaKGoldberg JoshuaKGoldberg merged commit 3d880ff into master Apr 14, 2026
67 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the fix/flaky-results-search-query-builder-spec-v2 branch April 14, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants