import {chromium} from 'playwright'; const O = process.argv[2]; const b = await chromium.launch({channel:'chrome'}); const p = await b.newContext({viewport:{width:390,height:844},deviceScaleFactor:2,isMobile:true,hasTouch:true}).then(c=>c.newPage()); const bad=[],errs=[]; p.on('response',r=>{if(r.status()>=400)bad.push(r.status()+' '+r.url().slice(-48));}); p.on('console',m=>{if(m.type()==='error')errs.push(m.text().slice(0,90));}); for (const [n,u] of [['home','http://localhost/s/stay6'],['gunsan','http://localhost/s/stay6/gunsan'],['booking','http://localhost/s/stay6/booking']]) { await p.goto(u,{waitUntil:'domcontentloaded'}); await p.waitForTimeout(7000); await p.evaluate(()=>window.scrollTo(0,document.body.scrollHeight)); await p.waitForTimeout(1600); await p.evaluate(()=>window.scrollTo(0,0)); await p.waitForTimeout(1200); const i = await p.evaluate(()=>{ const vis=e=>{const s=getComputedStyle(e),r=e.getBoundingClientRect(); return s.display!=='none'&&s.visibility!=='hidden'&&r.width>0&&r.height>0&&!e.closest('[hidden]');}; const taps=[...document.querySelectorAll('a,button,summary,input,textarea')].filter(vis); return {h:document.body.scrollHeight, screens:+(document.body.scrollHeight/844).toFixed(1), sections:[...document.querySelectorAll('section')].filter(vis).length, h2:[...document.querySelectorAll('h2')].filter(vis).map(x=>x.textContent.trim()), nav: [...document.querySelectorAll('#w4d-pages a')].map(a=>a.textContent.trim()+(a.getAttribute('aria-current')?'*':'')), taps:taps.length, small:taps.filter(e=>{const r=e.getBoundingClientRect();return r.height<44||r.width<44;}).length, ov:document.documentElement.scrollWidth>window.innerWidth}; }); console.log('== '+n, JSON.stringify(i)); const k=Math.min(Math.ceil(i.h/844),10); for(let j=0;jwindow.scrollTo(0,y),j*844); await p.waitForTimeout(550); await p.screenshot({path:`${O}/${n}-${String(j).padStart(2,'0')}.png`}); } } console.log('errors:',errs.slice(0,4)); console.log('bad:',[...new Set(bad)].slice(0,6)); await b.close();