Skip to content

Commit

Permalink
Add an e2e test about query parameters (#521)
Browse files Browse the repository at this point in the history
* feat: Be usable non-ladle query params

* feat: move the query parameters example to e2e

* fix: e2e tests

* add click the menu
and open the story case to e2e tests

* Add resetParams to updateStory

* Add an e2e test to query parameters

* fix the test
  • Loading branch information
cm-dyoshikawa authored Oct 4, 2023
1 parent 813b3bc commit 06efcd8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions e2e/addons/tests/query-parameters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}) => {
Expand Down

0 comments on commit 06efcd8

Please sign in to comment.