sdlc-hub/web/e2e/layout.spec.ts
Andrey Epifancev 1f74a27cb3 e2e и снимки боковой панели, ARCHITECTURE (#69)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:58:35 +04:00

45 lines
2.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect, test } from "@playwright/test";
import { login } from "./hub.ts";
// оболочка с боковой панелью (#69)
test("панель на месте после прокрутки доски до низа", async ({ page }) => {
await page.setViewportSize({ width: 1600, height: 600 });
await login(page);
await expect(page.locator(".board .card[data-key]").first()).toBeVisible();
const y = await page.evaluate(() => { window.scrollTo(0, document.documentElement.scrollHeight); return window.scrollY; });
expect(y).toBeGreaterThan(100);
const side = page.getByRole("complementary", { name: "Панель приложения" });
await expect(side.getByRole("link", { name: "Задачи" })).toBeInViewport();
await expect(side.getByRole("button", { name: "Обновить из Jira" })).toBeInViewport();
expect((await side.boundingBox())!.y).toBe(0);
});
test("свёрнутая панель переживает перезагрузку, доска шире", async ({ page }) => {
await login(page);
const wrap = page.locator(".wrap");
await expect(wrap).toBeVisible();
const before = (await wrap.boundingBox())!.width;
await page.getByRole("button", { name: "Свернуть панель" }).click();
await page.reload();
await expect(page.getByRole("button", { name: "Развернуть панель", exact: true })).toBeVisible();
await expect.poll(async () => (await wrap.boundingBox())!.width).toBeGreaterThan(before + 150);
await page.getByRole("link", { name: "Задачи" }).click();
await expect(page).toHaveURL(/\/app\/issues\?project=AWPCA$/);
await page.getByRole("button", { name: "Развернуть панель", exact: true }).click();
await expect(page.getByRole("button", { name: "Свернуть панель" })).toBeVisible();
});
test("390 px: «Меню» открывает панель, «Задачи» закрывает её и открывает список; без горизонтальной прокрутки", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 800 });
await login(page);
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
await page.getByRole("button", { name: "Меню" }).click();
const side = page.getByRole("complementary", { name: "Панель приложения" });
await expect(side).toBeVisible();
await side.getByRole("link", { name: "Задачи" }).click();
await expect(page).toHaveURL(/\/app\/issues\?project=AWPCA$/);
await expect(side).toHaveCount(0);
await expect(page.getByTestId("page-issues")).toBeVisible();
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
});