Commit f98d915
test: fix race condition in language switcher helper (#15206)
## Summary
Fixes a flaky i18n test that was failing in CI due to a race condition
after language changes.
The `setUserLanguage()` helper function had a race condition where:
1. Language dropdown selection triggered `switchLanguage()`
2. `switchLanguage()` called a server action and triggered
`router.refresh()` (not awaited)
3. Tests navigated to the next page before `router.refresh()` completed
4. Result: New page loaded with old language in slower CI environments
**The fix** waits for two deterministic events before continuing:
1. Server action POST request completion (confirms language cookie is
set)
2. Field label update (confirms `router.refresh()` has re-rendered the
page)
Also added `.claude/skills/triage-ci-flake` skill with systematic
workflow for triaging and fixing flaky CI tests.
## Test plan
- [x] All 7 tests in i18n suite pass locally
- [x] Tested with production build (bundled code)
- [x] Ran 5 consecutive times with 100% pass rate (35/35 tests passed)
- [x] No flakiness observed
Co-authored-by: Claude Sonnet 4.5 <[email protected]>1 parent d3b12a1 commit f98d915
File tree
2 files changed
+434
-0
lines changed- .claude/skills/triage-ci-flake
- test/i18n
2 files changed
+434
-0
lines changed
0 commit comments