fix(ui): перенести таблицу сетевых фильтров на ReUI v9
This commit is contained in:
1 parent
d47f7ab162
commit
45530cdb99
3 files changed
+55
-11
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
import type { FilterRule } from "../../lib/data"
|
||||
|
||||
test("Сетевые Filters: 12 правил, сохранение порядка, поиск и сброс", async ({ page }) => {
|
||||
const rules: FilterRule[] = Array.from({ length: 12 }, (_, i) => ({
|
||||
id: String(i + 1), community: `65001:${i + 1}`, gateway: "", gatewayTunnelId: "",
|
||||
action: "blackhole", description: `Правило ${i + 1}`,
|
||||
}))
|
||||
const errors: string[] = []
|
||||
page.on("pageerror", e => errors.push(e.message))
|
||||
await page.route("**/health", route => route.fulfill({ json: { ok: true } }))
|
||||
await page.route("**/api/**", route => {
|
||||
const path = new URL(route.request().url()).pathname
|
||||
return route.fulfill({ json: path === "/api/filters/rules" ? { rulesets: [{ serverId: "1", rules }], greTunnels: [], live: true }
|
||||
: path === "/api/servers" ? [{ id: 1, name: "Тестовый роутер", host: "192.0.2.1", type: "exit-node", site: "TEST", country: "RU", asn: "", enabled: true, status: "online", latency: 1 }]
|
||||
: path === "/api/auth/config" ? { required: false }
|
||||
: path === "/api/filters/gre-tunnels" ? { tunnels: [] }
|
||||
: path === "/api/recursive-routes" ? { routes: [] } : {} })
|
||||
})
|
||||
await page.goto("/filters")
|
||||
const rows = page.locator("tr[data-row-id]")
|
||||
await expect(rows).toHaveCount(12)
|
||||
await expect(page.getByRole("button", { name: "Поднять правило 65001:1", exact: true })).toBeDisabled()
|
||||
await expect(page.getByRole("button", { name: "Опустить правило 65001:12", exact: true })).toBeDisabled()
|
||||
await expect(page.getByRole("button", { name: "Community", exact: true })).toHaveCount(0)
|
||||
await expect(rows.first()).toContainText("65001:1")
|
||||
await expect(rows.last()).toContainText("65001:12")
|
||||
await page.getByPlaceholder("Community, gateway, описание…").fill("Правило 12")
|
||||
await expect(rows).toHaveCount(1)
|
||||
await page.getByPlaceholder("Community, gateway, описание…").fill("нет совпадений")
|
||||
await expect(page.getByText("Ничего не найдено", { exact: true })).toBeVisible()
|
||||
await page.getByPlaceholder("Community, gateway, описание…").fill("")
|
||||
await expect(rows).toHaveCount(12)
|
||||
expect(errors).toEqual([])
|
||||
})
|
||||
Reference in new issue
Block a user