fix(ui): сохранять страницу компактной таблицы при опросе

This commit is contained in:
Denozordec committed 2026-10-04 00:53:28 +07:00
1 parent 160b39186a
commit ef457b471a
6 files changed
+33 -6

No files matched your search

+4
View File
@@ -269,3 +269,7 @@ for(const state of ["unmeasured","measured","failed","unknown"])test("Dashboard
test("Dashboard large attention queue mounts rows on demand",async({page},info)=>{
test.setTimeout(90000);const start=Date.now();await setup(page,false,1000);await expect(refresh(page)).toBeEnabled();const queue=page.getByRole("region",{name:"Требует внимания",exact:true});const links=queue.locator('a[href^="/servers?server="]');await expect(links).toHaveCount(5);const sample={fixtureRows:1000,readyMs:Date.now()-start,renderedAttentionRows:await links.count(),domNodes:await page.locator("*").count()};console.log(JSON.stringify(sample));await info.attach("large-attention-metrics",{body:JSON.stringify(sample),contentType:"application/json"});const summary=queue.locator("summary").filter({hasText:"Ещё 995"});await summary.focus();await summary.press("Enter");await expect(links).toHaveCount(55);await queue.getByRole("button",{name:"Показать ещё 50",exact:true}).click();await expect(links).toHaveCount(105);await summary.focus();await summary.press("Enter");await expect(links).toHaveCount(5);await summary.press("Enter");await expect(links).toHaveCount(55);await page.setViewportSize({width:320,height:900});expect(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth)).toBe(true);await links.first().click();await expect(page).toHaveURL(/servers\?server=1$/);await expect(page.getByRole("status",{name:"Сервер по ссылке"})).toContainText("Узел 1")
})
test("Dashboard active probes retain page after refreshed measurements",async({page})=>{
const control=await setup(page);await expect(refresh(page)).toBeEnabled();const at="2026-10-04T00:00:00Z";const probes=Array.from({length:100},(_,i)=>({id:"large-p"+(i+1),srcServerId:"1",name:"Paged probe "+String(i+1).padStart(3,"0"),target:"192.0.2.2",filter:"main",rtt:0,loss:0,status:"up",series:[],enabled:true,showOnDashboard:true,observations:{samples:[{sampledAt:at,rtt:0,loss:0,status:"up"}]}}));control.probesPayload={rangeStartAt:"2026-10-03T23:00:00Z",rangeEndAt:at,probes};await refresh(page).click();await expect(page.locator("tr[data-row-id]")).toHaveCount(50);await page.getByRole("button",{name:"Следующая страница",exact:true}).click();await expect(page.getByText("Paged probe 051",{exact:true})).toBeVisible();await refresh(page).click();await expect(refresh(page)).toBeEnabled();await expect(page.getByText("51–100 из 100",{exact:true})).toBeVisible();await expect(page.getByText("Paged probe 051",{exact:true})).toBeVisible();control.probesPayload={rangeStartAt:"2026-10-03T23:00:00Z",rangeEndAt:at,probes:probes.slice(0,1)};await refresh(page).click();await expect(page.locator("tr[data-row-id]")).toHaveCount(1);await expect(page.getByText("Paged probe 001",{exact:true})).toBeVisible()
})