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); const goBack = () => page.evaluate(() => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()==="Layout"); b?.click(); }); const go = (n) => page.evaluate((v) => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()===v); b?.click(); }, n); const st = () => page.evaluate(() => ({ ws: document.querySelector("main")?.getAttribute("data-workspace"), engine: document.querySelector('[data-testid="engine-status"]')?.textContent })); const results = []; for (const name of ["Animation","Compositing","Geometry Nodes","Rendering","Sculpting","Texture Paint","UV Editing","Scripting"]) { await goBack(); await page.waitForTimeout(6000); await go(name); await page.waitForTimeout(11000); const s = await st(); results.push({ name, ws: s.ws, engine: (s.engine||"").slice(0,90) }); } console.log(JSON.stringify(results, null, 1)); await browser.close();