sdlc-hub/web/e2e/layout.spec.ts
Andrey Epifancev 8062dc7668 Веб: «Связи» на /app/jira/links, условные пункты меню (#108)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 19:41:32 +04:00

99 lines
6.0 KiB
TypeScript
Raw Permalink 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\/jira\/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\/jira\/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);
});
test("C-1: на средних ширинах страница не шире окна — «Задачи» на 1280, доска на 1000 прокручивается сама", async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 });
await login(page, "/app/jira/issues");
await expect(page.locator("table.issue-table tbody tr").first()).toBeVisible();
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(1280);
await page.setViewportSize({ width: 1000, height: 800 });
await page.getByRole("link", { name: "Связи" }).click();
await expect(page.locator(".board .card[data-key]").first()).toBeVisible();
await page.getByRole("button", { name: "По датам" }).click();
await expect(page.locator(".dcol").first()).toBeVisible();
await expect.poll(() => page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(1000);
await expect(page.getByRole("button", { name: /Проблемы/ })).toBeInViewport();
const wrap = page.locator(".wrap");
expect(await wrap.evaluate((el) => el.scrollWidth > el.clientWidth)).toBe(true); // доска шире своей рамки — прокрутка внутри
});
test("1440 px: «Задачи» не шире окна, h1 «Вики» — 20px", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 900 });
await login(page, "/app/jira/issues");
await expect(page.locator("table.issue-table tbody tr").first()).toBeVisible();
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
await page.getByRole("complementary", { name: "Панель приложения" }).getByRole("link", { name: "Вики" }).click();
await expect(page).toHaveURL(/\/app\/wiki\?project=AWPCA$/);
const h1 = page.getByRole("heading", { level: 1, name: "Вики" });
await expect(h1).toBeVisible();
expect(await h1.evaluate((el) => getComputedStyle(el).fontSize)).toBe("20px");
});
test("/app/board → /app/jira/links с сохранением search", async ({ page }) => {
await login(page);
await page.goto("/app/board?project=AWPCA");
await expect(page).toHaveURL(/\/app\/jira\/links\?project=AWPCA$/);
});
test("/app/jira/board → /app/jira/links с сохранением search", async ({ page }) => {
await login(page);
await page.goto("/app/jira/board?project=AWPCA");
await expect(page).toHaveURL(/\/app\/jira\/links\?project=AWPCA$/);
});
test("390 px: метка проекта в верхней строке, «Меню» модально", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 800 });
await login(page);
const bar = page.getByRole("banner", { name: "Строка приложения" });
await expect(bar.getByText("AWPCA", { exact: true })).toBeVisible();
await page.getByRole("button", { name: "Меню" }).click();
await expect(page.getByRole("complementary", { name: "Панель приложения" })).toBeVisible();
await expect(bar).toHaveAttribute("inert", "");
await expect(page.locator("main")).toHaveAttribute("inert", "");
await page.keyboard.press("Escape");
await expect(page.getByRole("complementary", { name: "Панель приложения" })).toHaveCount(0);
await expect(bar).not.toHaveAttribute("inert", "");
});