Flaky frontend test: SheetHot "sets the temporary hit points when the number is left" #1017

Closed
opened 2026-10-01 23:02:15 +00:00 by claude-bot · 1 comment
Collaborator

Seen once, on PR #1016 (a backend-only change): run https://git.rhoving.com/rbrooks/Quest-Board/actions/runs/1771, job CI / Frontend (shard 1/2).

src/pages/sheet/SheetHot.test.jsx > hit points at the table > sets the temporary hit points when the number is left
AssertionError: expected "vi.fn()" to be called with arguments: [ 'campaign-1', …(2) ]
Number of calls: 0
 128|     fireEvent.change(temp, { target: { value: "5" } });
 129|     fireEvent.blur(temp);
 130|     expect(sheets.postSheetResources).toHaveBeenCalledWith("campaign-1…

Shard total: 1 failed, 2099 passed. The same test passed on main, on every other PR today and in five local full runs.

Likely cause (not confirmed). The test finds the "Temporary hit points" input as soon as it appears, changes it and blurs it with fireEvent, and asserts in the same tick. If the sheet re-renders between findByRole and the events (the page settling after its load), the input the test holds can be replaced, or the blur handler can read the value from before the change, and no call is made. The neighbouring tests use userEvent and waitFor.

To do. Reproduce under load (run the file in a loop with the CPU busy), then make the test wait for the page to settle and assert with waitFor, or fix the component if the blur really can lose a typed value: that would be a product bug at the table (a typed temp HP that doesn't save), so check which it is before changing only the test.

Seen once, on PR #1016 (a backend-only change): run https://git.rhoving.com/rbrooks/Quest-Board/actions/runs/1771, job **CI / Frontend (shard 1/2)**. ``` src/pages/sheet/SheetHot.test.jsx > hit points at the table > sets the temporary hit points when the number is left AssertionError: expected "vi.fn()" to be called with arguments: [ 'campaign-1', …(2) ] Number of calls: 0 128| fireEvent.change(temp, { target: { value: "5" } }); 129| fireEvent.blur(temp); 130| expect(sheets.postSheetResources).toHaveBeenCalledWith("campaign-1… ``` Shard total: 1 failed, 2099 passed. The same test passed on main, on every other PR today and in five local full runs. **Likely cause (not confirmed).** The test finds the "Temporary hit points" input as soon as it appears, changes it and blurs it with `fireEvent`, and asserts in the same tick. If the sheet re-renders between `findByRole` and the events (the page settling after its load), the input the test holds can be replaced, or the blur handler can read the value from before the change, and no call is made. The neighbouring tests use `userEvent` and `waitFor`. **To do.** Reproduce under load (run the file in a loop with the CPU busy), then make the test wait for the page to settle and assert with `waitFor`, or fix the component if the blur really can lose a typed value: that would be a product bug at the table (a typed temp HP that doesn't save), so check which it is before changing only the test.
Author
Collaborator

Fixed in PR #1028, merged to main as 9ce5863a. The sheet's temp HP input (HotBits.jsx) no longer races its own effect, which is what made the SheetHot test intermittent on a busy runner. Full vitest 3710 green locally and both frontend shards green in CI.

Fixed in PR #1028, merged to main as 9ce5863a. The sheet's temp HP input (`HotBits.jsx`) no longer races its own effect, which is what made the SheetHot test intermittent on a busy runner. Full vitest 3710 green locally and both frontend shards green in CI.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#1017
No description provided.