From 1b98fc083644b446c3b007e3c074cdf51566d642 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Sat, 5 Dec 2026 08:39:17 +0000 Subject: [PATCH] test(local): Wait for the event URL before going Back "the default pick does not go stale outside Events" flaked on fast runners. nuqs writes the URL at most once per 50ms. Opening Events writes it, so when the POST /first click came within 50ms of that write, the ?event= history entry was still queued when the test called history.back(). Back then left the wrong entry and the queued push landed after it, so the detail stayed on POST /first. Wait for the event to reach the URL before going Back, the same way the other Back tests in this file do. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com> --- apps/local/src/App.integration.test.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/local/src/App.integration.test.tsx b/apps/local/src/App.integration.test.tsx index e6a777463..0222fad01 100644 --- a/apps/local/src/App.integration.test.tsx +++ b/apps/local/src/App.integration.test.tsx @@ -2988,6 +2988,13 @@ describe("local receiver to viewer integration", () => { expect(detail()).toContain("POST /second"); fireEvent.click(screen.getByLabelText("View event: POST /first")); await waitFor(() => expect(detail()).toContain("POST /first")); + // nuqs writes the URL at most every 50ms, so the click's history entry + // can land after Back unless we wait for it. + await waitFor(() => { + expect( + new URLSearchParams(window.location.search).get("event"), + ).not.toBeNull(); + }); await act(async () => { window.history.back(); });