fix(map): сохранить узлы при датах опроса из базы данных
This commit is contained in:
1 parent
72bf648ca8
commit
fda7f353ad
5 files changed
+114
-1
No files matched your search
@@ -1,6 +1,17 @@
|
||||
import {test,expect} from "@playwright/test"
|
||||
const paths={servers:"/api/servers",gre:"/api/filters/gre-tunnels",probes:"/api/uptime/speed-probes"} as const
|
||||
const body=(path:string,name="Роутер")=>path===paths.servers?[{id:1,name,host:"192.0.2.1",type:"home-router",country:"RU",enabled:true,status:"online",latency:0}]:path===paths.gre?{tunnels:[],failures:[]}:path===paths.probes?{probes:[]}:path==="/api/auth/config"?{required:false}:{}
|
||||
test("Карта: PostgreSQL даты не скрывают JumpHost и Exit Node",async({page})=>{
|
||||
await page.route("**/health",r=>r.fulfill({json:{ok:true}}))
|
||||
const rows=[{id:1,name:"Узел JH",host:"192.0.2.1",type:"jump-host",country:"RU",enabled:true,status:"online",polledAt:"2026-10-15 13:46:40.855+00"},{id:2,name:"Узел EN",host:"192.0.2.2",type:"exit-node",country:"SE",enabled:true,status:"online",polledAt:"2026-10-15 20:46:40.855+07"}]
|
||||
await page.route("**/api/**",r=>{const p=new URL(r.request().url()).pathname;return r.fulfill({json:p===paths.servers?rows:body(p)})})
|
||||
await page.goto("/network-map")
|
||||
const map=page.getByRole("group",{name:"Интерактивная карта сети"})
|
||||
await expect(map.getByText("Узел JH",{exact:true})).toBeVisible()
|
||||
await expect(map.getByText("Узел EN",{exact:true})).toBeVisible()
|
||||
await expect(page.getByRole("combobox",{name:"Устройство на карте"})).toBeEnabled()
|
||||
await expect(page.getByRole("alert").filter({hasText:"Первоначальная загрузка карты"})).toHaveCount(0)
|
||||
})
|
||||
for(const part of ["servers","gre","probes"] as const)for(const malformed of [false,true])test("Карта: первоначальный отказ и повтор "+part+"/"+malformed,async({page})=>{
|
||||
let failing=true
|
||||
await page.route("**/health",r=>r.fulfill({json:{ok:true}}))
|
||||
|
||||
Reference in new issue
Block a user