Files
progcode/docs/design-system/candidates/f5d927948163/evidence/creative/review.js
T
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

17 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
async page=>{
const base='http://127.0.0.1:50480',out='/tmp/progcode-cd-f5/evidence',rows=[],blocked=[],errors=[];
await page.context().route('**/*',r=>{const u=r.request().url();if(u.startsWith(base+'/'))r.continue();else{blocked.push(u);r.abort();}});page.on('pageerror',e=>errors.push(e.message));
for(const width of [320,390,1440])for(const theme of ['light','dark'])for(const name of ['home','catalog','resources','accessibility','privacy','sources','kit','long']){
await page.setViewportSize({width,height:900});const path=name==='home'?'/':name==='catalog'?'/#journal':name==='kit'?'/ui-kit/':name==='long'?'/articles/'+encodeURIComponent('о-tilix-и-d-интервью-с-геральдом-нанном')+'/':'/'+name+'/';
await page.goto(base+path);await page.getByRole('combobox',{name:'Тема',exact:true}).selectOption(theme);
if(name==='catalog'){await page.locator('#journal').scrollIntoViewIfNeeded();await page.locator('#search').fill('Bitrix');}
rows.push({name,width,theme,path,...await page.evaluate(()=>({pageWidth:document.documentElement.scrollWidth,fieldWidth:document.querySelector('#search')?.getBoundingClientRect().width,query:document.querySelector('#search')?.value,ym:typeof window.ym,footer:document.querySelector('footer')?.innerText,hero:document.querySelector('.lead-visual img')&&{loading:document.querySelector('.lead-visual img').loading,width:document.querySelector('.lead-visual img').width,height:document.querySelector('.lead-visual img').height},body:document.querySelector('main')?.innerText,images:[...document.querySelectorAll('img')].filter(e=>!e.complete||e.naturalWidth===0).map(e=>e.src)}))});
await page.screenshot({path:`${out}/${name}-${width}-${theme}.png`});
if(name==='kit'){await page.locator('.article-meta').first().scrollIntoViewIfNeeded();await page.screenshot({path:`${out}/kit-sources-${width}-${theme}.png`});}
if(name==='accessibility'){await page.locator('footer').scrollIntoViewIfNeeded();await page.screenshot({path:`${out}/footer-${width}-${theme}.png`});}
if(name==='long'){await page.locator('h2[id]').nth(2).scrollIntoViewIfNeeded();await page.screenshot({path:`${out}/prose-${width}-${theme}.png`});}
}
await page.goto(base+'/tools/');await page.setViewportSize({width:390,height:900});await page.locator('#json').fill('{"value":42}');await page.getByRole('button',{name:'Форматировать',exact:true}).click();await page.locator('.result-panel').scrollIntoViewIfNeeded();await page.screenshot({path:out+'/json-success-390-dark.png'});rows.push({name:'json-result',text:await page.locator('.result-panel').innerText()});
await page.evaluate(()=>Object.defineProperty(navigator,'clipboard',{configurable:true,value:{writeText:async()=>{throw new Error('review-denied')}}}));await page.getByRole('button',{name:'Копировать',exact:true}).click();await page.screenshot({path:out+'/copy-fallback-390-dark.png'});rows.push({name:'copy-fallback',text:await page.locator('.result-panel').innerText()});
return{base,rows,blocked,errors};}