fix(ui): завершить доступное управление картой сети
This commit is contained in:
1 parent
bc83b8dbbf
commit
bc20e5b9f4
11 files changed
+116
-37
No files matched your search
@@ -62,3 +62,39 @@ test("Карта: пропорции камеры, ручной масштаб
|
||||
const wan=page.getByRole("button",{name:"WAN WAN",exact:true});await wan.focus();await wan.press("Enter")
|
||||
await expect(page).toHaveURL(/wan=0/);await expect(wan).toHaveAttribute("aria-pressed","true")
|
||||
})
|
||||
|
||||
test("Карта: pointer capture, клавиатурный pan и возврат фокуса",async({page})=>{
|
||||
await page.goto("/network-map");const map=page.getByRole("group",{name:"Интерактивная карта сети"}),node=page.getByRole("button",{name:/^Устройство Домашний/})
|
||||
await expect(node).toBeVisible();await map.focus();const before=await map.getAttribute("viewBox");await map.press("ArrowDown");expect(await map.getAttribute("viewBox")).not.toBe(before)
|
||||
await page.getByRole("combobox",{name:"Устройство на карте"}).selectOption("1")
|
||||
const transform=await node.getAttribute("transform"),point=await node.evaluate((g:SVGGElement)=>{const matrix=g.getScreenCTM()!;return {x:matrix.e,y:matrix.f}})
|
||||
await page.mouse.move(point.x,point.y);await page.mouse.down();await page.mouse.move(point.x+80,point.y+25,{steps:5});await page.mouse.up()
|
||||
expect(await node.getAttribute("transform")).not.toBe(transform);await expect(page).toHaveURL(/server=1/)
|
||||
await page.getByRole("button",{name:"Закрыть детали устройства"}).click();await expect(page.getByRole("combobox",{name:"Устройство на карте"})).toBeFocused()
|
||||
const box=(await map.boundingBox())!,pan=await map.getAttribute("viewBox")
|
||||
await page.mouse.move(box.x+15,box.y+box.height-50);await page.mouse.down();await page.mouse.move(box.x-30,box.y+box.height-80,{steps:5});await page.mouse.up()
|
||||
expect(await map.getAttribute("viewBox")).not.toBe(pan)
|
||||
const stopped=await map.getAttribute("viewBox");await page.mouse.move(box.x+100,box.y+100);expect(await map.getAttribute("viewBox")).toBe(stopped)
|
||||
})
|
||||
test("Карта: touch pan и отмена жеста без залипания",async({page})=>{
|
||||
await page.setViewportSize({width:390,height:900});await page.goto("/network-map")
|
||||
const map=page.getByRole("group",{name:"Интерактивная карта сети"});await expect(page.getByRole("combobox",{name:"Устройство на карте"})).toBeEnabled()
|
||||
expect(await map.evaluate(e=>getComputedStyle(e).touchAction)).toBe("none")
|
||||
const box=(await map.boundingBox())!,before=await map.getAttribute("viewBox"),session=await page.context().newCDPSession(page)
|
||||
await session.send("Input.dispatchTouchEvent",{type:"touchStart",touchPoints:[{x:box.x+20,y:box.y+box.height-70,id:1}]})
|
||||
await session.send("Input.dispatchTouchEvent",{type:"touchMove",touchPoints:[{x:box.x+70,y:box.y+box.height-100,id:1}]})
|
||||
await session.send("Input.dispatchTouchEvent",{type:"touchCancel",touchPoints:[]})
|
||||
expect(await map.getAttribute("viewBox")).not.toBe(before)
|
||||
const stopped=await map.getAttribute("viewBox");await page.mouse.move(box.x+150,box.y+50);expect(await map.getAttribute("viewBox")).toBe(stopped)
|
||||
await page.getByRole("button",{name:/^Устройство Домашний/}).click();await expect(page.getByRole("complementary",{name:"Детали объекта карты"})).toBeVisible()
|
||||
})
|
||||
test("Карта: пустой источник отличается от пустого среза",async({page})=>{
|
||||
await page.goto("/network-map");await expect(page.getByRole("combobox",{name:"Устройство на карте"})).toBeEnabled()
|
||||
await page.getByRole("textbox",{name:"Поиск узла"}).fill("нет такого узла");await expect(page.getByRole("status").filter({hasText:"Узлы по заданным условиям"})).toBeVisible()
|
||||
await page.getByRole("button",{name:"Сбросить срез карты"}).click();await expect(page.getByRole("textbox",{name:"Поиск узла"})).toHaveValue("")
|
||||
await expect(page.getByRole("button",{name:/^Устройство Домашний/})).toBeVisible()
|
||||
await page.route("**/api/servers",r=>r.fulfill({json:[]}));await page.route("**/api/filters/gre-tunnels",r=>r.fulfill({json:{tunnels:[],failures:[]}}))
|
||||
await page.getByRole("button",{name:"Обновить",exact:true}).click()
|
||||
await expect(page.getByRole("status").filter({hasText:"Устройств на карте пока нет"})).toBeVisible();await expect(page.getByRole("link",{name:"Открыть серверы",exact:true})).toHaveAttribute("href","/servers")
|
||||
await expect(page.getByRole("button",{name:"Экспорт SVG",exact:true})).toBeDisabled()
|
||||
})
|
||||
Reference in new issue
Block a user