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>
31 lines
2.4 KiB
JavaScript
31 lines
2.4 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 click = (l) => page.evaluate((v) => { const b = document.querySelector(`[aria-label="${v}"]`); b?.click(); return Boolean(b); }, l);
|
|
const stats = () => page.evaluate(() => (document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "").match(/Objects (\d+)/)?.[1] ?? "?");
|
|
const hist = async () => {
|
|
await page.evaluate(() => [...document.querySelectorAll('nav[aria-label="主菜单"] button')].find(b => (b.textContent||"").trim() === "编辑")?.click());
|
|
await page.waitForTimeout(1200);
|
|
await page.evaluate(() => [...document.querySelectorAll("button")].find(b => (b.textContent||"").trim() === "撤销历史")?.click());
|
|
await page.waitForTimeout(2500);
|
|
const items = await page.evaluate(() => { const d = document.querySelector('[role="dialog"]'); return d ? [...d.querySelectorAll("li,button,tr")].map(n => (n.textContent||"").trim()).filter(Boolean).slice(0,30) : null; });
|
|
await page.keyboard.press("Escape"); await page.waitForTimeout(1500);
|
|
return items;
|
|
};
|
|
await click("添加立方体"); await page.waitForTimeout(9000);
|
|
console.log("ADD objects=", await stats(), "history=", JSON.stringify(await hist()));
|
|
for (let i = 1; i <= 4; i++) {
|
|
await click("撤销"); await page.waitForTimeout(9000);
|
|
console.log("UNDO"+i+" objects=", await stats(), "history=", JSON.stringify(await hist()));
|
|
}
|
|
await browser.close();
|