Commit cda7458
fix(dashboard): eliminate race condition in FiltersConfigModal test
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>1 parent de5ca79 commit cda7458
1 file changed
Lines changed: 12 additions & 10 deletions
File tree
- superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
340 | 342 | | |
341 | | - | |
| 343 | + | |
| 344 | + | |
342 | 345 | | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
348 | 350 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
| |||
0 commit comments