// Screenshots of Grimmory's own web UI (checklist 8.3): on scratch guest 9202, through traefik over https as a browser // does (headless Chrome), signed in as the test household account. const puppeteer = require('puppeteer'); const sleep = ms => new Promise(r => setTimeout(r, ms)); (async () => { const b = await puppeteer.launch({args: ['--no-sandbox', '--ignore-certificate-errors', '--lang=hu-HU']}); const p = await b.newPage(); await p.setViewport({width: 1280, height: 800}); await p.goto(process.env.URL + '/login', {waitUntil: 'networkidle2'}); await sleep(1500); await p.screenshot({path: '/out/3.png'}); const user = await p.$('input[type=text], input[name=username], input[formcontrolname=username]'); if (user) await user.type(process.env.U); await p.type('input[type=password]', process.env.P); await p.keyboard.press('Enter'); await p.waitForNavigation({waitUntil: 'networkidle2', timeout: 30000}).catch(() => {}); await sleep(5000); await p.screenshot({path: '/out/1.png'}); await p.setViewport({width: 390, height: 844, deviceScaleFactor: 2}); await sleep(2500); await p.screenshot({path: '/out/2.png'}); await b.close(); })().catch(e => { console.error(e); process.exit(1); });