fix(ui): восстанавливать поиск и фильтры BGP из URL
This commit is contained in:
1 parent
5c307a5b6c
commit
aa678b9d5d
8 files changed
+220
-16
No files matched your search
@@ -91,3 +91,34 @@ test("BGP FilterQuery: выбор, AND и сброс", async ({ page }) => {
|
||||
await page.getByRole("button", { name: "Очистить", exact: true }).click()
|
||||
await expect(rows).toHaveCount(12)
|
||||
})
|
||||
|
||||
test("BGP: фильтры и поиск из URL переживают reload и возврат", async ({ page }) => {
|
||||
await setup(page, "/bgp?keep=x&state=Active&type=eBGP&q=Пир%207")
|
||||
const rows = page.locator("tr[data-row-id]")
|
||||
await expect(rows).toHaveCount(1)
|
||||
await expect(rows.first()).toContainText("Пир 7")
|
||||
await page.reload()
|
||||
await expect(rows).toHaveCount(1)
|
||||
await page.getByRole("button", { name: "Сбросить фильтры BGP", exact: true }).click()
|
||||
await expect(rows).toHaveCount(12)
|
||||
await page.goBack()
|
||||
await expect(rows).toHaveCount(1)
|
||||
await page.getByRole("button", { name: "Фильтры", exact: true }).click()
|
||||
await page.getByRole("option", { name: "Состояние", exact: true }).click()
|
||||
await page.getByRole("option", { name: "равно", exact: true }).click()
|
||||
await page.getByRole("option", { name: "Active", exact: true }).click()
|
||||
await expect.poll(() => new URL(page.url()).searchParams.has("filters")).toBe(true)
|
||||
await page.reload()
|
||||
await expect(rows).toHaveCount(1)
|
||||
expect(new URL(page.url()).searchParams.get("keep")).toBe("x")
|
||||
})
|
||||
for (const invalid of ["state=broken", "type=broken", "q=a&q=b", "filters=%7B", "filters=" + encodeURIComponent(JSON.stringify({ v: 1, query: { id: "root", type: "group", combinator: "and", rules: [{ id: "x", type: "rule", path: ["password"], operator: "is", value: "x" }] } }))]) {
|
||||
test("BGP: некорректный URL-фильтр не расширяет срез " + invalid.slice(0, 30), async ({ page }) => {
|
||||
await setup(page, "/bgp?keep=x&" + invalid)
|
||||
await expect(page.getByRole("alert").filter({ hasText: "ссылк" })).toBeVisible()
|
||||
await expect(page.locator("tr[data-row-id]")).toHaveCount(0)
|
||||
await page.getByRole("button", { name: "Сбросить фильтры BGP", exact: true }).click()
|
||||
await expect(page.locator("tr[data-row-id]")).toHaveCount(12)
|
||||
expect(new URL(page.url()).searchParams.get("keep")).toBe("x")
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user