Files
felhom.eu/documentation/audits/new-apps-2026-10-01/tools/shots/dawarich.js
T

30 lines
1.7 KiB
JavaScript

// Screenshots of Dawarich's own web UI for the catalog card (checklist 8.3): on scratch guest 9202, through traefik over
// https as a browser does (headless Chrome), signed in as the test household account. The map tiles come from Dawarich's
// default tile server (the browser fetches them — FIT.md).
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 + '/users/sign_in', {waitUntil: 'networkidle2'});
await sleep(1000);
await p.screenshot({path: '/out/3.png'});
await p.type('input[type=email]', 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);
for (const label of ['No thanks', 'Skip for now']) { // the opt-in widget prompt and the welcome box: closed
const [btn] = await p.$$(`xpath/.//button[contains(normalize-space(.), "${label}")] | .//a[contains(normalize-space(.), "${label}")]`);
if (btn) { await btn.click().catch(() => {}); await sleep(1200); }
}
await p.click('button ::-p-text(Last 7 days)').catch(() => {});
await sleep(5000);
await p.screenshot({path: '/out/1.png'});
await p.goto(process.env.URL + '/stats', {waitUntil: 'networkidle2'}).catch(() => {});
await sleep(3000);
await p.screenshot({path: '/out/2.png'});
await b.close();
})().catch(e => { console.error(e); process.exit(1); });