const fs=require('fs'),path=require('path'),{pathToFileURL}=require('url'),{chromium}=require('playwright'); function walk(d){return fs.readdirSync(d,{withFileTypes:true}).filter(e=>!['tests','logs','node_modules','.git'].includes(e.name)).flatMap(e=>e.isDirectory()?walk(path.join(d,e.name)):[path.join(d,e.name)])} (async()=>{const entry=walk(process.cwd()).find(f=>/\.(html|svg)$/i.test(f));if(!entry)throw Error('missing browser entry'); const b=await chromium.launch({headless:true,args:['--no-sandbox','--disable-dev-shm-usage']});try{const p=await b.newPage(),errors=[];p.on('pageerror',e=>errors.push(e.message));await p.route(/^https?:/,r=>r.abort());await p.goto(pathToFileURL(entry).href,{waitUntil:'load'}); if(!await p.evaluate(()=>[...document.querySelectorAll('body *,svg')].some(e=>{const r=e.getBoundingClientRect(),s=getComputedStyle(e);return r.width>0&&r.height>0&&s.display!=='none'&&s.visibility!=='hidden'})))throw Error('entry does not render'); if(errors.length)throw Error(errors.join(' | '));console.log('render smoke passed');}finally{await b.close()}})().catch(e=>{console.error(e);process.exit(1)});