Files
zhangxiang 12999348bc docs(evidence): /about 白屏排查的探针与线上 reduce 实测截图入库
- probe-reduce-after.mjs:线上 reduce 偏好下 hydration 错误计数(修复后 0)
- probe-reduce-scroll.mjs:逐屏滚动后 hidden 14→3、末段 opacity=1
- about-reduce-after-scroll.png:修复后 reduce 渲染实物
其余探针(nojs / matrix / clientnav / live / webkit)已在 fix(motion) 那笔一并入库。
2026-10-20 08:03:39 +08:00

26 lines
1.5 KiB
JavaScript

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();