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>
105 lines
4.9 KiB
TypeScript
105 lines
4.9 KiB
TypeScript
import { expect, test } from "./support/deployed-test";
|
|
import crypto from "node:crypto";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { FIXTURES, REPO_ROOT, gotoApp, openProject, receipt, shot, waitEngineBoot, waitEngineReady } from "./support/deployed";
|
|
|
|
/**
|
|
* Preflight for the deployed origin.
|
|
*
|
|
* Two different questions live here: "does the server hand out the build this
|
|
* repository produced" (HTTP level, no browser needed) and "does a real headed
|
|
* browser reach a working engine" (UI level). Both are gates for the rest of
|
|
* the suite; a failure here means the later chapters prove nothing.
|
|
*/
|
|
test.describe.configure({ mode: "serial" });
|
|
test.use({ viewport: { width: 1600, height: 900 } });
|
|
|
|
function localWasmPath(): string | null {
|
|
for (const candidate of ["web/dist/vendor/blender/web_engine.wasm", "web/app/public/vendor/blender/web_engine.wasm"]) {
|
|
const file = path.join(REPO_ROOT, candidate);
|
|
if (fs.existsSync(file)) return file;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
test("[preflight-http] @smoke 线上入口提供隔离响应头、引擎清单与手册页", async ({ request }, testInfo) => {
|
|
const origin = process.env.WEB_ORIGIN ?? "https://49.232.250.35:58014";
|
|
|
|
const index = await request.get("/");
|
|
expect(index.status(), `${origin}/`).toBe(200);
|
|
const headers = index.headers();
|
|
expect(headers["cross-origin-opener-policy"]).toBe("same-origin");
|
|
expect(headers["cross-origin-embedder-policy"]).toBe("require-corp");
|
|
expect(headers["cross-origin-resource-policy"]).toBe("same-origin");
|
|
expect(headers["content-security-policy"] ?? "").toContain("wasm-unsafe-eval");
|
|
const indexEtag = headers["etag"] ?? null;
|
|
|
|
const manifestResponse = await request.get("/wasm-module-manifest.json");
|
|
expect(manifestResponse.status()).toBe(200);
|
|
const manifest = await manifestResponse.json() as {
|
|
releaseId?: string;
|
|
modules: Array<{ id: string; resources: { single?: { sha256?: string } } }>;
|
|
};
|
|
expect(typeof manifest.releaseId).toBe("string");
|
|
const engine = manifest.modules.find((module) => module.id === "debug-incremental") ?? manifest.modules[0];
|
|
const remoteWasm = engine?.resources?.single?.sha256 ?? null;
|
|
expect(remoteWasm, "engine manifest must pin a wasm hash").toBeTruthy();
|
|
|
|
/* Bind the live bytes to the locally built artifact. */
|
|
const wasmFile = localWasmPath();
|
|
expect(wasmFile, "a local web build must exist to compare against").toBeTruthy();
|
|
const localWasm = crypto.createHash("sha256").update(fs.readFileSync(wasmFile!)).digest("hex");
|
|
expect(remoteWasm, "deployed wasm must be the local build").toBe(localWasm);
|
|
|
|
const manual = await request.get("/manuals/index.html");
|
|
expect(manual.status()).toBe(200);
|
|
|
|
const range = await request.get("/vendor/blender/web_engine.wasm", { headers: { Range: "bytes=0-15" } });
|
|
expect(range.status()).toBe(206);
|
|
expect(range.headers()["content-type"]).toBe("application/wasm");
|
|
expect((await range.body()).byteLength).toBe(16);
|
|
|
|
const evidence = await shotlessReceipt(testInfo, {
|
|
workflow: "HTTP preflight: isolation headers, wasm manifest hash vs local build, manual page, range request",
|
|
origin, releaseId: manifest.releaseId, remoteWasm, localWasm, indexEtag,
|
|
status: "PASS",
|
|
});
|
|
expect(evidence.releaseId).toBeTruthy();
|
|
});
|
|
|
|
/** HTTP-only cases have no page to photograph; keep the same receipt shape. */
|
|
function shotlessReceipt(testInfo: Parameters<typeof receipt>[0], data: Record<string, unknown>) {
|
|
receipt(testInfo, data);
|
|
return data;
|
|
}
|
|
|
|
test("[preflight-boot] @smoke 有头浏览器加载引擎并进入 SceneIR", async ({ page }, testInfo) => {
|
|
await gotoApp(page, "web");
|
|
const status = await waitEngineBoot(page);
|
|
const isolation = await page.evaluate(() => ({
|
|
secureContext: window.isSecureContext,
|
|
crossOriginIsolated: window.crossOriginIsolated,
|
|
webdriver: navigator.webdriver,
|
|
}));
|
|
expect(isolation.secureContext).toBe(true);
|
|
expect(isolation.crossOriginIsolated).toBe(true);
|
|
const image = await shot(page, testInfo, "booted");
|
|
receipt(testInfo, {
|
|
workflow: "headed Chromium -> /?ui=web -> WASM ABI ready -> engine left the starting state",
|
|
engineStatus: status, isolation, screenshot: image, status: "PASS",
|
|
});
|
|
});
|
|
|
|
test("[preflight-fixture] 练习工程可打开且对象数正确", async ({ page }, testInfo) => {
|
|
await gotoApp(page, "web");
|
|
const engineStatus = await openProject(page, FIXTURES.studio, { objects: 6, active: /PBR Studio Ground/ });
|
|
await expect(page.getByTestId("scene-stats")).toContainText(/Objects 6/, { timeout: 15_000 });
|
|
const stats = (await page.getByTestId("scene-stats").innerText()).trim();
|
|
const image = await shot(page, testInfo, "studio-open");
|
|
receipt(testInfo, {
|
|
workflow: "upload web/app/public/tutorial/pbr/studio.blend -> SceneIR -> Objects 6",
|
|
engineStatus, fixture: path.relative(REPO_ROOT, FIXTURES.studio), sceneStats: stats, screenshot: image, status: "PASS",
|
|
});
|
|
});
|