import { parseArgs, waitForServer, launchBrowser, newPage, openFile, waitScene } from "../course/lib/lesson-recorder.mjs"; const args = parseArgs(); const BASE = `http://127.0.0.1:${args.port}`; await waitForServer(`${BASE}/?ui=web`); const browser = await launchBrowser(args.gpu); const { context, page } = await newPage(browser, { baseUrl: BASE }); const dump = async (label) => { const data = await page.evaluate(() => ({ projectId: document.querySelector("main.blender-app")?.getAttribute("data-project-id"), saveStatus: document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status"), engine: document.querySelector('[data-testid="engine-status"]')?.textContent, stats: document.querySelector('[data-testid="scene-stats"]')?.textContent, buttons: Array.from(document.querySelectorAll("button[aria-label]")).map((b) => b.getAttribute("aria-label")).slice(0, 60), selects: Array.from(document.querySelectorAll("select[aria-label]")).map((s) => ({ label: s.getAttribute("aria-label"), value: s.value, options: Array.from(s.options).map((o) => o.textContent).slice(0, 10) })), bodyText: document.body.innerText.slice(0, 1200), })); console.log(`=== ${label} ===`); console.log(JSON.stringify(data, null, 1)); await page.screenshot({ path: `/tmp/probe-${label}.png`, fullPage: true }); }; await openFile(page, "/home/mes123456/workinf_Blender_Wasm/web/app/public/tutorial/pbr/studio.blend"); await waitScene(page, { objects: 6, timeout: 180000 }); await openFile(page, "/home/mes123456/workinf_Blender_Wasm/re/猴头.glb"); await waitScene(page, { objects: 7, active: "Suzanne", timeout: 180000 }); await page.locator('button[aria-label="保存项目"]').click(); await page.waitForFunction(() => document.querySelector("main.blender-app")?.getAttribute("data-user-action-save-status") === "SUCCEEDED", null, { timeout: 180000 }); await dump("saved"); const close = page.locator('button[aria-label="关闭项目"]').first(); console.log("close count", await close.count()); if (await close.count()) await close.click(); await page.waitForTimeout(1500); await dump("after-close"); await context.close(); await browser.close();