From c3f9dba40f702a34ae9d60160853aaa59efbc436 Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 05:05:04 +0000 Subject: [PATCH] test(website): check plugin search parameters by name Native GET form submission and hydrated navigation serialize the same filters in different orders. Verify the term and ranking window in both flows. --- packages/website/e2e/plugins.spec.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/website/e2e/plugins.spec.ts b/packages/website/e2e/plugins.spec.ts index 3c208dbc58..255b7dd65a 100644 --- a/packages/website/e2e/plugins.spec.ts +++ b/packages/website/e2e/plugins.spec.ts @@ -177,7 +177,7 @@ test("filters by search and clears to all plugins", async ({ page }) => { test("keeps the directory's ranking window when searching", async ({ page }) => { await page.goto("/plugins?window=month"); await submitSearch(page, "graphite"); - await expect(page).toHaveURL(/\/plugins\/all\?q=graphite&window=month$/); + await expectDirectorySearch(page, "graphite", "month"); await expect(page.getByRole("link", { name: "This month" })).toHaveAttribute( "aria-current", "true", @@ -358,10 +358,16 @@ test.describe("search engine visits without JavaScript", () => { }); test("renders search results and submits the search form", async ({ page }) => { - await page.goto("/plugins/all?q=graphite"); + await page.goto("/plugins?window=month"); + await submitSearch(page, "graphite"); + await expectDirectorySearch(page, "graphite", "month"); await expect( page.getByRole("heading", { level: 1, name: /^Results for “graphite”/ }), ).toBeVisible(); + await expect(page.getByRole("link", { name: "This month" })).toHaveAttribute( + "aria-current", + "true", + ); await expect(page.getByRole("main").getByRole("link", { name: /Graphite/ })).toBeVisible(); await expect(page.getByRole("link", { name: /Dracula/ })).toHaveCount(0); @@ -459,6 +465,15 @@ async function submitSearch(page: Page, term: string) { await page.keyboard.press("Enter"); } +async function expectDirectorySearch(page: Page, term: string, window: string) { + await expect(page).toHaveURL( + (url) => + url.pathname === "/plugins/all" && + url.searchParams.get("q") === term && + url.searchParams.get("window") === window, + ); +} + async function typeSearch(page: Page, term: string) { await page.getByRole("searchbox", { name: "Search plugins" }).pressSequentially(term); }