fix(uptime): защитить пару устройств и атомарно сохранить результат

This commit is contained in:
Denozordec committed 2026-10-07 15:12:41 +07:00
1 parent 08ea416989
commit a3fcba0d43
9 files changed
+218 -70

No files matched your search

+22
View File
@@ -796,3 +796,25 @@ for (const invalid of [false, true]) {
expect(calls).toBe(2)
})
}
test("Speed-test: конфликт пары устройств сохраняет каталог и освобождает действия", async ({ page }) => {
await setup(page, "/uptime?probe=p1", 0, false, "mm:uptime:write")
await page.getByRole("button", { name: "Пауза", exact: true }).click()
await page.getByRole("button", { name: /Скорость/ }).click()
let calls = 0
const message = "Пара устройств speed-пробы изменилась. Обновите список проб перед запуском"
await page.route("**/api/uptime/speed-test", async route => {
calls++
await route.fulfill({ status: 409, json: { error: message } })
})
const run = page.getByRole("button", { name: "Запустить", exact: true })
await run.click()
await expect(page.getByRole("alert").filter({ hasText: message })).toBeVisible()
await expect(run).toBeEnabled()
await expect(page.getByRole("button", { name: "Редактировать speed-пробу", exact: true })).toBeEnabled()
await expect(page.getByRole("button", { name: "Удалить speed-пробу", exact: true })).toBeEnabled()
await expect(page.locator('[aria-label="Сводка speed-проб"]')).toContainText("0 run")
await expect(run.locator("xpath=../../..")).toContainText("Источник")
await expect(run.locator("xpath=../../..")).toContainText("Назначение")
expect(calls).toBe(1)
})