Files
workinf_Blender_Wasm/tools/web/.probe3.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

30 lines
3.3 KiB
JavaScript

import { createRequire } from "node:module";
import fs from "node:fs"; 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 }, acceptDownloads: true });
const page = await ctx.newPage();
await page.goto("http://127.0.0.1:5401/", { 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);
console.log("NAVS:", JSON.stringify(await page.evaluate(() => [...document.querySelectorAll("nav")].map(n => ({ label: n.getAttribute("aria-label"), cls: n.className, buttons: [...n.querySelectorAll("button")].map(b => (b.textContent||"").trim()).slice(0,20) })))));
console.log("AREAS:", JSON.stringify(await page.evaluate(() => [...document.querySelectorAll("[data-editor-workflow-area],[data-area],[data-workflow-area]")].map(n => ({ tag: n.tagName, id: n.getAttribute("data-editor-workflow-area") ?? n.getAttribute("data-area") ?? n.getAttribute("data-workflow-area"), cls: n.className?.toString().slice(0,60) })))));
await page.evaluate(() => document.querySelector('[aria-label="添加立方体"]')?.click());
await page.waitForTimeout(3000);
console.log("MENU:", JSON.stringify(await page.evaluate(() => { const m = document.querySelector('[data-testid="scene-stats"]'); return { stats: m?.textContent, undoDisabled: document.querySelector('[aria-label="撤销"]')?.disabled ?? null, redoDisabled: document.querySelector('[aria-label="重做"]')?.disabled ?? null }; })));
await page.evaluate(() => document.querySelector('[aria-label="撤销"]')?.click());
await page.waitForTimeout(4000);
console.log("AFTERUNDO:", JSON.stringify(await page.evaluate(() => ({ stats: document.querySelector('[data-testid="scene-stats"]')?.textContent, engine: document.querySelector('[data-testid="engine-status"]')?.textContent }))));
const dlP = page.waitForEvent("download", { timeout: 40000 });
await page.evaluate(() => document.querySelector('[aria-label="保存项目"]')?.click());
const dl = await dlP; const p = await dl.path();
const dir = fs.mkdtempSync("/tmp/wbv2-reopen-"); const named = path.join(dir, "saved.blend");
fs.copyFileSync(p, named);
console.log("SAVED:", dl.suggestedFilename(), fs.statSync(named).size);
await page.getByTestId("blend-file-input").setInputFiles(named);
for (let i = 0; i < 6; i++) { await page.waitForTimeout(3000); console.log("REOPEN"+i+":", JSON.stringify(await page.evaluate(() => ({ stats: document.querySelector('[data-testid="scene-stats"]')?.textContent, engine: document.querySelector('[data-testid="engine-status"]')?.textContent })))); }
await browser.close();