feat(mcp): подготовить сервер и доступ к приёмке
This commit is contained in:
commit
bf3d50e1ff
3835 files changed
+537122
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
import { geoip } from "./fixtures/geoip"
|
||||
for (const invalid of [true, false]) test("GeoIP: malformed reader не обрушает сбор данных/" + invalid, async ({ page }) => {
|
||||
const errors: string[] = []; 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/geoip") return r.fulfill({ json: invalid ? {} : geoip })
|
||||
if (path === "/api/traffic/flow/settings") return r.fulfill({ status: 503, json: { error: "NetFlow outside fixture" } })
|
||||
if (path === "/api/scheduler/runs") return r.fulfill({ json: { runs: [] } })
|
||||
return r.fulfill({ json: { enabled: false, intervalSec: 300, retentionDays: 14, lastCollectedAt: null, lastDurationMs: null, lastError: null, scheduler: { jobs: [] } } })
|
||||
})
|
||||
await page.goto("/data-collection")
|
||||
await expect(page.getByText("Журнал прогонов", { exact: true })).toBeVisible()
|
||||
if (invalid) await expect(page.getByText("Данные GeoIP не подтверждены: получен некорректный ответ сервера", { exact: true }).first()).toBeVisible()
|
||||
else await expect(page.getByRole("button", { name: "Сохранить GeoIP", exact: true })).toBeVisible()
|
||||
expect(errors).toEqual([])
|
||||
})
|
||||
Reference in new issue
Block a user