Files
huncode 12562baeb5
Build and deploy / deploy (push) Successful in 2m39s
Implement ProgCode identity and real shared reading UI kit
2026-10-27 15:19:49 +03:00

2 lines
1.4 KiB
JavaScript

async(page)=>{let o={errors:[],console:[],requests:[],cases:[]};page.on('pageerror',e=>o.errors.push(String(e)));page.on('console',m=>{if(m.type()==='error')o.console.push(m.text());});page.on('response',r=>{if(r.status()>=400)o.requests.push({url:r.url(),status:r.status()});});for(const [view,width,dark]of[['home',1440,false],['home',390,true],['catalog',1440,false],['catalog',320,true],['article',1440,false],['article',390,true],['kit',1440,false],['kit',390,true]]){await page.setViewportSize({width,height:1000});await page.goto('http://127.0.0.1:54623/#'+view);if(await page.locator('body').evaluate(e=>e.classList.contains('dark'))!==dark)await page.locator('#theme').click();await page.evaluate(()=>document.fonts.ready);await page.screenshot({path:'/tmp/progcode-content-v3-readings/board-'+view+'-'+width+'-'+(dark?'dark':'light')+'.png'});o.cases.push({view,width,dark,...await page.evaluate(()=>({scrollWidth:document.documentElement.scrollWidth,mainText:[...document.querySelectorAll('main>section')].find(e=>!e.hidden).innerText,h1:[...document.querySelectorAll('main>section')].find(e=>!e.hidden).querySelector('h1').innerText}))});if(view==='article'){for(const [name,sel]of[['middle','#body h2:nth-of-type(2)'],['end','#body>p:last-child']]){await page.locator(sel).scrollIntoViewIfNeeded();await page.screenshot({path:'/tmp/progcode-content-v3-readings/board-article-'+name+'-'+width+'.png'});}}}return o;}