import {test,expect} from "@playwright/test" import {emptyAlerts,emptyOutbox,alertsRule} from "./fixtures/alerts" test("Unsupported BGP prefix is visible as unavailable, existing disabled rule cannot be enabled and remains editable",async({page})=>{ let writes=0;const rule={...alertsRule,id:"prefix",name:"Legacy prefix",type:"bgp-prefix",groupId:null,enabled:false,target:"любой префикс",targets:["любой префикс"],condition:"был отозван",conditions:["был отозван"]} await page.route("**/health",r=>r.fulfill({json:{status:"ok"}}));await page.route("**/api/**",r=>{const path=new URL(r.request().url()).pathname;if(r.request().method()!=="GET")writes++;return r.fulfill({json:path==="/api/auth/config"?{required:false}:path==="/api/alerts"?{...emptyAlerts,rules:[rule]}:path==="/api/alerts/outbox"?emptyOutbox:path==="/api/filters/gre-tunnels"?{tunnels:[],failures:[]}:[]})});await page.goto("/alerts");await expect(page.getByText("Отслеживание появления и отзыва префиксов пока недоступно. Это правило не проверяется.")).toBeVisible();await expect(page.getByRole("switch",{name:"Включить правило Legacy prefix"})).toBeDisabled();await page.getByRole("button",{name:"Изменить правило Legacy prefix"}).click();const dialog=page.getByRole("dialog");await expect(dialog.getByRole("status")).toContainText("Сохранённое правило не проверяется");await expect(dialog.getByRole("button",{name:/^BGP-префикс/})).toBeDisabled();await dialog.getByRole("button",{name:/^Сервер Доступность/}).click();await expect(dialog.getByRole("status")).toHaveCount(0);expect(writes).toBe(0) })