fix(ui): показывать сведения о рукопожатии без ложного статуса

This commit is contained in:
Denozordec committed 2026-10-04 12:21:53 +07:00
1 parent 837298a171
commit c6702efcc4
9 files changed
+53 -16

No files matched your search

+22
View File
@@ -65,3 +65,25 @@ for (const view of ["details", "peers"] as const) test("WireGuard traffic: obser
if (view === "details") await row.click()
}
})
test("WireGuard handshake: old observation never proves online, missing remains unknown", async ({ page }, info) => {
await setup(page)
const interfaces = fixture.interfaces.slice(0, 1).map(row => ({ ...row, peers: Array.from({length:4}, (_, i) => ({ ...row.peers[0], id: "h"+i, rosId: "*H"+i, name: "Handshake "+i, latestHandshake: [undefined, "", "1h", "0s"][i] })) }))
await page.route("**/api/wireguard", route => route.fulfill({json:wgListResponseSchema.parse({interfaces})}))
await page.reload()
await expect(page.getByText("Пиров онлайн",{exact:true})).toHaveCount(0)
const label=page.getByText("Данные рукопожатия",{exact:true})
await expect(label.locator("..").locator("..")).toContainText("2/4")
await expect(page.getByText("Доступность пиров не проверена",{exact:true}).filter({visible:true})).toBeVisible()
await page.getByRole("button",{name:"Пиры: wg-test-1",exact:true}).click()
const detail=page.getByRole("region",{name:"Пиры: wg-test-1",exact:true})
await expect(detail.getByText("Нет данных",{exact:true})).toHaveCount(2)
await expect(detail.getByText("1h",{exact:true})).toBeVisible()
await page.getByRole("tab",{name:/Пиры/}).click()
const rows=page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(4)
await expect(rows.nth(0)).toContainText("Нет данных");await expect(rows.nth(1)).toContainText("Нет данных")
await expect(rows.nth(2)).toContainText("1h");await expect(rows.nth(3)).toContainText("0s")
await page.setViewportSize({width:320,height:1000});expect(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth)).toBe(true)
await page.addStyleTag({content:"nextjs-portal{display:none!important}"});await page.screenshot({path:info.outputPath("wireguard-handshake-320.png"),animations:"disabled"})
})