fix(ui): завершить основу таблиц и фильтров серверов
This commit is contained in:
1 parent
f9a4a07996
commit
3d3c45e4d2
24 files changed
+385
-263
No files matched your search
@@ -5,7 +5,7 @@ function server(id: number): ServerRead {
|
||||
return serverReadSchema.parse({
|
||||
id, name: `Проверка ${id}`, host: `192.0.2.${id}`, port: 443,
|
||||
username: "test-user", password: "fixture-only", useSsl: true, verifySsl: true,
|
||||
type: "exit-node", site: "TEST", country: "RU", asn: "", comment: "",
|
||||
type: "exit-node", site: "TEST", country: id === 2 ? "DE" : "RU", asn: "", comment: "",
|
||||
enabled: true, lanSubnet: "", wanUplinks: [],
|
||||
createdAt: "2026-09-13T00:00:00Z", updatedAt: "2026-09-13T00:00:00Z",
|
||||
status: "offline", latency: null, os: "7.20", model: "Test router",
|
||||
@@ -63,6 +63,49 @@ async function finalStep(page: Page) {
|
||||
for (let i = 0; i < 3; i++) await page.getByRole("button", { name: "Далее", exact: true }).click()
|
||||
}
|
||||
|
||||
test("фильтры сервера: применение, AND, изменение и сброс", async ({ page }) => {
|
||||
const errors: string[] = []
|
||||
page.on("pageerror", error => errors.push(error.message))
|
||||
await setup(page)
|
||||
await page.getByRole("button", { name: "Фильтры", exact: true }).click()
|
||||
await page.getByRole("option", { name: "Статус", exact: true }).click()
|
||||
await page.getByRole("option", { name: "равно", exact: true }).click()
|
||||
await page.getByRole("option", { name: "Online", exact: true }).click()
|
||||
await expect(page.getByText("Нет совпадений", { exact: true })).toBeVisible()
|
||||
await page.getByRole("button", { name: "Online", exact: true }).click()
|
||||
await page.getByRole("option", { name: "Offline", exact: true }).click()
|
||||
await expect(page.locator('tr[data-row-id]')).toHaveCount(2)
|
||||
await page.getByRole("button", { name: "Фильтры", exact: true }).click()
|
||||
await page.getByRole("option", { name: "Страна", exact: true }).click()
|
||||
await page.getByRole("option", { name: "равно", exact: true }).click()
|
||||
await page.getByRole("option", { name: "RU", exact: true }).click()
|
||||
await expect(page.locator('tr[data-row-id]')).toHaveCount(1)
|
||||
await expect(page.getByText("Проверка 1", { exact: true })).toBeVisible()
|
||||
await page.screenshot({ path: "test-results/servers-desktop.png", fullPage: true, animations: "disabled" })
|
||||
await page.getByRole("button", { name: "Очистить", exact: true }).click()
|
||||
await expect(page.locator('tr[data-row-id]')).toHaveCount(2)
|
||||
expect(errors).toEqual([])
|
||||
})
|
||||
|
||||
test("мобильный эталон: клавиатура, Escape и раскрытие", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
await setup(page)
|
||||
const filters = page.getByRole("button", { name: "Фильтры", exact: true })
|
||||
await filters.focus()
|
||||
await page.keyboard.press("Enter")
|
||||
await expect(page.getByRole("combobox", { name: "Поиск поля…" })).toBeFocused()
|
||||
await page.keyboard.press("Escape")
|
||||
await expect(filters).toBeFocused()
|
||||
const expand = page.getByRole("button", { name: "Раскрыть: Проверка 1", exact: true })
|
||||
await expand.focus()
|
||||
await page.keyboard.press("Enter")
|
||||
await expect(page.getByText("Модель: Test router", { exact: true })).toBeVisible()
|
||||
await page.getByRole("button", { name: "Свернуть: Проверка 1", exact: true }).press("Enter")
|
||||
await expect(page.getByText("Модель: Test router", { exact: true })).toBeHidden()
|
||||
await page.screenshot({ path: "test-results/servers-mobile.png", fullPage: true, animations: "disabled" })
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true)
|
||||
})
|
||||
|
||||
for (const status of [400, 403, 500]) {
|
||||
test(`ошибка сохранения ${status} сохраняет форму; повтор завершается успешно`, async ({ page }) => {
|
||||
let fail = true
|
||||
|
||||
Reference in new issue
Block a user