test(dashboard): eliminate race condition in FiltersConfigModal test#35717
Merged
sadpandajoe merged 1 commit intomasterfrom Oct 22, 2025
Merged
test(dashboard): eliminate race condition in FiltersConfigModal test#35717sadpandajoe merged 1 commit intomasterfrom
sadpandajoe merged 1 commit intomasterfrom
Conversation
The "validates the pre-filter value" test had a race condition that caused intermittent failures and required a 50-second timeout. **Root Cause:** - Test used synchronous `userEvent.click()` calls - Immediately called `jest.runOnlyPendingTimers()` (wrong method) - User interactions didn't complete before timer flush - Created race where validation timers might not execute **Fix:** - Await `userEvent.click()` calls (v12-compatible async approach) - Use `jest.runAllTimers()` instead of `runOnlyPendingTimers()` - Wrap timer manipulation in try/finally for cleanup - Add explicit `waitFor()` after restoring timers **Results:** - Test now passes consistently (3/3 runs) - Runs in ~25-29s vs 50s timeout - No regressions (16 passed, 2 skipped) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Contributor
|
🎪 Showtime deployed environment on GHA for cda7458 • Environment: http://52.27.129.129:8080 (admin/admin) |
aminghadersohi
approved these changes
Oct 22, 2025
eschutho
approved these changes
Oct 22, 2025
sadpandajoe
added a commit
that referenced
this pull request
Nov 7, 2025
- PropertiesModal.test.tsx: add await to 18+ userEvent calls - FiltersConfigModal.test.tsx: add await to 26 userEvent calls - Fix anti-pattern: remove userEvent from waitFor blocks - Fix cache_timeout test expectation to match API string type - Resolves race condition causing PropertiesModal test failures Root cause: Tests written in 2021 with synchronous userEvent pattern became problematic as components gained more async complexity. Recent changes (PR #33392) made race conditions consistently reproducible. Follows pattern from PR #35717, #35918, and DatasourceControl fixes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
9 tasks
sadpandajoe
added a commit
that referenced
this pull request
Nov 7, 2025
- PropertiesModal.test.tsx: add await to 18+ userEvent calls - FiltersConfigModal.test.tsx: add await to 26 userEvent calls - Fix anti-pattern: remove userEvent from waitFor blocks - Fix cache_timeout test expectation to match API string type - Resolves race condition causing PropertiesModal test failures Root cause: Tests written in 2021 with synchronous userEvent pattern became problematic as components gained more async complexity. Recent changes (PR #33392) made race conditions consistently reproducible. Follows pattern from PR #35717, #35918, and DatasourceControl fixes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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
Fixes a race condition in the "validates the pre-filter value" test that caused intermittent failures and required a 50-second timeout.
Root Cause:
The test used synchronous
userEvent.click()calls followed byjest.runOnlyPendingTimers(), creating a racecondition where:
Solution:
runAllTimers()executes (v12-compatible async approach)runAllTimers(): Changed fromrunOnlyPendingTimers()to execute ALL queued timers including debounced handlersBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION