fix(ui): ограничить строки таблицы проб скорости

This commit is contained in:
Denozordec committed 2026-10-04 02:44:52 +07:00
1 parent 057281c246
commit 76a5e81fd4
6 files changed
+59 -7

No files matched your search

+30 -2
View File
@@ -72,6 +72,34 @@ test("Демо-расписание: сортировка интервала и
await expect(page.locator('tr[data-row-id="r3"]')).toHaveCount(0)
})
test("Large speed probes: фиксированный baseline1000 до ограничения DOM",async({page},info)=>{
test.setTimeout(90000);const start=Date.now();await setup(page,"/probes",1000);await page.getByRole("button",{name:"Расписание",exact:true}).click();await expect(page.locator("tr[data-row-id]")).toHaveCount(1000);const sample={fixtureRows:1000,renderedRows:await page.locator("tr[data-row-id]").count(),domNodes:await page.locator("*").count(),readyMs:Date.now()-start};console.log(JSON.stringify(sample));await info.attach("large-speed-probes-baseline",{body:JSON.stringify(sample),contentType:"application/json"})
test("Large speed probes: 50 строк, глобальная сортировка и контекст обновления", async ({ page }, info) => {
test.setTimeout(90000)
const start = Date.now()
await setup(page, "/probes", 1000)
await page.getByRole("button", { name: "Расписание", exact: true }).click()
const rows = page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(50)
const sample = { fixtureRows: 1000, renderedRows: await rows.count(), domNodes: await page.locator("*").count(), scheduleNodes: await page.getByRole("region", { name: "Пробы скорости", exact: true }).locator("*").count(), readyMs: Date.now() - start }
console.log(JSON.stringify(sample))
await info.attach("large-speed-probes-metrics", { body: JSON.stringify(sample), contentType: "application/json" })
expect(sample.scheduleNodes).toBeLessThan(2000)
expect(sample.domNodes).toBeLessThan(12000)
await page.getByRole("button", { name: "Следующая страница", exact: true }).click()
await expect(rows.first()).toHaveAttribute("data-row-id", "51")
await page.getByRole("button", { name: "Обновить пробы скорости", exact: true }).click()
await expect(page.getByRole("button", { name: "Обновить пробы скорости", exact: true })).toBeEnabled()
await expect(page.getByText("51–100 из 1000", { exact: true })).toBeVisible()
await page.getByRole("button", { name: "Источник", exact: true }).click()
await page.getByRole("button", { name: "Источник", exact: true }).click()
await page.getByRole("button", { name: "Перейти на страницу 1", exact: true }).click()
await expect(rows.first()).toHaveAttribute("data-row-id", "1000")
for (let i = 0; i < 3; i++) await page.getByRole("button", { name: "…", exact: true }).last().click()
await page.getByRole("button", { name: "Перейти на страницу 20", exact: true }).click()
await expect(page.getByText("951–1000 из 1000", { exact: true })).toBeVisible()
await page.setViewportSize({ width: 320, height: 900 })
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true)
await page.route("**/api/uptime/speed-probes", route => route.fulfill({ json: { probes: [{ id: "1", srcServerId: "1", dstServerId: "1001", srcInterface: "ether1", dstInterface: "ether1", protocol: "tcp", direction: "both", durationSec: "10", enabled: true, lastRunAt: null, lastTxAvgMbps: null, lastRxAvgMbps: null, lastStatus: null, lastError: null }] } }))
await page.getByRole("button", { name: "Обновить пробы скорости", exact: true }).click()
await expect(rows).toHaveCount(1)
await expect(rows.first()).toHaveAttribute("data-row-id", "1")
})