fix(backups): показывать ошибки диалогов на узких экранах
This commit is contained in:
1 parent
b74084b67c
commit
ad457b90a9
11 files changed
+53
-5
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
import { backup, setupBackups } from "./fixtures/backups"
|
||||
for (const [name, width] of [["desktop", 1440], ["mobile", 390], ["narrow", 320]] as const) test("Бэкапы: длинный файл и ошибки диалогов/" + name, async ({ page }) => {
|
||||
await page.setViewportSize({ width, height: 900 }); await setupBackups(page)
|
||||
const filename = "a".repeat(130) + ".rsc"
|
||||
await page.route("**/api/backups", r => r.fulfill({ json: [{ ...backup, filename }] }))
|
||||
await page.route("**/api/backups/backup-1", r => r.fulfill({ status: 503, json: { error: "Хранилище не подтвердило удаление. Запись резервной копии сохранена." } }))
|
||||
await page.route("**/api/backups/backup-1/restore", r => r.fulfill({ status: 502, json: { outcome: "unknown", error: "Связь с роутером оборвалась после отправки импорта." } }))
|
||||
await page.goto("/backups"); await page.getByRole("button", { name: "Удалить " + filename, exact: true }).click()
|
||||
const dialog = page.getByRole("alertdialog"); await dialog.getByRole("button", { name: "Удалить", exact: true }).click(); await expect(dialog).toContainText("Запись резервной копии сохранена")
|
||||
expect(await dialog.evaluate(element => element.scrollWidth <= element.clientWidth + 1)).toBe(true)
|
||||
await page.screenshot({ path: "docs/ux-ui/screens/backups-delete-error-" + name + ".png", fullPage: true })
|
||||
await dialog.getByRole("button", { name: "Отмена", exact: true }).click(); await page.getByRole("button", { name: "Восстановить " + filename, exact: true }).click()
|
||||
await dialog.getByRole("button", { name: "Восстановить", exact: true }).click(); await expect(dialog).toContainText("Результат импорта неизвестен"); await expect(dialog.getByRole("button", { name: "Восстановить", exact: true })).toBeDisabled()
|
||||
expect(await dialog.evaluate(element => element.scrollWidth <= element.clientWidth + 1)).toBe(true)
|
||||
const box = await dialog.boundingBox(); expect(box && box.x >= 0 && box.y >= 0 && box.x + box.width <= width + 1 && box.y + box.height <= 901).toBe(true)
|
||||
await page.screenshot({ path: "docs/ux-ui/screens/backups-restore-unknown-" + name + ".png", fullPage: true })
|
||||
await page.keyboard.press("Escape"); await expect(dialog).toHaveCount(0)
|
||||
})
|
||||
Reference in new issue
Block a user