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>
35 lines
2.4 KiB
JavaScript
35 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:5411/", { 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(() => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()==="Scripting"); b?.click(); });
|
|
await page.waitForFunction(() => document.querySelector("main")?.getAttribute("data-workspace") === "Scripting", undefined, { timeout: 60000 });
|
|
await page.waitForFunction(() => document.querySelector(".wasm-python-console") !== null, undefined, { timeout: 60000 });
|
|
const input = await page.evaluate(() => {
|
|
const host = document.querySelector(".wasm-python-console");
|
|
const el = host?.querySelector("textarea, input[type=text]");
|
|
return el ? { tag: el.tagName, aria: el.getAttribute("aria-label"), placeholder: el.getAttribute("placeholder") } : null;
|
|
});
|
|
console.log("INPUT", JSON.stringify(input));
|
|
if (input) {
|
|
const loc = page.locator(".wasm-python-console textarea, .wasm-python-console input[type=text]").first();
|
|
await loc.click();
|
|
await loc.fill("print(1 + 1)");
|
|
await page.keyboard.press("Enter");
|
|
await page.waitForTimeout(7000);
|
|
}
|
|
console.log("RESULT", JSON.stringify(await page.evaluate(() => ({
|
|
text: (document.querySelector(".wasm-python-console")?.innerText ?? "").slice(-300),
|
|
engine: document.querySelector('[data-testid="engine-status"]')?.textContent,
|
|
detail: (document.querySelector("main")?.getAttribute("data-last-diagnostic-detail")||"").slice(0,160),
|
|
}))));
|
|
await browser.close();
|