diff --git a/e2e/addons/tests/query-parameters.spec.ts b/e2e/addons/tests/query-parameters.spec.ts index 1886b3fe..5d8e7e3f 100644 --- a/e2e/addons/tests/query-parameters.spec.ts +++ b/e2e/addons/tests/query-parameters.spec.ts @@ -22,6 +22,22 @@ test("when click the menu and open the story, remain non-ladle query parameters" expect(url).toContain("foo=bar"); }); +test("when move a story from the query parameters story, remove non-ladle query parameters", async ({ + page, +}) => { + // Open the query parameters story + await page.goto("/?story=query-parameters--query-parameters"); + await page.waitForSelector("[data-storyloaded]"); + + // Open a some story + await page.getByText("A11y").click(); + await page.getByRole("link", { name: "Issues" }).click(); + await page.waitForSelector("[data-storyloaded]"); + const url = page.url(); + expect(url).toContain("story=a11y--issues"); + expect(url).not.toContain("foo=bar"); // The non-ladle query parameter is removed +}); + test("preserve user query params after ladle query param update", async ({ page, }) => {