Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an e2e test about query parameters #521

Merged
merged 13 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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