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>
38 lines
2.9 KiB
JavaScript
38 lines
2.9 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 d = () => page.evaluate(() => {
|
|
const m = document.querySelector("main");
|
|
const keys = [...m.attributes].map(a => a.name).filter(k => /diagnostic/.test(k));
|
|
return { engine: document.querySelector('[data-testid="engine-status"]')?.textContent, rev: m.getAttribute("data-current-main-revision"), code: m.getAttribute("data-last-diagnostic-code"), detail: (m.getAttribute("data-last-diagnostic-detail")||"").slice(0,600), keys };
|
|
});
|
|
await page.evaluate(() => document.querySelector('[aria-label="添加立方体"]')?.click());
|
|
await page.waitForTimeout(3000);
|
|
await page.evaluate(() => document.querySelector('[aria-label="撤销"]')?.click());
|
|
await page.waitForTimeout(5000);
|
|
console.log("TOOLBAR-UNDO", JSON.stringify(await d(), null, 1));
|
|
// reload, then use Edit > Undo menu path
|
|
await page.reload({ 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);
|
|
await page.evaluate(() => document.querySelector('[aria-label="添加立方体"]')?.click());
|
|
await page.waitForTimeout(3000);
|
|
console.log("BEFORE-MENU", JSON.stringify(await d()));
|
|
await page.evaluate(() => [...document.querySelectorAll('nav[aria-label="主菜单"] button')].find(b => (b.textContent||"").trim() === "编辑")?.click());
|
|
await page.waitForTimeout(1200);
|
|
await page.evaluate(() => { const it = [...document.querySelectorAll("button")].find(b => (b.textContent||"").trim() === "撤销Ctrl Z"); it?.click(); });
|
|
await page.waitForTimeout(5000);
|
|
console.log("MENU-UNDO", JSON.stringify(await d(), null, 1));
|
|
await browser.close();
|