import { webkit, chromium } from 'playwright'; for (const [name, engine] of [['webkit', webkit], ['chromium', chromium]]) { const b = await engine.launch(); const ctx = await b.newContext({ viewport:{width:1280,height:900}, reducedMotion:'reduce' }); const p = await ctx.newPage(); const errs = []; p.on('pageerror', e => errs.push(String(e).slice(0,200))); p.on('console', m => { if (m.type()==='error' && /hydrat|418|did not match/i.test(m.text())) errs.push('console: '+m.text().slice(0,160)); }); await p.goto('https://www.novalon.cn/about', { waitUntil:'networkidle', timeout:60000 }).catch(()=>{}); await p.waitForTimeout(2000); const info = await p.evaluate(() => ({ reduce: matchMedia('(prefers-reduced-motion: reduce)').matches, hidden: [...document.querySelectorAll('main *')].filter(e=>parseFloat(getComputedStyle(e).opacity)===0).length, h1opacity: Number(getComputedStyle(document.querySelector('h1')).opacity), })); console.log(name, JSON.stringify(info), 'hydrationErrors', errs.length, JSON.stringify(errs.slice(0,2))); await b.close(); }