import { test, expect } from "@playwright/test" for (const path of ["ipsec", "vxlan"]) { for (const monitoring of ["null", "missing"]) { test(`${path}: inventory без снимка мониторинга (${monitoring})`, async ({ page }) => { await page.route("**/health", r => r.fulfill({ json: { ok: true } })) await page.route("**/api/**", r => { const url = new URL(r.request().url()).pathname const server = { id: 1, name: "Без первого опроса", host: "192.0.2.1", enabled: true, country: "RU", type: "exit-node", ...(monitoring === "null" ? { status: null, latency: null } : {}) } return r.fulfill({ json: url === "/api/servers" ? [server] : url === "/api/ipsec" ? { servers: [], clients: [] } : url === "/api/vxlan" ? { tunnels: [] } : url === "/api/auth/config" ? { required: false } : {} }) }) await page.goto("/" + path) const device = page.getByRole("option").filter({ hasText: "Без первого опроса" }) await expect(device).toBeVisible() await expect(device).toContainText("Статус неизвестен") await expect(page.getByRole("alert").filter({ hasText: /Некорректный ответ|Не удалось загрузить/ })).toHaveCount(0) await expect(page.getByRole("button", { name: "Обновить", exact: true })).toBeEnabled() }) } }