diff --git a/src/components/measurements/__tests__/measurement-form.browser.test.tsx b/src/components/measurements/__tests__/measurement-form.browser.test.tsx index 10a5b9007..cd837a113 100644 --- a/src/components/measurements/__tests__/measurement-form.browser.test.tsx +++ b/src/components/measurements/__tests__/measurement-form.browser.test.tsx @@ -289,7 +289,10 @@ describe(" 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 diff --git a/src/hooks/__tests__/use-url-filter-sync.browser.test.tsx b/src/hooks/__tests__/use-url-filter-sync.browser.test.tsx index 6897b0b2e..deadc0e47 100644 --- a/src/hooks/__tests__/use-url-filter-sync.browser.test.tsx +++ b/src/hooks/__tests__/use-url-filter-sync.browser.test.tsx @@ -242,6 +242,11 @@ describe("useUrlFilterSync with FilterBar", () => { window.history.back(); await expectSearch("?type=WEIGHT"); await expect.element(pill("Type: Weight")).toBeInTheDocument(); + // Back to the newest entry. Left one step behind, the page keeps a + // forward entry, and the next case's push replaces it instead of adding + // one: `history.length` stays put and its count of entries is off by one. + window.history.forward(); + await expectSearch("?type=PULSE"); }); it("keeps the state in memory and the address untouched with syncToUrl off", async () => {