// QA capture for opus55sites. Run with the Windows node (Playwright is installed there): // "/mnt/c/Program Files/nodejs/node.exe" tools/shoot.cjs [--mobile] [--frames 6] [--wait 3000] // is a Windows path prefix, e.g. C:\Users\grant\AppData\Local\Temp\o55\agentic-a // Writes -d0.png … (viewport screenshots while scrolling, so scroll-triggered reveals fire), // -m0.png … with --mobile (390x844), and prints JSON {console errors, page errors, failed requests, metrics}. const { chromium } = require('C:\\Program Files\\nodejs\\node_modules\\playwright\\node_modules\\playwright-core'); const args = process.argv.slice(2); const url = args[0], prefix = args[1]; const opt = (n, d) => { const i = args.indexOf(n); return i > -1 ? args[i + 1] : d; }; const frames = +opt('--frames', 6), wait = +opt('--wait', 3000); const mobile = args.includes('--mobile'); async function pass(browser, label, viewport, isMobile) { const ctx = await browser.newContext({ viewport, deviceScaleFactor: 1, isMobile, hasTouch: isMobile }); const page = await ctx.newPage(); const errors = [], failed = []; page.on('console', m => { if (m.type() === 'error') errors.push(m.text().slice(0, 300)); }); page.on('pageerror', e => errors.push('PAGEERROR ' + String(e).slice(0, 300))); page.on('requestfailed', r => failed.push(r.url().slice(0, 200) + ' ' + (r.failure() || {}).errorText)); page.on('response', r => { if (r.status() >= 400) failed.push(r.status() + ' ' + r.url().slice(0, 200)); }); const t0 = Date.now(); await page.goto(url, { waitUntil: 'load', timeout: 60000 }); const loadMs = Date.now() - t0; await page.waitForTimeout(wait); const H = await page.evaluate(() => document.documentElement.scrollHeight); const shots = []; for (let i = 0; i < frames; i++) { const y = Math.round((H - viewport.height) * (frames === 1 ? 0 : i / (frames - 1))); await page.evaluate(y => window.scrollTo({ top: y, behavior: 'instant' }), y); await page.waitForTimeout(1100); const f = `${prefix}-${label}${i}.png`; await page.screenshot({ path: f }); shots.push(f); } const overflowX = await page.evaluate(() => document.documentElement.scrollWidth > window.innerWidth + 1); await ctx.close(); return { label, loadMs, scrollHeight: H, overflowX, errors, failed, shots }; } (async () => { const browser = await chromium.launch({ args: ['--use-gl=angle', '--enable-webgl', '--ignore-gpu-blocklist'] }); const out = [await pass(browser, 'd', { width: 1440, height: 900 }, false)]; if (mobile) out.push(await pass(browser, 'm', { width: 390, height: 844 }, true)); await browser.close(); console.log(JSON.stringify(out, null, 1)); })().catch(e => { console.error(e); process.exit(1); });