import { webkit } from 'playwright'; const b = await webkit.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,160))); await p.goto('https://www.novalon.cn/about', { waitUntil:'networkidle', timeout:60000 }); const before = await p.evaluate(() => [...document.querySelectorAll('main *')].filter(e=>parseFloat(getComputedStyle(e).opacity)===0).length); // 逐屏滚动到底(同时给 whileInView 触发机会) await p.evaluate(async () => { for (let y = 0; y < document.body.scrollHeight; y += 600) { window.scrollTo(0, y); await new Promise(r => setTimeout(r, 120)); } window.scrollTo(0, document.body.scrollHeight); }); await p.waitForTimeout(1500); const after = await p.evaluate(() => { const hidden = [...document.querySelectorAll('main *')].filter(e=>parseFloat(getComputedStyle(e).opacity)===0); const late = [...document.querySelectorAll('h2,h3')].find(h => /准备好开始了吗/.test(h.innerText)); return { hidden: hidden.length, lateOpacity: late ? Number(getComputedStyle(late).opacity) : null, hiddenTexts: hidden.slice(0,3).map(e=>(e.innerText||'').slice(0,18)) }; }); await p.screenshot({ path:'docs/acceptance/2026-10-20-prod-about/about-reduce-after-scroll.png', fullPage:true }); console.log('reduce 滚动前隐藏:', before, '· 滚动后:', JSON.stringify(after), '· pageerrors:', errs.length); await b.close();