fix(test): проверить большой каталог проб скорости

This commit is contained in:
Denozordec committed 2026-10-04 00:56:57 +07:00
1 parent ef457b471a
commit 057281c246
5 files changed
+23 -5

No files matched your search

+8 -4
View File
@@ -2,9 +2,9 @@ import { SCHEDULER_JOB_KEYS } from "../../lib/scheduler-settings"
import { test, expect, type Page } from "@playwright/test"
import type { SpeedProbeApiRow } from "../../components/data-grids/probes-speed-probes-data-grid"
async function setup(page: Page, path: string) {
const probes: SpeedProbeApiRow[] = Array.from({ length: 12 }, (_, i) => ({
id: String(i + 1), srcServerId: `Источник ${i + 1}`, dstServerId: "Цель", srcInterface: "ether1",
async function setup(page: Page, path: string, count = 12) {
const probes: SpeedProbeApiRow[] = Array.from({ length: count }, (_, i) => ({
id: String(i + 1), srcServerId: String(i + 1), dstServerId: String(count + 1), srcInterface: "ether1",
dstInterface: "ether1", protocol: "tcp", direction: "both", durationSec: "10", enabled: true,
lastRunAt: null, lastTxAvgMbps: null, lastRxAvgMbps: null, lastStatus: null, lastError: null,
}))
@@ -17,7 +17,7 @@ async function setup(page: Page, path: string) {
if (path === "/api/scheduler/status") return route.fulfill({ json: { jobs } })
if (path === "/api/scheduler/jobs/alert_engine/run-now") return route.fulfill({ json: { ok: true, result: { status: "ok", error: null, result: { v: 1, job: "alert_engine", sampledAt: "2026-10-03T00:00:00Z", rulesChecked: 0, standaloneFires: 0, groupFires: 0, skippedNoTelegram: false } }, status: { jobs } } })
return route.fulfill({ json: path === "/api/uptime/speed-probes" ? { probes }
: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? []
: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? Array.from({length:count+1},(_,i)=>({id:i+1,name:i<count?`Источник ${i+1}`:"Цель",host:`192.0.2.${i%250+1}`,type:"exit-node",enabled:true,country:"RU",site:"TEST",asn:"",status:null,latency:null,os:"7",model:"CHR",sessions:0,wanUplinks:[]}))
: path === "/api/evobgp/settings" ? { enabled: false, baseUrl: "", secretConfigured: false }
: path === "/api/traffic/flow/settings" ? {
enabled: false, collectorIp: "10.0.0.1", flowListenPort: 2055, wgListenPort: 51820,
@@ -71,3 +71,7 @@ test("Демо-расписание: сортировка интервала и
await expect(rows).toHaveCount(2)
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"})
})