fix(evobgp): проверять каталог и сохранять навигацию при ошибках API

This commit is contained in:
Denozordec committed 2026-10-01 22:11:10 +07:00
1 parent a0263c22a5
commit 0d2affaf6b
7 files changed
+77 -4

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
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([])
})