const puppeteer = require('/opt/isms/node_modules/puppeteer'); const base = 'file:///root/wppui/dev.html'; const WAIT = 2200; const jobs = []; const phases = ['join','lobby','category','lie','guess','reveal','scores','final']; for (const p of phases) { jobs.push({name:`all-${p}`, url:`${base}?phase=${p}`, w:2620, h:930}); jobs.push({name:`host-${p}`, url:`${base}?phase=${p}&only=host`, w:1920, h:1080}); } for (const t of [500, 1700, 3200, 11200, 15200, 17500]) { jobs.push({name:`host-reveal-t${t}`, url:`${base}?phase=reveal&only=host&t=${t - WAIT}`, w:1920, h:1080}); } jobs.push({name:`phones360-lie`, url:`${base}?phase=lie&only=phones&pw=360`, w:1300, h:930}); jobs.push({name:`phones360-guess`, url:`${base}?phase=guess&only=phones&pw=360`, w:1300, h:930}); jobs.push({name:`host720-lobby`, url:`${base}?phase=lobby&only=host`, w:1280, h:720}); const only = process.argv[2]; (async () => { const browser = await puppeteer.launch({args:['--no-sandbox']}); const page = await browser.newPage(); page.on('console', m => { if (m.type()==='error' || m.type()==='warning') console.log('CONSOLE', m.type(), m.text()); }); page.on('pageerror', e => console.log('PAGEERROR', e.message)); for (const j of jobs) { if (only && !j.name.includes(only)) continue; await page.setViewport({width:j.w, height:j.h}); await page.goto(j.url, {waitUntil:'load', timeout: 15000}).catch(e=>console.log('goto', e.message)); await new Promise(r=>setTimeout(r, WAIT)); await page.screenshot({path:`/root/wppui/shots/${j.name}.png`}); console.log('shot', j.name); } await browser.close(); })();