Files
workinf_Blender_Wasm/tools/web/.probe9.mjs
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

32 lines
2.3 KiB
JavaScript

import { createRequire } from "node:module";
import path from "node:path";
const { chromium } = createRequire(import.meta.url)(path.resolve("web/node_modules/playwright"));
const browser = await chromium.launch({ headless: true, executablePath: "/usr/bin/google-chrome-stable",
args: ["--no-sandbox","--use-gl=swiftshader","--enable-unsafe-swiftshader","--enable-unsafe-webgpu","--enable-dawn-features=allow_unsafe_apis","--use-webgpu-adapter=swiftshader"] });
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
const page = await ctx.newPage();
await page.goto("http://127.0.0.1:5402/", { waitUntil: "domcontentloaded" });
await page.waitForFunction(() => document.body.innerText.includes("WASM ABI: ready"), undefined, { timeout: 120000 });
await page.getByTestId("blend-file-input").setInputFiles(path.resolve("tests/files/web/basic_scene.blend"));
await page.waitForFunction(() => /Active Basic/.test(document.querySelector('[data-testid="scene-stats"]')?.textContent ?? ""), undefined, { timeout: 120000 });
await page.waitForTimeout(2000);
const st = () => page.evaluate(() => ({ rev: document.querySelector("main")?.getAttribute("data-current-main-revision"), stats: document.querySelector('[data-testid="scene-stats"]')?.textContent, engine: document.querySelector('[data-testid="engine-status"]')?.textContent }));
const click = (l) => page.evaluate((v) => { const b = document.querySelector(`[aria-label="${v}"]`); b?.click(); return Boolean(b); }, l);
console.log("S0", JSON.stringify(await st()));
await click("添加立方体"); await page.waitForTimeout(8000);
console.log("S1-add", JSON.stringify(await st()));
const rev1 = (await st()).rev;
await click("撤销"); await page.waitForTimeout(5000);
console.log("S2-undo", JSON.stringify(await st()));
await click("重做"); await page.waitForTimeout(5000);
console.log("S3-redo", JSON.stringify(await st()));
await page.waitForTimeout(6000);
const revA = (await st()).rev;
await click("复制对象"); await page.waitForTimeout(6000);
console.log("S4-dup", JSON.stringify(await st()));
await click("删除对象"); await page.waitForTimeout(6000);
console.log("S5-del", JSON.stringify(await st()));
await page.waitForTimeout(6000);
console.log("S6-quiet", JSON.stringify(await st()));
await browser.close();