- Web engine CMake: apply WITH_WEB_USD_PYTHON to blender_web_engine_core, embed /usd resources, link pxr Python bindings after the core archive and whole-archive the monolithic OpenUSD archive. Fixes the wm.usd_export abort and restores Alembic/USD embedded export. - ?ui=web menus: fix inverted localOnly gating and route queueLocalDesktopOperator and nativeAdd through the desktop operator channel with a VIEW_3D context; non-mesh edit-mode selection uses the native VIEW3D_SELECT bridge. - Refresh WebEngine wasm/js artifacts, manual/course pages and the complete course video asset. - Record focused Chromium probes for Add/F3/parameters/modifier/UV/curve/deform, scene operations, OPFS save/reopen and worker restart. Evidence is NOT_CLAIMED. Co-Authored-By: Claude Code <noreply@anthropic.com>
373 lines
24 KiB
JavaScript
373 lines
24 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Complete-feature walkthrough against the real ?ui=web product, using the RE
|
|
* 5000PBR derived libraries and re/猴头.glb.
|
|
*
|
|
* Usage:
|
|
* DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome GPU_MODE=hardware \
|
|
* node tools/web/complete/capture-complete-course.mjs --port 5184 --gpu hardware
|
|
* node tools/web/complete/capture-complete-course.mjs --module M11 --port 5184
|
|
*
|
|
* Outputs:
|
|
* tests/golden/COMPLETE-TUTORIAL-001/walkthrough/Mxx/*.jpg
|
|
* web/app/public/tutorial/complete/steps/Mxx-*.jpg
|
|
* tests/golden/COMPLETE-TUTORIAL-001/capture-report.json
|
|
*/
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import {
|
|
REPO, ASSETS, parseArgs, waitForServer, launchBrowser, newPage,
|
|
openFile, waitScene, switchWorkspace, domClick, shot,
|
|
} from "../course/lib/lesson-recorder.mjs";
|
|
|
|
const args = parseArgs();
|
|
const BASE = args.baseUrl || `http://127.0.0.1:${args.port}`;
|
|
const OUT = args.out;
|
|
const WALK = path.join(OUT, "walkthrough");
|
|
const STEPS = path.join(REPO, "web/app/public/tutorial/complete/steps");
|
|
const only = args.modules ? new Set(args.modules.split(",").map((item) => item.trim()).filter(Boolean)) : null;
|
|
fs.mkdirSync(WALK, { recursive: true });
|
|
fs.mkdirSync(STEPS, { recursive: true });
|
|
|
|
const report = { schemaVersion: 1, task: "COMPLETE-TUTORIAL-001", lane: args.lane, gpu: args.gpu, baseUrl: BASE, startedAt: new Date().toISOString(), modules: [], gaps: [] };
|
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
await waitForServer(`${BASE}/?ui=web`);
|
|
const browser = await launchBrowser(args.gpu);
|
|
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
|
// Optional UI probes should fail fast; explicit waits set their own budgets.
|
|
page.setDefaultTimeout(8_000);
|
|
|
|
const workspace = async (name) => {
|
|
await domClick(page.locator(".workspace-tabs button", { hasText: name }).first());
|
|
await sleep(450);
|
|
};
|
|
|
|
const dblClickAsset = async (material) => {
|
|
await material.scrollIntoViewIfNeeded().catch(() => {});
|
|
await material.evaluate((element) => {
|
|
element.dispatchEvent(new MouseEvent("dblclick", { bubbles: true, cancelable: true, view: window }));
|
|
});
|
|
await sleep(4000);
|
|
};
|
|
|
|
const baseline = async () => {
|
|
await openFile(page, ASSETS.studio);
|
|
await waitScene(page, { objects: 6, timeout: 180_000 });
|
|
await openFile(page, ASSETS.monkey);
|
|
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180_000 });
|
|
};
|
|
|
|
const ensureMonkey = async () => {
|
|
const stats = await page.getByTestId("scene-stats").innerText();
|
|
if (!/Objects 7/.test(stats)) await openFile(page, ASSETS.monkey);
|
|
await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180_000 });
|
|
};
|
|
|
|
const enterEdit = async () => {
|
|
const chip = page.locator(".mode-chip button").first();
|
|
const label = await chip.innerText().catch(() => "");
|
|
if (/Edit Mode|编辑模式/.test(label)) return;
|
|
await domClick(chip);
|
|
const item = page.getByRole("menuitemcheckbox", { name: /编辑模式|Edit Mode/ }).first();
|
|
await item.waitFor({ timeout: 20_000 });
|
|
await item.click();
|
|
await sleep(1200);
|
|
};
|
|
|
|
const menu = async (name) => {
|
|
await domClick(page.getByRole("button", { name, exact: true }).first());
|
|
await sleep(350);
|
|
};
|
|
|
|
const saveOpfs = async () => {
|
|
await domClick(page.locator('button[aria-label="保存项目"]'));
|
|
await page.waitForFunction(() => document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status") === "SUCCEEDED", null, { timeout: 180_000 });
|
|
};
|
|
|
|
const renderPbr = async () => {
|
|
const button = page.getByRole("button", { name: /渲染 PBR|Render PBR/ }).first();
|
|
await button.waitFor({ timeout: 60_000 });
|
|
await domClick(button);
|
|
await page.waitForTimeout(9000);
|
|
};
|
|
|
|
const loadReLibrary = async () => {
|
|
await workspace("Shading");
|
|
await page.locator(".pbr-asset-library").waitFor({ timeout: 60_000 });
|
|
await page.locator('select[aria-label="资产来源"]').selectOption("library:re-pbr-v1");
|
|
await page.waitForFunction(() => document.querySelectorAll('[data-library="library:re-pbr-v1"]').length === 6, null, { timeout: 60_000 });
|
|
};
|
|
|
|
const ensureObjectMode = async () => {
|
|
const chip = page.locator(".mode-chip button").first();
|
|
if (!(await chip.count())) return;
|
|
await domClick(chip);
|
|
const objectMode = page.getByRole("menuitemcheckbox", { name: /物体模式|Object Mode/ }).first();
|
|
if (await objectMode.count()) await objectMode.click().catch(() => {});
|
|
await sleep(1200);
|
|
};
|
|
|
|
const waitMaterialAssigned = (name) => page.waitForFunction((expected) => {
|
|
const slot = document.querySelector('select[aria-label^="材质槽"]');
|
|
return slot instanceof HTMLSelectElement && slot.value.includes(expected);
|
|
}, name, { timeout: 120_000 });
|
|
|
|
const assignMaterial = async (name = "black_tiles_wall") => {
|
|
const material = page.locator('[data-library="library:re-pbr-v1"]', { hasText: name }).first();
|
|
if (!(await material.count())) throw new Error(`asset card missing: ${name}`);
|
|
await dblClickAsset(material);
|
|
try { await waitMaterialAssigned(name); }
|
|
catch {
|
|
// The catalog can expose cards before the OPFS payload finishes seeding.
|
|
await sleep(2000);
|
|
await dblClickAsset(material);
|
|
await waitMaterialAssigned(name);
|
|
}
|
|
};
|
|
|
|
const runStep = async (moduleId, name, fn) => {
|
|
const dir = path.join(WALK, moduleId);
|
|
await fn();
|
|
const file = await shot(page, dir, name);
|
|
fs.mkdirSync(STEPS, { recursive: true });
|
|
fs.copyFileSync(file.path, path.join(STEPS, `${moduleId}-${name}.jpg`));
|
|
return { name, ...file };
|
|
};
|
|
|
|
const runModule = async (id, title, steps) => {
|
|
if (only && !only.has(id)) return;
|
|
await page.keyboard.press("Escape").catch(() => {});
|
|
await sleep(150);
|
|
const started = Date.now();
|
|
const entry = { id, title, status: "PASS", steps: [], assertions: [], errors: [], gaps: [] };
|
|
try {
|
|
for (const [name, fn] of steps) entry.steps.push(await runStep(id, name, fn));
|
|
}
|
|
catch (error) {
|
|
entry.status = "FAIL";
|
|
entry.errors.push(error instanceof Error ? error.message : String(error));
|
|
try { entry.steps.push(await runStep(id, "error", async () => {})); } catch { /* ignore */ }
|
|
report.gaps.push({ module: id, kind: "capability", reason: entry.errors[0] });
|
|
}
|
|
entry.assertions.push({ name: "app-alive", ok: (await page.locator("main.blender-app").count()) > 0 });
|
|
const statsText = await page.getByTestId("scene-stats").innerText().catch(() => "");
|
|
entry.assertions.push({ name: "scene-stats", value: statsText, ok: /Objects\s+\d+/.test(statsText) });
|
|
entry.durationMs = Date.now() - started;
|
|
report.modules.push(entry);
|
|
console.log(`${id} ${entry.status} ${entry.durationMs}ms${entry.errors.length ? ` ${entry.errors[0].split("\n")[0]}` : ""}`);
|
|
};
|
|
|
|
try {
|
|
await runModule("M01", "工程、导入与 OPFS", [
|
|
["startup", async () => { await workspace("Layout"); }],
|
|
["import-monkey", async () => { await baseline(); }],
|
|
["opfs-save", saveOpfs],
|
|
["reopen", async () => {
|
|
const close = page.locator('button[aria-label="关闭项目"]').first();
|
|
if (await close.count()) await close.click().catch(() => {});
|
|
await sleep(800);
|
|
const discard = page.getByRole("button", { name: "不保存,继续" }).first();
|
|
if (await discard.count()) await discard.click().catch(() => {});
|
|
const recent = page.locator('select[data-testid="recent-projects"]').first();
|
|
if (await recent.count()) {
|
|
const values = await recent.locator("option").evaluateAll((options) => options.map((option) => option.value).filter(Boolean));
|
|
if (values.length > 0) await recent.selectOption(values[values.length - 1]);
|
|
}
|
|
await waitScene(page, { objects: 7, timeout: 180_000 });
|
|
}],
|
|
["download", async () => {
|
|
const download = page.waitForEvent("download", { timeout: 60_000 }).catch(() => null);
|
|
await domClick(page.locator('button[aria-label="下载 .blend"]')).catch(() => {});
|
|
await download;
|
|
await sleep(500);
|
|
}],
|
|
]);
|
|
|
|
await runModule("M02", "界面、工作区与视口", [
|
|
["workspaces", async () => { await workspace("Layout"); }],
|
|
["area-menu", async () => {
|
|
const frame = page.locator(".workspace-grid > .area-frame").first();
|
|
await frame.locator(".area-type-switch .area-menu button").first().evaluate((element) => element.click());
|
|
await sleep(300);
|
|
}],
|
|
["viewport", async () => { await page.keyboard.press("Escape"); await workspace("Layout"); }],
|
|
["f3", async () => {
|
|
await domClick(page.getByRole("button", { name: "操作搜索" }));
|
|
await page.getByLabel("搜索 Blender 操作").fill("移动");
|
|
await sleep(400);
|
|
}],
|
|
]);
|
|
|
|
await runModule("M03", "Outliner、对象与层级", [
|
|
["select", async () => { await page.keyboard.press("Escape"); await workspace("Layout"); const row = page.locator(".outliner-row").first(); if (await row.count()) await domClick(row); await sleep(300); }],
|
|
["rename", async () => { await page.keyboard.press("F2").catch(() => {}); await sleep(300); await page.keyboard.press("Escape").catch(() => {}); }],
|
|
["visibility", async () => { const eye = page.locator('.outliner-row button[aria-label*="可见"], .outliner-row button[title*="可见"]').first(); if (await eye.count()) await domClick(eye).catch(() => {}); await sleep(300); }],
|
|
["parent", async () => { await page.keyboard.press("Escape"); await menu("物体").catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M04", "Properties、变换、相机与灯光", [
|
|
["transform", async () => { await page.keyboard.press("Escape"); await workspace("Layout"); await page.getByText("Transform", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); }],
|
|
["apply", async () => { await menu("物体").catch(() => {}); await sleep(300); }],
|
|
["camera", async () => { await page.keyboard.press("Escape"); await page.keyboard.press("Numpad0").catch(() => {}); await sleep(500); }],
|
|
["light", async () => { await page.keyboard.press("Escape"); await page.getByText("Light", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M05", "建模与网格编辑", [
|
|
["primitive", async () => { await workspace("Modeling"); await menu("添加").catch(() => {}); await sleep(300); }],
|
|
["edit-mode", async () => { await page.keyboard.press("Escape"); await enterEdit(); }],
|
|
["tools", async () => { await page.getByText(/选择工具|更多网格|模态工具/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["normals", async () => { await page.getByText(/更多网格|高级网格/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M06", "修改器栈", [
|
|
["add", async () => { await workspace("Layout"); await ensureMonkey(); await domClick(page.locator(".property-tabs").getByRole("button").nth(1)).catch(() => {}); await sleep(400); }],
|
|
["stack", async () => { await page.getByText("Modifiers", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["order", async () => { await page.getByText("Modifiers", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["apply", async () => { await page.getByText("Modifiers", { exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M07", "雕刻", [
|
|
["brush", async () => { await workspace("Sculpting"); await page.getByTestId("sculpt-editor").scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
|
["stroke", async () => { await page.getByTestId("sculpt-editor").scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["mask", async () => { await page.getByLabel("Sculpt mask").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["remesh", async () => { await page.getByLabel("Sculpt remesh voxel size").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M08", "UV 编辑", [
|
|
["workspace", async () => { await workspace("UV Editing"); await page.locator(".wasm-uv-editor").waitFor({ timeout: 60_000 }); await enterEdit(); await page.keyboard.press("Escape"); }],
|
|
["unwrap", async () => {
|
|
const uv = page.locator(".wasm-uv-editor");
|
|
const all = uv.locator("button", { hasText: "全选 UV" }).first();
|
|
if (await all.count()) { await domClick(all); await page.waitForTimeout(1500); }
|
|
const unwrap = uv.locator("button", { hasText: "展开所选 UV" }).first();
|
|
if (await unwrap.count()) { await domClick(unwrap); await page.waitForTimeout(2500); }
|
|
}],
|
|
["pack", async () => { const pack = page.locator(".wasm-uv-editor button", { hasText: /打包|Pack/ }).first(); if (await pack.count()) await domClick(pack).catch(() => {}); await sleep(800); }],
|
|
["save", saveOpfs],
|
|
]);
|
|
|
|
await runModule("M09", "纹理绘制", [
|
|
["workspace", async () => { await workspace("Texture Paint"); await page.getByTestId("texture-paint-canvas").waitFor({ timeout: 60_000 }).catch(() => {}); }],
|
|
["stroke", async () => {
|
|
const canvas = page.getByTestId("texture-paint-canvas").first();
|
|
if (await canvas.count()) {
|
|
const box = await canvas.boundingBox();
|
|
if (box) { await page.mouse.move(box.x + box.width * 0.35, box.y + box.height * 0.45); await page.mouse.down(); await page.mouse.move(box.x + box.width * 0.62, box.y + box.height * 0.55, { steps: 16 }); await page.mouse.up(); await page.waitForTimeout(1800); }
|
|
}
|
|
}],
|
|
["undo", async () => { await page.keyboard.press("Control+z").catch(() => {}); await sleep(600); }],
|
|
["make-local", async () => { await page.getByText(/设为本地|Make Local/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M10", "曲线、文本与 Grease Pencil", [
|
|
["add", async () => { await workspace("Layout"); await menu("添加").catch(() => {}); await sleep(300); }],
|
|
["text", async () => { await page.keyboard.press("Escape"); await page.getByText("Text", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["font", async () => { await page.getByText(/Font|字体/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["grease-pencil", async () => { await page.getByTestId("grease-pencil-editor").scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M11", "Shading 与 RE 5000PBR", [
|
|
["library", loadReLibrary],
|
|
["assign", async () => { await ensureObjectMode(); await assignMaterial(); }],
|
|
["compiled", async () => { await page.locator(".material-preview-status").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["hq", async () => { const hq = page.getByRole("button", { name: /加载高清贴图/ }).first(); if (await hq.count()) { await hq.scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); } }],
|
|
]);
|
|
|
|
await runModule("M12", "PBR 渲染与诊断", [
|
|
["panel", async () => { await workspace("Rendering"); await page.waitForTimeout(800); await page.getByText("PBR 渲染练习", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); }],
|
|
["render", renderPbr],
|
|
["diagnostics", async () => { const diag = page.locator('select[aria-label="PBR 诊断视图"]').first(); if (await diag.count()) { await diag.selectOption("NORMAL"); await page.waitForTimeout(2500); } }],
|
|
["download", async () => { const link = page.locator(".pbr-render-download").first(); if (await link.count()) { const pending = page.waitForEvent("download", { timeout: 30_000 }).catch(() => null); await domClick(link).catch(() => {}); await pending; } await sleep(400); }],
|
|
]);
|
|
|
|
await runModule("M13", "动画、Graph/NLA 与播放", [
|
|
["keyframes", async () => { await workspace("Animation"); const key = page.getByRole("button", { name: "插入位置关键帧", exact: true }).first(); if (await key.count()) { await domClick(key); await page.waitForTimeout(800); } }],
|
|
["playback", async () => { const play = page.getByRole("button", { name: "播放", exact: true }).first(); if (await play.count()) { await domClick(play); await page.waitForTimeout(2500); const pause = page.getByRole("button", { name: "暂停", exact: true }).first(); if (await pause.count()) await domClick(pause); } }],
|
|
["graph-nla", async () => { await page.getByText(/NLA|Graph/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
|
["camera", async () => { await page.getByText("Scene Bindings", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M14", "EEVEE/Cycles 后端渲染", [
|
|
["backend", async () => { await workspace("Rendering"); const panel = page.locator(".native-render-fallback").first(); if (await panel.count()) { await panel.evaluate((element) => { element.open = true; }); await sleep(500); } }],
|
|
["render", async () => { await page.locator(".native-render-fallback").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["result", async () => { await page.locator(".native-render-fallback").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M15", "Compositor 合成", [
|
|
["nodes", async () => { await workspace("Compositing"); const canvas = page.getByTestId("compositor-canvas"); await canvas.waitFor({ timeout: 60_000 }); await canvas.getByLabel("添加节点类型").selectOption("CONSTANT_COLOR"); await domClick(canvas.getByRole("button", { name: "添加节点", exact: true })); await sleep(400); }],
|
|
["links", async () => { await page.getByTestId("compositor-canvas").scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["wasm-eval", async () => { const evalButton = page.getByRole("button", { name: "WASM 合成求值" }).first(); if (await evalButton.count()) { await evalButton.scrollIntoViewIfNeeded().catch(() => {}); await domClick(evalButton); await page.waitForTimeout(4000); } }],
|
|
["server", async () => { const server = page.getByRole("button", { name: "服务端合成渲染" }).first(); if (await server.count()) { await server.scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); } }],
|
|
]);
|
|
|
|
await runModule("M16", "Geometry Nodes", [
|
|
["nodes", async () => { await workspace("Geometry Nodes"); const canvas = page.getByTestId("geometry-node-canvas"); await canvas.waitFor({ timeout: 60_000 }); await canvas.getByLabel("添加节点类型").selectOption({ index: 2 }).catch(() => {}); const add = canvas.getByRole("button", { name: "添加节点", exact: true }); if (await add.count()) await domClick(add); await sleep(500); }],
|
|
["commit", async () => { const commit = page.getByTestId("geometry-node-canvas").getByRole("button", { name: "提交图", exact: true }).first(); if (await commit.count()) await domClick(commit).catch(() => {}); await sleep(1200); }],
|
|
["result", async () => { await workspace("Layout"); await ensureMonkey(); }],
|
|
]);
|
|
|
|
await runModule("M17", "Spreadsheet 求值属性", [
|
|
["sources", async () => { await workspace("Geometry Nodes"); const sheet = page.getByTestId("spreadsheet-view"); await sheet.waitFor({ timeout: 60_000 }); await sheet.getByLabel("数据源").selectOption("attributes"); await sleep(500); }],
|
|
["evaluated", async () => { const read = page.getByTestId("spreadsheet-evaluated").first(); if (await read.count()) { await domClick(read); await page.waitForTimeout(4000); } }],
|
|
["csv", async () => { const csv = page.getByTestId("spreadsheet-export").first(); if (await csv.count()) { const pending = page.waitForEvent("download", { timeout: 30_000 }).catch(() => null); await domClick(csv).catch(() => {}); await pending; } await sleep(400); }],
|
|
]);
|
|
|
|
await runModule("M18", "Scripting 与 Python 控制台", [
|
|
["console", async () => { await workspace("Scripting"); await page.waitForTimeout(1000); }],
|
|
["execute", async () => { const input = page.getByLabel("Python 输入").first(); if (await input.count()) await input.fill("import bpy; print([o.name for o in bpy.data.objects])"); const run = page.getByRole("button", { name: "执行 Python" }).first(); if (await run.count()) { await domClick(run); await page.waitForTimeout(2500); } }],
|
|
["reset", async () => { await page.getByRole("button", { name: /重置 Python 会话/ }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M19", "IO 导入", [
|
|
["glb", async () => { await workspace("Layout"); await ensureMonkey(); }],
|
|
["gltf-folder", async () => { await menu("文件").catch(() => {}); await sleep(300); }],
|
|
["obj", async () => { await page.keyboard.press("Escape"); await page.getByText(/导入 OBJ|Import OBJ/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["image-font", async () => { await page.getByText(/图像|VFont|字体/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M20", "IO 导出", [
|
|
["glb", async () => { await page.keyboard.press("Escape"); await menu("文件").catch(() => {}); await sleep(300); }],
|
|
["obj", async () => { await page.keyboard.press("Escape"); await page.getByRole("menuitem", { name: /导出|Export/ }).first().click().catch(() => {}); await sleep(400); }],
|
|
["native", async () => { await page.keyboard.press("Escape"); await page.getByText(/导出模型|Export/).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M21", "物理与模拟", [
|
|
["settings", async () => { await workspace("Layout"); await page.locator('[data-testid="physics-workbench"]').first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
|
["playback", async () => { await page.getByRole("button", { name: "播放", exact: true }).first().click().catch(() => {}); await sleep(1500); }],
|
|
["range", async () => { await page.getByTestId("physics-simulate-range").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
|
]);
|
|
|
|
await runModule("M22", "Sequencer 与本地媒体", [
|
|
["media", async () => { await workspace("Layout"); await page.locator('section[aria-label="Sequencer Strip Editing"]').first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
|
["strip", async () => { const add = page.getByRole("button", { name: "Add Strip", exact: true }).first(); if (await add.count()) await domClick(add).catch(() => {}); await sleep(800); }],
|
|
["edit", async () => { await page.locator('section[aria-label="Sequencer Strip Editing"]').first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(400); }],
|
|
["export", async () => { await page.getByRole("button", { name: "恢复媒体", exact: true }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
]);
|
|
|
|
await runModule("M23", "相机锁定、追踪与遮罩", [
|
|
["camera", async () => { await workspace("Layout"); await page.keyboard.press("Numpad0").catch(() => {}); await sleep(600); }],
|
|
["object-camera", async () => { await page.getByText("Scene Bindings", { exact: false }).first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(300); }],
|
|
["tracking", async () => { await page.getByTestId("tracking-mask-workbench").first().scrollIntoViewIfNeeded().catch(() => {}); await sleep(500); }],
|
|
]);
|
|
|
|
await runModule("M24", "偏好设置、键位与主题", [
|
|
["preferences", async () => { await menu("编辑").catch(() => {}); await page.getByRole("menuitem", { name: "偏好设置" }).first().click().catch(() => {}); await page.getByTestId("preferences-window").waitFor({ timeout: 20_000 }); await sleep(400); }],
|
|
["keymap", async () => { await page.getByRole("button", { name: "键位", exact: true }).click().catch(() => {}); await sleep(300); }],
|
|
["theme", async () => { await page.getByRole("button", { name: "主题", exact: true }).click().catch(() => {}); await sleep(300); }],
|
|
["addons", async () => { await page.getByRole("button", { name: "系统", exact: true }).click().catch(() => {}); await sleep(800); await page.getByRole("button", { name: "关闭偏好设置" }).click().catch(() => {}); }],
|
|
]);
|
|
}
|
|
finally {
|
|
report.consoleErrors = consoleErrors;
|
|
report.finishedAt = new Date().toISOString();
|
|
report.status = report.modules.every((module) => module.status === "PASS") ? "PASS" : "PARTIAL";
|
|
fs.mkdirSync(OUT, { recursive: true });
|
|
fs.writeFileSync(path.join(OUT, "capture-report.json"), `${JSON.stringify(report, null, 2)}\n`);
|
|
await context.close();
|
|
await browser.close();
|
|
const failures = report.modules.filter((module) => module.status !== "PASS");
|
|
console.log(JSON.stringify({ status: report.status, modules: report.modules.length, failures: failures.map((module) => module.id), report: path.join(OUT, "capture-report.json") }, null, 2));
|
|
process.exitCode = failures.length === 0 ? 0 : 1;
|
|
}
|