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

6 lines
3.2 KiB
JavaScript
Raw Permalink 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:57752',matrix=base+'/review/candidates/3c4c84a0be93/',out='/tmp/progcode-cd-matrix/evidence',rows=[];for(const width of [1440,390,320])for(const theme of ['light','dark']){await page.setViewportSize({width,height:1000});await page.goto(matrix);await page.locator('#theme').selectOption(theme);await page.locator('#identity').filter({hasText:'3c4c84a0be93'}).waitFor();await page.screenshot({path:`${out}/overview-${width}-${theme}.png`});rows.push({name:'overview',width,theme,text:await page.locator('#identity').innerText(),...await page.evaluate(()=>({pageWidth:document.documentElement.scrollWidth,body:document.body.innerText}))});}
for(const [width,theme]of [[1440,'light'],[320,'dark']]){await page.setViewportSize({width,height:1000});await page.goto(matrix);await page.locator('#theme').selectOption(theme);await page.locator('#foundation-records .record').first().waitFor();await page.locator('#foundations').scrollIntoViewIfNeeded();await page.screenshot({path:`${out}/foundations-${width}-${theme}.png`});for(const name of ['Field','ThemeControl','ArticleFigure']){await page.locator('#query').fill(name);const record=page.locator('#component-records .record').filter({has:page.locator('summary',{hasText:name})}).first();await record.locator('summary').click();await record.scrollIntoViewIfNeeded();await page.screenshot({path:`${out}/${name}-${width}-${theme}.png`});rows.push({name,width,theme,text:await record.innerText(),sourceLinks:await record.locator('a.source').evaluateAll(es=>es.map(e=>({text:e.textContent,url:e.href})))})}}
await page.setViewportSize({width:1440,height:1000});await page.goto(matrix);await page.locator('#theme').selectOption('light');await page.locator('#page-choice').selectOption('3');await page.locator('#width').selectOption('390');await page.locator('#pages').scrollIntoViewIfNeeded();await page.screenshot({path:out+'/whole-page-viewer-1440-light.png'});rows.push({name:'iframe',src:await page.locator('#page-frame').getAttribute('src'),text:await page.locator('#page-description').innerText()});
for(const path of ['/review/reference-source/fsd/shared/ui/primitives.jsx','/review/reference-source/fsd/entities/article/ui/ArticleFigure.jsx']){const r=await page.goto(base+path);rows.push({name:'source-anchor',path,status:r.status(),text:(await page.locator('body').innerText()).slice(0,6000)});}
for(const [name,path,width,theme,sel]of [['real-home','/',1440,'light',null],['real-reading','/articles/'+encodeURIComponent('о-tilix-и-d-интервью-с-геральдом-нанном')+'/',390,'dark','h2[id]'],['real-json','/tools/',320,'light',null],['real-404','/missing-kit-review/',390,'dark',null]]){await page.setViewportSize({width,height:1000});const r=await page.goto(base+path);await page.getByRole('combobox',{name:'Тема',exact:true}).selectOption(theme);if(sel)await page.locator(sel).nth(2).scrollIntoViewIfNeeded();await page.screenshot({path:`${out}/${name}-${width}-${theme}.png`});rows.push({name,path,width,theme,status:r?.status(),...await page.evaluate(()=>({pageWidth:document.documentElement.scrollWidth,ym:typeof window.ym,external:performance.getEntriesByType('resource').filter(r=>!r.name.startsWith(location.origin)).map(r=>r.name)}))});}return{matrix,rows};}