fix(ui): ограничить трассировку и защитить повторную симуляцию
This commit is contained in:
1 parent
9231597d88
commit
21dc646553
7 files changed
+96
-18
No files matched your search
@@ -52,6 +52,36 @@ test("Сценарий1000: граница страниц, полный draft и
|
||||
await page.getByRole("button", { name: "Запустить", exact: true }).click()
|
||||
await expect(page.getByText("— правило #999", { exact: true })).toBeVisible()
|
||||
await expect(page.getByText("Пакет заблокирован", { exact: false })).toBeVisible()
|
||||
const trace = page.getByRole("region", { name: "Трассировка Firewall", exact: true })
|
||||
const traceRows = trace.locator("[data-firewall-trace-step]")
|
||||
await expect(traceRows).toHaveCount(50)
|
||||
await expect(traceRows.first()).toHaveAttribute("data-firewall-trace-step", "1")
|
||||
console.log("Scenario simulation nodes", await page.locator("*").count())
|
||||
await trace.getByRole("button", { name: "Следующая страница трассировки", exact: true }).click()
|
||||
await expect(traceRows.first()).toHaveAttribute("data-firewall-trace-step", "51")
|
||||
await trace.getByRole("button", { name: "К правилу результата", exact: true }).focus(); await page.keyboard.press("Enter")
|
||||
await expect(traceRows).toHaveCount(49)
|
||||
await expect(traceRows.last()).toHaveAttribute("data-firewall-trace-step", "999")
|
||||
await expect(trace.getByRole("status")).toHaveText("Шаги 951–999 из 999")
|
||||
await expect(trace.getByRole("button", { name: "Следующая страница трассировки", exact: true })).toBeDisabled()
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(320)
|
||||
expect((await page.evaluate(async () => (window as unknown as { axe: typeof axe }).axe.run(document.querySelector('[aria-label="Трассировка Firewall"]')!, { runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"] } }))).violations.map(v => ({ id: v.id, nodes: v.nodes.map(n => n.target) }))).toEqual([])
|
||||
await traceRows.last().scrollIntoViewIfNeeded()
|
||||
await page.screenshot({ path: info.outputPath("trace-320.png"), animations: "disabled" })
|
||||
await page.clock.install()
|
||||
await page.getByRole("button", { name: "Быстро", exact: true }).click()
|
||||
await page.getByRole("button", { name: "Снова", exact: true }).click()
|
||||
await expect(traceRows.first()).toHaveAttribute("data-firewall-trace-step", "1")
|
||||
await page.getByRole("button", { name: "Стоп", exact: true }).click()
|
||||
await page.getByRole("button", { name: "Мгновенно", exact: true }).click()
|
||||
await page.getByRole("button", { name: "Снова", exact: true }).click()
|
||||
await expect(page.getByText("— правило #999", { exact: true })).toBeVisible()
|
||||
await expect(traceRows.first()).toHaveAttribute("data-firewall-trace-step", "1")
|
||||
await page.clock.runFor(1000)
|
||||
await expect(trace.getByText("проверяется…", { exact: true })).toHaveCount(0)
|
||||
await expect(page.getByText("— правило #999", { exact: true })).toBeVisible()
|
||||
await page.getByRole("button", { name: "Сбросить", exact: true }).click()
|
||||
await expect(trace).toHaveCount(0)
|
||||
await expect(page.getByText("— правило #999", { exact: true })).toHaveCount(0)
|
||||
expect(writes).toBe(0)
|
||||
})
|
||||
Reference in new issue
Block a user