test(browser): leave no state behind for the next case

Await the form's explicit unmount: an unmount left running overlaps the
next render's act, and React then commits nothing for the rest of the
file. Return to the newest history entry after stepping back, so the
next case's push adds an entry instead of replacing the forward one.
This commit is contained in:
Marc-André Bombeck committed 2026-11-03 20:58:38 +01:00
1 parent 54d0647a6d
commit 4f7802ba28
2 files changed
+9 -1

No files matched your search

@@ -289,7 +289,10 @@ describe("<MeasurementForm> type", () => {
await first.screen.getByLabelText("Value (kg)").fill("80");
await first.save.click();
await expect.poll(() => first.onSuccess.mock.calls.length).toBe(1);
first.screen.unmount();
// Awaited: the unmount runs inside `act`, and one left running overlaps
// the next render's `act`, after which React commits nothing for the
// rest of the file (every later case finds an empty container).
await first.screen.unmount();
const { screen } = await mount();
await expect