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>
28 lines
2.3 KiB
JavaScript
28 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 }, 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);
|
|
const full = () => page.evaluate(() => {
|
|
const m = document.querySelector("main");
|
|
return { engine: document.querySelector('[data-testid="engine-status"]')?.textContent, rev: m?.getAttribute("data-current-main-revision"), diag: m?.getAttribute("data-diagnostic-count"), text: (document.body.innerText || "").split("\n").filter(l => /diagnos|error|failed|失败|诊断/i.test(l)).slice(0, 10) };
|
|
});
|
|
await page.evaluate(() => document.querySelector('[aria-label="添加立方体"]')?.click());
|
|
await page.waitForTimeout(3000);
|
|
console.log("ADD", JSON.stringify(await full()));
|
|
await page.evaluate(() => document.querySelector('[aria-label="撤销"]')?.click());
|
|
await page.waitForTimeout(5000);
|
|
console.log("UNDO", JSON.stringify(await full()));
|
|
// try Edit > Undo menu instead
|
|
await page.evaluate(() => [...document.querySelectorAll('nav[aria-label="主菜单"] button')].find(b => (b.textContent||"").trim() === "编辑")?.click());
|
|
await page.waitForTimeout(1500);
|
|
console.log("EDITMENU", JSON.stringify(await page.evaluate(() => [...document.querySelectorAll('[role="menu"] button, .menu-popup button, [data-menu-item]')].map(b => (b.textContent||"").trim()).filter(Boolean).slice(0, 25))));
|
|
await browser.close();
|