fix(ipsec): учитывать несколько сессий без ложного офлайн

This commit is contained in:
Denozordec committed 2026-10-10 20:42:58 +07:00
1 parent cb6ec09312
commit 60b2e099f0
10 files changed
+272 -24

No files matched your search

+26
View File
@@ -6,6 +6,32 @@ const servers = [1, 2].map(id => ({ id, name: "Роутер " + id, host: "192.0
const full = { servers: [summary("1"), summary("2")], clients: [client("1"), client("2")] }
for (const width of [1280, 320]) {
test(`IPsec: несколько сессий одного клиента без произвольного адреса ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 1000 })
let phase = 0
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
await page.route("**/api/**", r => {
const path = new URL(r.request().url()).pathname
return r.fulfill({ json: path === "/api/ipsec" ? {
servers: [{ ...summary("1"), clientsOnline: phase === 2 ? 0 : 1 }],
clients: [{ ...client("1"), online: phase !== 2, ...(phase === 1 ? { activeAddress: "198.18.113.250", activeSince: "1m" } : {}) }],
} : path === "/api/servers" ? servers : path === "/api/auth/config" ? { required: false } : {} })
})
await page.goto("/ipsec?server=1")
const rows = page.locator("tr[data-row-id]")
await expect(rows.getByText("онлайн", { exact: true })).toHaveCount(1)
await expect(rows.getByText("офлайн", { exact: true })).toHaveCount(0)
await expect(rows.getByText("Не определено", { exact: true })).toHaveCount(0)
await expect(page.getByLabel("Сводка IPsec")).not.toContainText("—")
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true)
phase = 1
await page.getByRole("button", { name: "Обновить", exact: true }).click()
await expect(rows.getByText("198.18.113.250", { exact: true })).toHaveCount(1)
phase = 2
await page.getByRole("button", { name: "Обновить", exact: true }).click()
await expect(rows.getByText("офлайн", { exact: true })).toHaveCount(1)
await expect(rows.getByText("198.18.113.250", { exact: true })).toHaveCount(0)
})
test(`IPsec: неоднозначная сессия и восстановление статуса ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 1000 })
let phase = 0