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(); const t0 = Date.now(); const log = []; page.on("console", m => { const t = m.text(); if (/PYTHON_|REENTRANT|sRGB|storage buffer/.test(t)) log.push(((Date.now()-t0)/1000).toFixed(1)+"s "+m.type()+": "+t.slice(0,200)); }); await page.goto("http://127.0.0.1:5407/", { 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); log.push("=== switch to Shading ==="); await page.evaluate(() => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()==="Shading"); b?.click(); }); await page.waitForTimeout(12000); log.push("=== switch to Layout ==="); await page.evaluate(() => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()==="Layout"); b?.click(); }); await page.waitForTimeout(9000); console.log(JSON.stringify(log.slice(0, 24), null, 1)); console.log("STATE", JSON.stringify(await page.evaluate(() => ({ ws: document.querySelector("main")?.getAttribute("data-workspace"), detail: (document.querySelector("main")?.getAttribute("data-last-diagnostic-detail")||"").slice(0,200) })))); await browser.close();