import { chromium } from 'playwright-core'; import { PAGE, HAND } from './paths.mjs'; const b = await chromium.launch({ executablePath: process.env.CH }); const bad = []; for (const [w, h] of [[1920, 1080], [1440, 900], [1366, 768], [1280, 800], [1024, 768], [390, 844]]) { const p = await b.newPage({ viewport: { width: w, height: h } }); await p.goto(PAGE('web/index.html')); await p.waitForTimeout(1200); const r = await p.evaluate(async () => { const out = []; for (const v of ['globe', 'ae', 'dp', 'merc']) { document.querySelector(`.models button[data-v="${v}"]`).click(); for (const src of ['all', 'ours', 'gp', 'home']) { setSource(src); for (let i = 0; i < LP.length; i++) { select(i); const t = [...document.querySelectorAll('#card .row .top b, #card .row .top em, #card h2')].filter(e => e.scrollWidth > e.clientWidth + 1); if (t.length) out.push(`${v} ${src} ${LS[LP[i].a].name}-${LS[LP[i].b].name}: ${t.map(e => e.textContent).join(' | ')}`) } } } return { out, nokm: document.getElementById('card').classList.contains('nokm') }; }); console.log(w, h, 'truncated rows:', r.out.length, r.out.slice(0, 2)); if (r.out.length) bad.push(w); await p.close(); } console.log('TRUNC FAILS', bad); await b.close();