2 lines
2.0 KiB
JavaScript
2 lines
2.0 KiB
JavaScript
async(page)=>{const r=[];await page.goto('http://127.0.0.1:54623/?designer=final5');await page.locator('#theme').selectOption('light');for(const width of [1440,390,320]){await page.setViewportSize({width,height:1000});for(const view of ['home','catalog','article','kit']){await page.goto('http://127.0.0.1:54623/#'+view);await page.evaluate(()=>document.fonts.ready);await page.waitForTimeout(80);await page.evaluate(()=>window.scrollTo(0,0));r.push({width,view,doc:await page.evaluate(()=>document.documentElement.scrollWidth),images:await page.locator('main section:not([hidden]) img').evaluateAll(async imgs=>Promise.all(imgs.map(async i=>{try{i.loading='eager';await Promise.race([i.decode(),new Promise((_,r)=>setTimeout(()=>r('timeout'),3000))]);return true}catch{return false}})))});await page.screenshot({path:'/tmp/progcode-concept-v3/'+view+'-'+width+'.png'});}}await page.setViewportSize({width:1440,height:1000});await page.goto('http://127.0.0.1:54623/#catalog');await page.locator('#query').fill('Bitrix');r.push({search:'Bitrix',count:await page.locator('#results>.entry:visible').count()});await page.screenshot({path:'/tmp/progcode-concept-v3/search-bitrix.png'});await page.locator('#query').fill('Rust');r.push({search:'Rust',count:await page.locator('#results>.entry:visible').count()});await page.screenshot({path:'/tmp/progcode-concept-v3/search-empty.png'});await page.locator('#reset').click();r.push({reset:await page.locator('#results>.entry:visible').count()});await page.goto('http://127.0.0.1:54623/#kit');await page.locator('#json').fill('{bad}');await page.locator('#format').click();r.push({jsonError:await page.locator('#jsonstate').innerText()});await page.locator('#theme').selectOption('dark');await page.screenshot({path:'/tmp/progcode-concept-v3/kit-dark-error.png'});await page.goto('http://127.0.0.1:54623/#article');await page.locator('#body figure').first().scrollIntoViewIfNeeded();await page.screenshot({path:'/tmp/progcode-concept-v3/gc-dark-middle.png'});return r;}
|