fix(alerts): читать согласованный снимок и реальные цели проб

This commit is contained in:
Denozordec committed 2026-10-03 18:27:22 +07:00
1 parent dc5594ca7c
commit c5c1c2812d
12 files changed
+114 -88

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
import {test,expect} from "@playwright/test"
import {emptyAlerts} from "./fixtures/alerts"
test("Alerts history distinguishes synthesized monitoring from notification API acceptance and unknown outcome",async({page})=>{
const common={severity:"warning",message:"Fixture history",firedAt:"2026-10-03T00:00:00.000Z"}
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"?{...emptyAlerts,history:[{...common,id:"live",ruleName:"Live fixture",sent:true,source:"live"},{...common,id:"db",ruleName:"Accepted fixture",sent:true,source:"db"},{...common,id:"unknown",ruleName:"Unknown fixture",sent:false,source:"db"}]}:path==="/api/filters/gre-tunnels"?{tunnels:[],failures:[]}:[]})});await page.goto("/alerts");for(const text of ["Мониторинг","API принял","Не подтверждено"])await expect(page.getByText(text,{exact:true})).toBeVisible();await expect(page.getByText("✓ отправлено",{exact:true})).toHaveCount(0);await expect(page.getByText("✗ ошибка",{exact:true})).toHaveCount(0)
})