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 st = () => page.evaluate(() => ({ ws: document.querySelector("main")?.getAttribute("data-workspace"), display: document.querySelector('canvas[aria-label="Blender desktop"]')?.getAttribute("data-native-display"), engine: document.querySelector('[data-testid="engine-status"]')?.textContent, detail: (document.querySelector("main")?.getAttribute("data-last-diagnostic-detail")||"").slice(0,140), })); const go = (n) => page.evaluate((v) => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()===v); b?.click(); }, n); await go("Shading"); await page.waitForTimeout(8000); console.log("S1", JSON.stringify(await st())); // retry switching repeatedly with increasing waits: does the python flag clear? for (const w of [4000, 8000, 15000, 25000]) { await go("Layout"); await page.waitForTimeout(w); console.log("TRY-"+w, JSON.stringify(await st())); } // and does a same-candidate fresh reload switch away from Shading directly? 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); for (const n of ["Shading","UV Editing","Layout","Modeling"]) { await go(n); await page.waitForTimeout(9000); console.log("SEQ-"+n, JSON.stringify(await st())); } await browser.close();