- deploy/verify-matrix.js:6 尺寸 × 3 视图 × 深浅色矩阵,断言纵向滚动(仅
minimal/workspace)、文字亮度阈值、深色是否生效、零运行时异常
- deploy/verify-workspace.js:触发 workspace blocked 态,读弹窗卡片 computed style
- deploy/verify-scroll.js:多视口滚动复现(含 900x520 这类矮窗口)
三者只从环境变量 PORTAL_COOKIE 取会话,无任何硬编码凭据
- README 自检命令改为排除占位符(<...>、${VAR:-}、change-me),避免误报
- 自定义文件表登记上述脚本
33 lines
1.9 KiB
JavaScript
33 lines
1.9 KiB
JavaScript
const { chromium }=require('playwright-core');
|
|
const C=process.env.PORTAL_COOKIE;
|
|
(async()=>{
|
|
const b=await chromium.connectOverCDP('http://127.0.0.1:9222');
|
|
for(const [w,h] of [[1280,720],[1280,600],[1024,600],[900,520],[768,600],[390,780]]){
|
|
const ctx=await b.newContext({ignoreHTTPSErrors:true,viewport:{width:w,height:h}});
|
|
await ctx.addCookies([{name:'portal_session',value:C,domain:'.example.com',path:'/',httpOnly:true,secure:true,sameSite:'Lax'}]);
|
|
const p=await ctx.newPage();
|
|
await p.emulateMedia({colorScheme:'dark'}); await p.addInitScript(()=>localStorage.removeItem('navi-theme'));
|
|
await p.goto('https://dashy.example.com/minimal',{waitUntil:'networkidle',timeout:90000}); await p.waitForTimeout(1800);
|
|
const r=await p.evaluate(()=>{
|
|
const de=document.documentElement;
|
|
const foot=document.querySelector('.navi-footer');
|
|
const fr=foot?foot.getBoundingClientRect():null;
|
|
// 谁在撑高页面
|
|
let worst=null;
|
|
for(const e of document.querySelectorAll('body *')){
|
|
const b=e.getBoundingClientRect();
|
|
if(b.height<4) continue;
|
|
if(de.scrollHeight>innerHeight+2 && b.bottom>innerHeight+2){
|
|
if(!worst||b.bottom>worst.bottom) worst={cls:e.className.toString().slice(0,60),bottom:Math.round(b.bottom),h:Math.round(b.height)};
|
|
}
|
|
}
|
|
return {scrollH:de.scrollHeight,viewH:innerHeight,overflow:de.scrollHeight-innerHeight,scrollable:de.scrollHeight>innerHeight+2,
|
|
bodyH:document.body.scrollHeight,footerBottom:fr?Math.round(fr.bottom):null,worst};
|
|
});
|
|
console.log(`${String(w).padStart(4)}x${String(h).padEnd(4)} docH=${String(r.scrollH).padEnd(5)} viewH=${String(r.viewH).padEnd(5)} 溢出=${String(r.overflow).padEnd(4)} 可滚=${r.scrollable?'YES':'no '} footer底=${r.footerBottom} 元凶=${r.worst?JSON.stringify(r.worst):'无'}`);
|
|
await p.screenshot({path:`/tmp/mini-${w}x${h}.png`});
|
|
await ctx.close();
|
|
}
|
|
await b.close();
|
|
})().catch(e=>{console.error(e);process.exit(1)});
|