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 marks = []; page.on("console", m => { const t = m.text(); if (/WBV2_PY_RECLAIM|REENTRANT/.test(t)) marks.push(m.type()+": "+t.slice(0,220)); }); await page.goto("http://127.0.0.1:5408/", { 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 = (t) => page.evaluate((tag) => ({ tag, ws: document.querySelector("main")?.getAttribute("data-workspace"), objects: (document.querySelector('[data-testid="scene-stats"]')?.textContent ?? "").match(/Objects (\d+)/)?.[1] ?? "?", engine: document.querySelector('[data-testid="engine-status"]')?.textContent, detail: (document.querySelector("main")?.getAttribute("data-last-diagnostic-detail")||"").slice(0,220) }), t); const go = (n) => page.evaluate((v) => { const b=[...document.querySelectorAll('nav[aria-label="工作区"] button')].find(x=>(x.textContent||"").trim()===v); b?.click(); }, n); const click = (l) => page.evaluate((v) => { const b = document.querySelector(`[aria-label="${v}"]`); b?.click(); return Boolean(b); }, l); // A: baseline edit await click("添加立方体"); await page.waitForTimeout(7000); console.log(JSON.stringify(await st("baseline-add"))); // B: enter Shading, edit inside await go("Shading"); await page.waitForTimeout(9000); console.log(JSON.stringify(await st("shading-entered"))); // C: leave Shading — the old wedge point await go("Layout"); await page.waitForTimeout(9000); console.log(JSON.stringify(await st("left-shading"))); // D: edit after leaving await click("添加立方体"); await page.waitForTimeout(7000); console.log(JSON.stringify(await st("add-after-leave"))); // E: back into Shading and out again await go("Shading"); await page.waitForTimeout(8000); await go("Modeling"); await page.waitForTimeout(8000); console.log(JSON.stringify(await st("second-round"))); console.log("RECLAIM-LOGS", JSON.stringify(marks.slice(0, 8), null, 1)); await browser.close();