import { chromium } from '@playwright/test'; import { mkdir } from 'node:fs/promises'; const origin = process.env.CAPTURE_URL || 'http://127.0.0.1:18100'; const url = new URL(origin); if (url.hostname !== '127.0.0.1') throw new Error('Capture only targets a loopback development world'); const browser = await chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL || 'msedge', args: ['--use-angle=swiftshader', '--enable-unsafe-swiftshader'] }); try { const page = await browser.newPage({ viewport: { width: 1600, height: 900 }, deviceScaleFactor: 1 }); await page.goto(`${origin}/game`); await page.waitForFunction(() => window.__aeternalis?.diagnostics().models === 6); await page.addStyleTag({ content: '#hud, dialog { display: none !important; }' }); await page.waitForTimeout(400); await mkdir('client/public/images', { recursive: true }); await page.locator('#world').screenshot({ path: 'client/public/images/world.png' }); } finally { await browser.close(); }