fix(ui): исправить адаптивность форм и вкладок мониторинга

This commit is contained in:
Denozordec committed 2026-09-23 14:38:52 +07:00
1 parent a9ed459481
commit 9cd15528c9
4 files changed
+61 -8

No files matched your search

+45
View File
@@ -567,3 +567,48 @@ for (const extra of ["&rtype=unknown", "&rq=a&rq=b"]) {
await expect(page.locator("tr[data-row-id]")).toHaveCount(1)
})
}
for (const width of [320, 390, 1440]) {
test(`приёмка ${width}px: Resources, Speed и формы проб`, async ({ page }) => {
await page.setViewportSize({ width, height: 844 })
await resourceSetup(page)
await expect(page.locator("tr[data-row-id]")).toHaveCount(1)
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true)
await page.screenshot({ path: `test-results/resources-${width}.png`, animations: "disabled" })
await page.unrouteAll({ behavior: "wait" })
await setup(page, "/uptime?probe=p1", 0, true, "mm:uptime:write")
await page.getByRole("button", { name: "Пауза", exact: true }).click()
for (const speed of [false, true]) {
if (speed) await page.getByRole("button", { name: /Скорость/ }).click()
await page.getByRole("button", { name: speed ? "Редактировать speed-пробу" : "Редактировать пробу", exact: true }).click()
const dialog = page.getByRole("dialog")
await expect(dialog).toBeVisible()
await expect(dialog.getByRole("button", { name: "Сохранить", exact: true })).toBeInViewport()
await expect(dialog.getByRole("button", { name: "Отмена", exact: true })).toBeInViewport()
await expect.poll(() => dialog.locator("button, input").evaluateAll(elements => elements.filter(el => {
const rect = el.getBoundingClientRect()
return rect.width > 0 && (rect.left < -1 || rect.right > innerWidth + 1)
}).map(el => el.textContent || el.tagName))).toEqual([])
await page.screenshot({ path: `test-results/${speed ? "speed" : "ping"}-form-${width}.png`, animations: "disabled" })
await dialog.locator("fieldset").evaluate(el => { el.scrollTop = el.scrollHeight })
if (speed) {
const direction = await dialog.getByRole("button", { name: "rx", exact: true }).boundingBox()
const duration = await dialog.locator("input").last().boundingBox()
expect(direction).not.toBeNull()
expect(duration).not.toBeNull()
expect(direction!.y + direction!.height).toBeLessThanOrEqual(duration!.y)
}
await page.screenshot({ path: `test-results/${speed ? "speed" : "ping"}-form-bottom-${width}.png`, animations: "disabled" })
await page.keyboard.press("Escape")
await expect(dialog).toBeHidden()
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true)
}
for (const name of [/Пинг-пробы/, /Ресурсы/, /Скорость/]) {
const bounds = await page.getByRole("button", { name }).boundingBox()
expect(bounds).not.toBeNull()
expect(bounds!.x).toBeGreaterThanOrEqual(0)
expect(bounds!.x + bounds!.width).toBeLessThanOrEqual(width)
}
await page.screenshot({ path: `test-results/speed-${width}.png`, animations: "disabled" })
})
}