Files
MikrotikManager/tests/e2e/evobgp-catalog-error.spec.ts
T

17 lines
1.3 KiB
TypeScript

import { test, expect } from "@playwright/test"
test("Evolution: malformed catalogue не обрушает навигацию", async ({ page }) => {
const errors: string[] = []; let catalogs = 0; page.on("pageerror", error => errors.push(error.message))
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
await page.route("**/api/**", r => {
const path = new URL(r.request().url()).pathname
if (path === "/api/auth/config") return r.fulfill({ json: { required: false } })
if (path === "/api/evobgp/settings") return r.fulfill({ json: { baseUrl: "https://evo.example.test", enabled: true, secretConfigured: true } })
if (path === "/api/evobgp/catalog") { catalogs++; return r.fulfill({ json: {} }) }
return r.fulfill({ status: 503, json: { error: "outside catalogue fixture" } })
})
await page.goto("/data-collection"); await expect.poll(() => catalogs).toBeGreaterThan(0)
await expect(page.getByText("Журнал прогонов", { exact: true })).toBeVisible()
await page.goto("/settings"); await page.getByRole("button", { name: "EvoBGP", exact: true }).click(); await expect(page.getByText("Каталог Evolution не подтверждён: получен некорректный ответ сервера", { exact: true })).toBeVisible()
expect(errors).toEqual([])
})