Outliner: react-accessible-treeview's controlled expandedIds sync expands a node together with its parent, then the next pass treats that extra parent id as removed from the controlled set and collapses the whole branch. Reproduced as a collapsed tree after ch11 -> ch12 (scene rows complete in React, one collapsed row in the DOM). Keep OUTLINER_ROOT_ID in the controlled set so both passes agree, and drop the rows-digest memo that regressed the normal path. Also arm a bounded post-open OUTLINER_REFRESH loop so the tree settles on rows of the newly opened Main instead of the previous one. Tests: web/playwright.deployed.config.ts + web/tests/deployed walk the 31 manual chapters and the 31 capability rows headed against a deployed origin, and tools/web/run-deployed-functional-tests.mjs preflights, runs and reports. --local serves the production bundle from web/dist on loopback with the same COOP/COEP/CORP/CSP headers, so a case costs compile time instead of a 300 MB download: full local suite 60/60 in 10.3 min, also 60/60 against the deployed release. Report dirs are resolved absolute and [ch28a]-style tags map to their chapter. Area layout: split from the clamped source rect and keep the area switcher inside a narrow header. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
79 lines
3.9 KiB
TypeScript
79 lines
3.9 KiB
TypeScript
import { expect, test } from "./support/deployed-test";
|
|
import { REPO_ROOT, gotoApp, receipt, shot, waitEngineBoot } from "./support/deployed";
|
|
import { CHAPTERS } from "./support/chapters";
|
|
|
|
/**
|
|
* The shipped documentation surfaces: the generated manual page and the course
|
|
* landings. These are what a user reads first, so they are part of the deployed
|
|
* surface even though they exercise no engine.
|
|
*/
|
|
test.use({ viewport: { width: 1600, height: 900 } });
|
|
|
|
test("[manual-page] 手册页呈现 31 章并可搜索", async ({ page }, testInfo) => {
|
|
await page.goto("/manuals/index.html", { waitUntil: "domcontentloaded", timeout: 20_000 });
|
|
|
|
const chapters = page.locator(".manual-chapter");
|
|
await expect(chapters).toHaveCount(CHAPTERS.length, { timeout: 15_000 });
|
|
const navLinks = page.locator(".manual-nav a[data-nav-id]");
|
|
expect(await navLinks.count(), "navigation lists every section").toBeGreaterThanOrEqual(CHAPTERS.length);
|
|
|
|
const search = page.getByLabel("搜索手册", { exact: true });
|
|
await search.fill("相机");
|
|
await expect(page.locator(".manual-search-status")).toContainText("匹配", { timeout: 30_000 });
|
|
await expect.poll(async () => page.locator(".manual-nav a[data-nav-id][hidden]").count(), { timeout: 30_000 }).toBeGreaterThan(0);
|
|
await search.fill("");
|
|
|
|
const firstImage = await page.locator("figure img").first().evaluate((image) => (image as HTMLImageElement).naturalWidth).catch(() => 0);
|
|
expect(firstImage, "step images are served").toBeGreaterThan(0);
|
|
|
|
const image = await shot(page, testInfo, "manual-index");
|
|
receipt(testInfo, {
|
|
workflow: "/manuals/index.html -> chapter count, search filter, first figure",
|
|
chapters: await chapters.count(), firstImageWidth: firstImage, screenshot: image, status: "PASS",
|
|
});
|
|
});
|
|
|
|
test("[manual-entry] 帮助菜单打开网页版手册", async ({ page, context }, testInfo) => {
|
|
await gotoApp(page, "web");
|
|
await waitEngineBoot(page);
|
|
await page.getByRole("button", { name: "帮助", exact: true }).click();
|
|
const popupPromise = context.waitForEvent("page", { timeout: 15_000 });
|
|
await page.getByRole("menuitem", { name: "使用手册(网页版)", exact: true }).click({ timeout: 15_000 });
|
|
const popup = await popupPromise;
|
|
await popup.waitForLoadState("domcontentloaded");
|
|
expect(popup.url()).toContain("/manuals/index.html");
|
|
await expect(popup.locator(".manual-chapter")).toHaveCount(CHAPTERS.length, { timeout: 15_000 });
|
|
|
|
const image = await shot(page, testInfo, "manual-from-help");
|
|
receipt(testInfo, {
|
|
workflow: "帮助 → 使用手册(网页版) opens /manuals/index.html with every chapter",
|
|
url: popup.url(), screenshot: image, status: "PASS",
|
|
});
|
|
});
|
|
|
|
test("[course-landing] 课程入口可达并可开始学习", async ({ page }, testInfo) => {
|
|
for (const course of ["pbr", "parts"]) {
|
|
await page.goto(`/?tutorial=${course}`, { waitUntil: "domcontentloaded", timeout: 20_000 });
|
|
const start = page.getByRole("button", { name: /开始学习|继续学习/ });
|
|
await expect(start, `${course} landing has a start button`).toBeVisible({ timeout: 15_000 });
|
|
}
|
|
const image = await shot(page, testInfo, "course-landing");
|
|
receipt(testInfo, {
|
|
workflow: "/?tutorial=pbr and /?tutorial=parts landing pages offer 开始学习",
|
|
screenshot: image, status: "PASS",
|
|
});
|
|
});
|
|
|
|
test("[manual-source] 手册源文件与线上页一章不多一章不少", async ({ request }, testInfo) => {
|
|
const response = await request.get("/manuals/index.html");
|
|
expect(response.status()).toBe(200);
|
|
const html = await response.text();
|
|
const ids = Array.from(html.matchAll(/id="(ch\d{2})"/g), (match) => match[1]);
|
|
const unique = [...new Set(ids)];
|
|
expect(unique.sort()).toEqual(CHAPTERS.map((chapter) => chapter.id).sort());
|
|
receipt(testInfo, {
|
|
workflow: "compare chapter anchors in the served manual page against manual.json",
|
|
chapters: unique.length, source: REPO_ROOT, status: "PASS",
|
|
});
|
|
});
|