fix(ui): адаптировать формы серверов и прокрутку ресурсов
This commit is contained in:
1 parent
9cd15528c9
commit
ca9474ac83
7 files changed
+74
-11
No files matched your search
@@ -509,3 +509,27 @@ test("права серверов: отзыв перед сохранением
|
||||
await expect(page.getByRole("button", { name: "Сохранить", exact: true })).toBeDisabled()
|
||||
expect(writes).toBe(0)
|
||||
})
|
||||
|
||||
for (const width of [320, 390, 1440]) {
|
||||
test(`приёмка формы сервера ${width}px: все шаги и отмена`, async ({ page }) => {
|
||||
await page.setViewportSize({ width, height: 844 })
|
||||
await setup(page)
|
||||
await edit(page)
|
||||
const dialog = page.getByRole('dialog')
|
||||
await dialog.getByRole("button", { name: "Home Router", exact: true }).click()
|
||||
for (let step = 1; step <= 4; step++) {
|
||||
if (step === 2) await dialog.getByRole("button", { name: "Добавить WAN-аплинк", exact: true }).click()
|
||||
if (step === 4) await dialog.getByRole("button", { name: "Дополнительно", exact: true }).last().click()
|
||||
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/server-form-${width}-${step}.png`, animations: 'disabled' })
|
||||
if (step < 4) await dialog.getByRole('button', { name: 'Далее', exact: true }).click()
|
||||
}
|
||||
await expect(dialog.getByRole('button', { name: 'Сохранить', exact: true })).toBeInViewport()
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(dialog).toBeHidden()
|
||||
})
|
||||
}
|
||||
@@ -612,3 +612,32 @@ for (const width of [320, 390, 1440]) {
|
||||
await page.screenshot({ path: `test-results/speed-${width}.png`, animations: "disabled" })
|
||||
})
|
||||
}
|
||||
|
||||
for (const width of [320, 390]) {
|
||||
test(`Resources ${width}px: таблица после прокрутки и поиск`, async ({ page }) => {
|
||||
await page.setViewportSize({ width, height: 844 })
|
||||
await resourceSetup(page)
|
||||
const search = page.getByPlaceholder('Поиск по имени, площадке…')
|
||||
await search.scrollIntoViewIfNeeded()
|
||||
await search.fill('Источник')
|
||||
await expect(page.locator('tr[data-row-id]')).toHaveCount(1)
|
||||
const cpu = page.getByRole('button', { name: 'CPU', exact: true })
|
||||
await cpu.click()
|
||||
await expect(cpu).toBeInViewport()
|
||||
const viewport = page.locator('[data-slot="data-grid"] [data-slot="scroll-area-viewport"]')
|
||||
await viewport.evaluate(el => { el.scrollLeft = el.scrollWidth })
|
||||
await expect(page.getByRole("columnheader").last()).toBeInViewport()
|
||||
const lastValue = page.locator("tr[data-row-id] td").last().locator("span").last()
|
||||
await lastValue.scrollIntoViewIfNeeded()
|
||||
await expect(lastValue).toBeInViewport()
|
||||
const home = page.getByRole("button", { name: "Home Router", exact: true })
|
||||
const bounds = await home.boundingBox()
|
||||
expect(bounds!.x + bounds!.width).toBeLessThanOrEqual(width)
|
||||
await page.screenshot({ path: `test-results/resources-table-${width}.png`, animations: 'disabled' })
|
||||
await search.fill('нет-совпадений')
|
||||
await expect(page.getByText('Ничего не найдено', { exact: true })).toBeVisible()
|
||||
await search.clear()
|
||||
await expect(page.locator('tr[data-row-id]')).toHaveCount(1)
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user