- 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>
96 lines
5.3 KiB
JavaScript
96 lines
5.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Backend-lane checks for the complete course: real EEVEE render and USD export
|
|
* through the deployment server + native Blender.
|
|
*
|
|
* Usage (dist server on 5176):
|
|
* DISPLAY=:1 CHROME_PATH=/usr/bin/google-chrome GPU_MODE=hardware \
|
|
* node tools/web/complete/capture-complete-backend.mjs --base-url http://127.0.0.1:5176
|
|
*/
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { REPO, ASSETS, parseArgs, 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:5176";
|
|
const OUT = path.join(args.out, "backend");
|
|
fs.mkdirSync(OUT, { recursive: true });
|
|
const report = { schemaVersion: 1, task: "COMPLETE-TUTORIAL-001", lane: "backend", baseUrl: BASE, startedAt: new Date().toISOString(), checks: [] };
|
|
|
|
const browser = await launchBrowser(args.gpu);
|
|
const { context, page, consoleErrors } = await newPage(browser, { baseUrl: BASE });
|
|
page.setDefaultTimeout(15_000);
|
|
|
|
const check = async (id, title, fn) => {
|
|
const started = Date.now();
|
|
const entry = { id, title, status: "PASS" };
|
|
try { entry.result = await fn(); }
|
|
catch (error) { entry.status = "FAIL"; entry.error = error instanceof Error ? error.message : String(error); }
|
|
entry.durationMs = Date.now() - started;
|
|
report.checks.push(entry);
|
|
console.log(`${id} ${entry.status} ${entry.durationMs}ms${entry.error ? ` ${entry.error.split("\n")[0]}` : ""}`);
|
|
};
|
|
|
|
try {
|
|
await openFile(page, ASSETS.studio);
|
|
await waitScene(page, { objects: 6, timeout: 240_000 });
|
|
|
|
await check("B01", "部署服务与 operator describe", async () => {
|
|
const response = await page.evaluate(async () => {
|
|
const res = await fetch("/api/server-operator-job", { method: "POST", headers: { "Content-Type": "application/json", "X-Server-Operator-Action": "describe" }, body: JSON.stringify({ operator: "object.shade_smooth" }) });
|
|
return { status: res.status, body: (await res.text()).slice(0, 400) };
|
|
});
|
|
if (response.status !== 200) throw new Error(`describe HTTP ${response.status}`);
|
|
return response.body;
|
|
});
|
|
|
|
await check("B02", "EEVEE 原生渲染 1 帧", async () => {
|
|
await switchWorkspace(page, "Rendering");
|
|
const panel = page.locator(".native-render-fallback").first();
|
|
await panel.evaluate((element) => { element.open = true; });
|
|
await page.locator('select[aria-label="Engine"]').selectOption("BLENDER_EEVEE");
|
|
await page.getByRole("button", { name: "Render Frame", exact: true }).click();
|
|
await page.waitForFunction(() => {
|
|
const image = document.querySelector(".native-render-image img");
|
|
const output = document.querySelector(".native-workflow-output")?.textContent ?? "";
|
|
return Boolean(image) || /FAILED|ERROR|NATIVE_BACKEND|503|UNAVAILABLE|TIMEOUT/i.test(output);
|
|
}, null, { timeout: 600_000 });
|
|
const image = await page.locator(".native-render-image img").count();
|
|
const output = await page.locator(".native-workflow-output").first().textContent().catch(() => "");
|
|
await shot(page, OUT, image ? "B02-eevee-render" : "B02-eevee-error");
|
|
if (!image) throw new Error(`EEVEE render did not produce an image: ${String(output).slice(0, 400)}`);
|
|
const artifact = await page.locator(".native-workflow-artifacts a").first().getAttribute("download");
|
|
return { artifact };
|
|
});
|
|
|
|
await check("B03", "USD 原生导出", async () => {
|
|
await switchWorkspace(page, "Layout");
|
|
await domClick(page.getByRole("button", { name: "文件", exact: true }));
|
|
await page.getByRole("menuitem", { name: "导出", exact: true }).first().click().catch(() => {});
|
|
await page.getByRole("menuitem", { name: /Universal Scene Description/ }).first().click();
|
|
await page.locator('select[aria-label="导出格式"]').waitFor({ timeout: 30_000 });
|
|
await page.getByRole("button", { name: "导出", exact: true }).click();
|
|
await page.waitForFunction(() => {
|
|
const link = document.querySelector(".native-workflow-artifacts a");
|
|
const output = document.querySelector(".native-workflow-output")?.textContent ?? "";
|
|
return Boolean(link) || /FAILED|ERROR|NATIVE_BACKEND|503|UNAVAILABLE|TIMEOUT/i.test(output);
|
|
}, null, { timeout: 600_000 });
|
|
const links = await page.locator(".native-workflow-artifacts a").count();
|
|
const usdOutput = await page.locator(".native-workflow-output").first().textContent().catch(() => "");
|
|
await shot(page, OUT, links ? "B03-usd-export" : "B03-usd-error");
|
|
if (!links) throw new Error(`USD export did not produce an artifact: ${String(usdOutput).slice(0, 400)}`);
|
|
const artifact = await page.locator(".native-workflow-artifacts a").first().getAttribute("download");
|
|
return { artifact };
|
|
});
|
|
}
|
|
finally {
|
|
report.consoleErrors = consoleErrors;
|
|
report.finishedAt = new Date().toISOString();
|
|
report.status = report.checks.every((entry) => entry.status === "PASS") ? "PASS" : "PARTIAL";
|
|
fs.writeFileSync(path.join(OUT, "backend-report.json"), `${JSON.stringify(report, null, 2)}\n`);
|
|
await context.close();
|
|
await browser.close();
|
|
console.log(JSON.stringify({ status: report.status, checks: report.checks.length, failures: report.checks.filter((entry) => entry.status !== "PASS").map((entry) => entry.id) }, null, 2));
|
|
process.exitCode = report.status === "PASS" ? 0 : 1;
|
|
}
|