fix(ui): повысить приоритет правил и исправить мобильные строки

This commit is contained in:
Denozordec committed 2026-10-03 21:49:05 +07:00
1 parent c7e1f75e2e
commit d5edfe5ef6
5 files changed
+137 -113

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import {test,expect} from "@playwright/test"
import {alertsWithRule,emptyOutbox} from "./fixtures/alerts"
for(const width of [320,1440])test("Alerts rules priority, accessible filters and no overflow/"+width,async({page})=>{
await page.setViewportSize({width,height:900})
await page.route("**/health",r=>r.fulfill({json:{status:"ok"}}))
await page.route("**/api/**",r=>{const path=new URL(r.request().url()).pathname;return r.fulfill({json:path==="/api/auth/config"?{required:false}:path==="/api/alerts"?alertsWithRule:path==="/api/alerts/outbox"?emptyOutbox:path==="/api/filters/gre-tunnels"?{tunnels:[],failures:[]}:[]})})
await page.goto("/alerts")
const search=page.getByRole("textbox",{name:"Поиск правил",exact:true})
await expect(search).toBeVisible()
const critical=page.getByRole("button",{name:"Критических: 1",exact:true})
await critical.focus();await page.keyboard.press("Space");await expect(critical).toHaveAttribute("aria-pressed","true")
await search.fill("missing fixture");await expect(page.getByText("Правила не найдены",{exact:true})).toBeVisible()
await search.fill("Fixture rule");await expect(page.getByRole("button",{name:"Изменить правило Fixture rule"})).toBeVisible()
const name=page.getByText("Fixture rule",{exact:true});await expect(name).toBeVisible();expect((await name.boundingBox())!.width).toBeGreaterThan(100)
const position=await search.boundingBox();const catalogs=await page.getByText("Каталоги целей",{exact:true}).boundingBox();const queue=await page.getByRole("region",{name:"Очередь Telegram"}).boundingBox()
expect(position!.y).toBeLessThan(catalogs!.y);expect(position!.y).toBeLessThan(queue!.y)
await search.scrollIntoViewIfNeeded();await expect(search).toBeInViewport()
expect(await page.evaluate(()=>document.documentElement.scrollWidth<=window.innerWidth)).toBe(true)
await page.screenshot({path:"test-results/alerts-layout-"+width+".png",fullPage:true})
})