18 lines
874 B
JavaScript
18 lines
874 B
JavaScript
import { chromium } from 'playwright';
|
|
const B='http://l6yk2n8ol78okigxileeyxjt.46.224.49.66.sslip.io/';
|
|
const b=await chromium.launch();
|
|
for(const [w,h,tag] of [[390,844,'mobile'],[1280,900,'desktop']]){
|
|
const p=await b.newPage({viewport:{width:w,height:h},deviceScaleFactor:2});
|
|
await p.goto(B,{waitUntil:'networkidle',timeout:30000}).catch(()=>{});
|
|
await p.waitForTimeout(2500);
|
|
await p.screenshot({path:`/tmp/kf/shot-${tag}.png`});
|
|
// check header overflow on mobile
|
|
if(tag==='mobile'){
|
|
const o=await p.evaluate(()=>{const n=document.querySelector('header nav');return {scrollW:n.scrollWidth,clientW:n.clientWidth,docOverflow:document.documentElement.scrollWidth>window.innerWidth+1};});
|
|
console.log('mobile nav scrollW',o.scrollW,'clientW',o.clientW,'pageHorizOverflow',o.docOverflow);
|
|
}
|
|
await p.close();
|
|
}
|
|
await b.close();
|
|
console.log('done');
|