minor adjustments

This commit is contained in:
Vincent van der Wal
2026-08-01 16:07:32 +02:00
parent 17cf8df109
commit ae88140f79
13 changed files with 129 additions and 122 deletions
+20
View File
@@ -0,0 +1,20 @@
import { chromium } from 'playwright';
const browser = await chromium.launch();
const out = {};
for (const [label, vp, mobile] of [['mobile', { width: 390, height: 844 }, true], ['desktop', { width: 1280, height: 950 }, false]]) {
const ctx = await browser.newContext({ viewport: vp, isMobile: mobile, hasTouch: mobile });
const page = await ctx.newPage();
await page.goto('http://localhost:5186/en/weather/week/berlin/', { waitUntil: 'load', timeout: 120000 });
await page.waitForTimeout(14000);
out[label] = await page.evaluate(() => ({
rows: [...document.querySelectorAll('tr')].map((r) => ({
label: r.querySelector('.hdr')?.textContent?.trim().replace(/\s+/g, ' ').slice(0, 10) || '-',
h: Math.round(r.getBoundingClientRect().height)
})),
tableHeight: Math.round(document.querySelector('table').getBoundingClientRect().height)
}));
await page.screenshot({ path: `/tmp/rows-${label}.png`, clip: { x: 0, y: 0, width: vp.width, height: Math.min(820, vp.height) } });
await ctx.close();
}
console.log(JSON.stringify(out, null, 1));
await browser.close();