test(next-js): fix flaky deleteIndex test race
Closed
JU
9d ago+9+9+0123456789-4-4-0123456789
Summary
next-js-testfailed on #549 (an unrelated workflow-only change). The failing test wasdeleteIndex > shows an error message when deleting the index fails. At failure time, the button's accessible name wasDeleting Index.- Cause:
deleteIndexruns in an asyncuseTransition. The state updates after theawaitcommit beforeisPendingclears. That leaves one render where the error or idle UI is visible while the button still reads "Deleting Index" and Build is still disabled. The two delete tests asserted right after the firstwaitForpassed, so they could land on that render. - Fix: both tests now wait for the delete button label to settle before asserting. This is a test-only change. The component is unchanged.
Test plan
- Reproduced on the unchanged branch: 3 of 12 full-file runs failed when 12 ran in parallel. Both delete tests hit the race.
- With the fix: 36 of 36 full-file runs passed when run in batches of 12 in parallel.
-
eslint app/page.test.tsx: no new warnings.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Tests
- Updated deletion tests to wait for the expected post-deletion state and verify that deletion errors appear alongside an enabled Delete Index button.