// Networks and code sections: no errors, no horizontal overflow, screenshots; the flat-fit section stays removed. import { chromium } from 'playwright-core'; import { PAGE, HAND } from './paths.mjs'; const b = await chromium.launch({ executablePath: process.env.CH }); const errs = [], fails = []; for (const [w, h] of [[1440, 900], [390, 844]]) { const p = await b.newPage({ viewport: { width: w, height: h } }); p.on('pageerror', e => errs.push(`${w}: ${e.message}`)); p.on('console', m => { if (m.type() === 'error' && !/net::|ERR_/.test(m.text())) errs.push(`${w}: ${m.text()}`) }); await p.goto(PAGE('site/index.html')); await p.waitForTimeout(1500); if (await p.locator('h2.sec', { hasText: 'flat arrangements' }).count()) fails.push(`${w}: flat-fit section present`); await p.selectOption('#srcsel', 'all'); await p.waitForTimeout(200); for (const [sec, name] of [['Networks on the measured paths', 'net'], ['Code and data', 'code']]) { const el = p.locator('h2.sec', { hasText: sec }).locator('xpath=..'); await el.screenshot({ path: `out/sec_${name}_${w}.png` }); } const sw = await p.evaluate(() => document.documentElement.scrollWidth); if (sw !== w) fails.push(`${w}: page scrollWidth ${sw}`); const links = await p.evaluate(() => [...document.querySelectorAll('main a')].map(a => a.href)); console.log(w, 'links', links.length, [...new Set(links.map(u => new URL(u).host))]); await p.close(); } console.log('FAILS', JSON.stringify(fails)); console.log('ERRORS', JSON.stringify(errs)); await b.close();