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

42 lines
4.4 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:65019',out='/tmp/progcode-ds-creative/evidence', rows=[];
await page.setViewportSize({width:390,height:900});
await page.goto(base+'/tools/');
await page.getByRole('combobox',{name:'Тема',exact:true}).selectOption('dark');
await page.locator('#json').fill('{"message":"Здравствуйте","items":[1,2]}');
await page.getByRole('button',{name:'Форматировать',exact:true}).click();
await page.locator('.result-panel').scrollIntoViewIfNeeded();
rows.push({case:'json-success',result:await page.locator('.result-panel').innerText()});
await page.screenshot({path:out+'/json-success-390-dark.png'});
await page.evaluate(()=>Object.defineProperty(navigator,'clipboard',{configurable:true,value:{writeText:async()=>{throw new Error('denied by review fixture')}}}));
await page.getByRole('button',{name:'Копировать',exact:true}).click();
rows.push({case:'copy-denied',text:await page.locator('.result-panel').innerText()});
await page.screenshot({path:out+'/json-copy-denied-390-dark.png'});
await page.locator('#json').fill('{ broken');await page.getByRole('button',{name:'Форматировать',exact:true}).click();
await page.locator('.result-panel').scrollIntoViewIfNeeded();
rows.push({case:'json-error',text:await page.locator('.result-panel').innerText()});
await page.screenshot({path:out+'/json-error-390-dark.png'});
await page.getByRole('button',{name:'Очистить',exact:true}).click();rows.push({case:'json-clear',input:await page.locator('#json').inputValue(),copyDisabled:await page.getByRole('button',{name:'Копировать',exact:true}).isDisabled()});
await page.goto(base+'/#journal');await page.locator('#search').fill('jQuery');rows.push({case:'jquery',text:await page.locator('.search-status').innerText()});
await page.locator('#search').fill('Bitrix');rows.push({case:'bitrix',text:await page.locator('.search-status').innerText()});
await page.getByRole('button',{name:'D',exact:true}).click();rows.push({case:'topic-and-query',text:await page.locator('.search-status').innerText()});
await page.getByRole('button',{name:'Сбросить поиск',exact:true}).click();rows.push({case:'reset',text:await page.locator('.search-status').innerText(),query:await page.locator('#search').inputValue()});
await page.goto(base+'/articles/'+encodeURIComponent('новый-движок-ctfe')+'/');await page.setViewportSize({width:320,height:900});
await page.locator('.table-scroll').scrollIntoViewIfNeeded();await page.locator('.table-scroll').focus();
await page.keyboard.press('End');for(let i=0;i<12;i++)await page.keyboard.press('ArrowRight');
rows.push({case:'table-right',...await page.locator('.table-scroll').evaluate(e=>({left:e.scrollLeft,width:e.clientWidth,scroll:e.scrollWidth,focus:document.activeElement===e}))});
await page.screenshot({path:out+'/table-keyboard-right-320-dark.png'});
await page.goto(base+'/articles/'+encodeURIComponent('пишем-аналог-функции-php-preg_match_all-на-языке-прог')+'/');
const lens=await page.locator('pre').evaluateAll(es=>es.map(e=>e.innerText.length));const longest=lens.indexOf(Math.max(...lens));const pre=page.locator('pre').nth(longest);await pre.scrollIntoViewIfNeeded();await pre.focus();await page.keyboard.press('End');for(let i=0;i<12;i++)await page.keyboard.press('ArrowRight');
rows.push({case:'longest-code',length:lens[longest],...await pre.evaluate(e=>({left:e.scrollLeft,width:e.clientWidth,scroll:e.scrollWidth,focus:document.activeElement===e}))});
await page.screenshot({path:out+'/code-keyboard-right-320-dark.png'});
await page.goto(base+'/ui-kit/');await page.setViewportSize({width:1440,height:900});
await page.locator('.article-meta').first().scrollIntoViewIfNeeded();await page.screenshot({path:out+'/kit-real-specimens-1440-dark.png'});
rows.push({case:'kit-labels',text:await page.locator('main').innerText()});
await page.goto(base+'/articles/'+encodeURIComponent('о-tilix-и-d-интервью-с-геральдом-нанном')+'/');
rows.push({case:'prose',...await page.locator('.article-content p').filter({hasText:' '}).first().evaluate(e=>{const s=getComputedStyle(e);return{font:s.fontFamily,size:s.fontSize,leading:s.lineHeight,width:e.getBoundingClientRect().width}})});
await page.locator('aside.contents-rail a').last().click();await page.screenshot({path:out+'/long-anchor-end-1440-dark.png'});
rows.push({case:'toc-last',hash:await page.evaluate(()=>location.hash)});
return rows;
}