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.addInitScript(() => { const reg = []; window.__w = reg; window.Worker = new Proxy(window.Worker, { construct(t, a) { const w = Reflect.construct(t, a); reg.push({ url: String(a[0]), worker: w }); return w; } }); }); await page.goto("http://127.0.0.1:5412/", { 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/hierarchy_simplify_combined.blend")); await page.waitForFunction(() => /SceneIR r\d+/.test(document.querySelector('[data-testid="engine-status"]')?.textContent ?? ""), undefined, { timeout: 120000 }); await page.waitForTimeout(5000); const snap = () => page.evaluate(() => new Promise((resolve, reject) => { const worker = window.__w.find(x => /web-engine\.worker/.test(x.url))?.worker; if (!worker) return reject(new Error('no engine')); const requestId = 'p-' + Math.random(); const timer = setTimeout(() => reject(new Error('timeout')), 30000); const recv = ({ data }) => { if (data.requestId === requestId) { clearTimeout(timer); resolve(data); } }; worker.addEventListener('message', recv); worker.postMessage({ requestId, command: { type: 'snapshot' } }); })); const state = async () => { const r = await snap(); const s = r.result?.snapshot; const byName = Object.fromEntries((s?.nodes ?? []).map(n => [n.name, n.parentId ? (s.nodes.find(x => x.id === n.parentId)?.name) : null])); return { rev: s?.revision, parents: byName }; }; console.log("BEFORE", JSON.stringify(await state())); // Real mouse drag inside the native outliner area (normalized rect from the workflow). const rect = { x: 0.8234986945169713, y: 0.8174757281553398, w: 0.17650130548302867, h: 0.18252427184466025 }; const vw = 1440, vh = 900; const nx = (fx) => vw * (rect.x + rect.w * fx); const ny = (fy) => vh * (rect.y + rect.h * fy); console.log("AREA-PX", JSON.stringify({ x0: nx(0), y0: ny(0), x1: nx(1), y1: ny(1) })); // Activate the outliner by clicking an empty part of it first. await page.mouse.click(nx(0.5), ny(0.9)); await page.waitForTimeout(2500); await page.mouse.move(nx(0.5), ny(0.25)); await page.waitForTimeout(800); await page.mouse.down(); await page.waitForTimeout(600); await page.mouse.move(nx(0.5), ny(0.4), { steps: 12 }); await page.waitForTimeout(600); await page.mouse.up(); await page.waitForTimeout(6000); console.log("AFTER-NATIVE-DRAG", JSON.stringify(await state())); console.log("UI", JSON.stringify(await page.evaluate(() => ({ engine: document.querySelector('[data-testid="engine-status"]')?.textContent, detail: (document.querySelector("main")?.getAttribute("data-last-diagnostic-detail")||"").slice(0,180), display: document.querySelector('canvas[aria-label="Blender desktop"]')?.getAttribute("data-native-display") })))); await browser.close();