fix(ui): очищать недоступные интерфейсы при загрузке
This commit is contained in:
1 parent
ab334764cf
commit
2bdcc1621f
5 files changed
+62
-26
No files matched your search
@@ -663,3 +663,28 @@ test('Смена режима через настройки: поздняя ош
|
||||
await expect(page.getByText('Ошибка старого live-подключения', { exact: true })).toHaveCount(0)
|
||||
await expect(page.getByRole('button', { name: 'Новая проба', exact: true })).toBeEnabled()
|
||||
})
|
||||
|
||||
for (const active of [false, true]) test(`Speed interfaces: загрузка и повторное открытие, active=${active}`, async ({ page }) => {
|
||||
await setup(page, "/uptime?tab=speed", 0, false, "mm:uptime:write")
|
||||
const probe = { id: "s1", srcServerId: "1", dstServerId: "2", srcInterface: "ether1", dstInterface: "ether1", protocol: "tcp", direction: "both", durationSec: "10", enabled: true, lastRunAt: null, lastTxAvgMbps: null, lastRxAvgMbps: null, lastStatus: null, lastError: null, lastPingRttMs: null, lastPingLossPct: null, lastPingAt: null, lastPingError: null }
|
||||
const bodies: { probes: Record<string, unknown>[] }[] = []
|
||||
let interfaceCalls = 0
|
||||
await page.route("**/api/uptime/speed-probes", route => {
|
||||
if (route.request().method() === "PUT") { bodies.push(route.request().postDataJSON()); return route.fulfill({ json: { ok: true } }) }
|
||||
return route.fulfill({ json: { probes: [probe] } })
|
||||
})
|
||||
await page.route("**/api/uptime/speed-test/endpoints/*/interfaces", route => { interfaceCalls++; return route.fulfill({ json: { interfaces: [{ name: "ether1", running: active, disabled: !active, addresses: ["192.0.2.1/24"] }] } }) })
|
||||
await page.reload()
|
||||
await page.getByRole("button", { name: "Пауза", exact: true }).click()
|
||||
for (let attempt = 0; attempt < 2; attempt++) {
|
||||
await page.getByRole("button", { name: "Редактировать speed-пробу", exact: true }).click()
|
||||
await expect.poll(() => interfaceCalls).toBe(2)
|
||||
const dialog = page.getByRole("dialog")
|
||||
await expect(dialog).toBeVisible()
|
||||
await dialog.getByRole("button", { name: "Сохранить", exact: true }).click()
|
||||
await expect(dialog).toBeHidden()
|
||||
expect(bodies[attempt].probes[0].srcInterface).toBe(active ? "ether1" : "")
|
||||
expect(bodies[attempt].probes[0].dstInterface).toBe(active ? "ether1" : "")
|
||||
}
|
||||
expect(interfaceCalls).toBe(2)
|
||||
})
|
||||
Reference in new issue
Block a user