sdlc-hub/web/e2e/wiki.spec.ts
Andrey Epifancev 48ca56c07f Веб: страница «Вики» (#91)
Модуль wiki: дерево страниц, страница с Markdown (react-markdown, remark-gfm, без сырого HTML),
поиск, форма привязки корня, ход синхронизации в боковой панели, скачивание вложений,
поле «Корень вики» в окне нового проекта. Сид копии вики и e2e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 03:10:19 +04:00

36 lines
2.4 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";
// копия вики проекта AWPCA засеяна scripts/seed-hub.py: корень и две страницы (одна с вложением)
test("вики: дерево, страница, поиск", async ({ page }) => {
await login(page, "/app/wiki?project=AWPCA");
const tree = page.getByRole("tree", { name: "Страницы вики" });
await expect(tree.getByRole("treeitem")).toHaveCount(3);
await tree.getByRole("treeitem", { name: "Регламент согласования" }).click();
await expect(page).toHaveURL(/page=DOC-9003/);
const article = page.getByRole("article");
await expect(article.getByRole("heading", { name: "Регламент согласования" })).toBeVisible();
await expect(article.getByRole("button", { name: /схема\.txt/ })).toBeVisible();
// ссылка на другую страницу вики меняет адрес и выделенный узел
await article.getByRole("link", { name: "К модели" }).click();
await expect(page).toHaveURL(/page=DOC-9002/);
await expect(tree.getByRole("treeitem", { name: "Модель данных" })).toHaveAttribute("aria-selected", "true");
await expect(page.getByRole("article").locator("table")).toBeVisible();
await page.getByRole("searchbox", { name: "Поиск по вики" }).fill("согласов");
await expect(tree).toHaveCount(0);
await expect(page.getByRole("list", { name: "Результаты поиска" }).getByRole("link")).not.toHaveCount(0);
await page.getByRole("list", { name: "Результаты поиска" }).getByRole("link", { name: /Регламент согласования/ }).click();
await expect(page).toHaveURL(/page=DOC-9003/);
});
test("вики: вложение скачивается через запрос к агенту", async ({ page }) => {
await login(page, "/app/wiki?project=AWPCA&page=DOC-9003");
const req = page.waitForRequest((r) => r.method() === "POST" && /\/wiki\/attachments\/\d+\/fetch$/.test(r.url()));
await page.getByRole("article").getByRole("button", { name: /схема\.txt/ }).click();
await req; // агента в тестовом хабе нет: скачивание остаётся «Загружается…», достаточно, что запрос ушёл
await expect(page.getByRole("article").getByText("Загружается…")).toBeVisible();
});