fix(ui): сбрасывать снимок при изменении параметров speed-пробы
This commit is contained in:
1 parent
090206c893
commit
7f18fcb6db
11 files changed
+106
-22
No files matched your search
@@ -861,3 +861,45 @@ test("Speed snapshot: смена пары сбрасывает снимок по
|
||||
await expect(history).toContainText("80")
|
||||
expect(writes).toBe(3)
|
||||
})
|
||||
|
||||
test("Speed snapshot: смена длительности сбрасывает снимок, прежняя история не накладывается", async ({ page }) => {
|
||||
await setup(page, "/uptime?probe=p1", 0, false, "mm:uptime:write", false, true)
|
||||
await page.getByRole("button", { name: "Пауза", exact: true }).click()
|
||||
await page.getByRole("button", { name: /Скорость/ }).click()
|
||||
await page.route("**/api/uptime/speed-test", route => route.fulfill({ json: { ok: true, result: { runId: route.request().postDataJSON().runId, txAvgMbps: 30, rxAvgMbps: 80 } } }))
|
||||
let fail = true, writes = 0
|
||||
await page.route("**/api/uptime/speed-probes", route => {
|
||||
if (route.request().method() !== "PUT") return route.fallback()
|
||||
writes++
|
||||
return route.fulfill(fail ? { status: 500, json: { error: "Пара не сохранена" } } : { json: { ok: true } })
|
||||
})
|
||||
const run = page.getByRole("button", { name: "Запустить", exact: true })
|
||||
const row = () => page.getByRole("button", { name: "Запустить", exact: true, includeHidden: true }).locator("xpath=../../..")
|
||||
await run.click()
|
||||
await expect(row().getByText("80 Мбит/с", { exact: true })).toBeVisible()
|
||||
const history = page.getByRole("table")
|
||||
await expect(history).toContainText("80")
|
||||
const summary = page.locator('[aria-label="Сводка speed-проб"]')
|
||||
await expect(summary).toContainText("1 run")
|
||||
await page.getByRole("button", { name: "Редактировать speed-пробу", exact: true }).click()
|
||||
const dialog = page.getByRole("dialog")
|
||||
const duration = () => dialog.locator('[data-slot="field"]').filter({ has: page.locator('[data-slot="field-label"]').filter({ hasText: /^Сек$/ }) }).getByRole("textbox")
|
||||
await duration().fill("20")
|
||||
await dialog.getByRole("button", { name: "Сохранить", exact: true }).click()
|
||||
await expect(dialog.getByRole("alert")).toContainText("Пара не сохранена")
|
||||
await expect(row()).toContainText("80 Мбит/с")
|
||||
fail = false
|
||||
await dialog.getByRole("button", { name: "Сохранить", exact: true }).click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(row()).toContainText("20")
|
||||
await expect(row()).not.toContainText("80 Мбит/с")
|
||||
await expect(summary).toContainText("1 run")
|
||||
await expect(history).toContainText("80")
|
||||
await page.getByRole("button", { name: "Редактировать speed-пробу", exact: true }).click()
|
||||
await duration().fill("10")
|
||||
await dialog.getByRole("button", { name: "Сохранить", exact: true }).click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(row()).not.toContainText("80 Мбит/с")
|
||||
await expect(history).toContainText("80")
|
||||
expect(writes).toBe(3)
|
||||
})
|
||||
Reference in new issue
Block a user