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

5 lines
3.9 KiB
JavaScript

async(page)=>{const base='http://127.0.0.1:50480',o={};await page.setViewportSize({width:1440,height:1000});await page.emulateMedia({reducedMotion:'reduce'});await page.goto(base+'/');o.field=await page.locator('#search').evaluate(e=>({width:e.getBoundingClientRect().width,display:getComputedStyle(e).display,cls:e.className}));o.search=[];for(const q of ['jQuery','Bitrix','never-matches-123']){await page.getByRole('searchbox').fill(q);o.search.push({q,status:await page.getByRole('status').allTextContents()});}await page.getByRole('button',{name:'Сбросить поиск'}).click();o.search.push({q:'reset',status:await page.getByRole('status').allTextContents()});await page.getByRole('button',{name:'D',exact:true}).click();o.search.push({q:'D',status:await page.getByRole('status').allTextContents()});await page.locator('#search').scrollIntoViewIfNeeded();await page.screenshot({path:'/tmp/progcode-ds-cm-f5/home-field-1440-dark.png'});
await page.goto(base+'/tools/');await page.getByRole('button',{name:'Очистить',exact:true}).click();await page.getByRole('button',{name:'Форматировать',exact:true}).click();o.json={empty:await page.getByRole('status').allTextContents()};await page.locator('textarea').fill('{bad');await page.getByRole('button',{name:'Форматировать',exact:true}).click();o.json.invalid=await page.getByRole('status').allTextContents();o.json.ariaInvalid=await page.locator('textarea').getAttribute('aria-invalid');await page.locator('textarea').fill('{"title":"Привет","array":[1,2,3],"ok":true}');await page.getByRole('button',{name:'Форматировать',exact:true}).click();o.json.result=await page.locator('pre').innerText();await page.getByRole('button',{name:'Сжать',exact:true}).click();o.json.compressed=await page.locator('pre').innerText();await page.evaluate(()=>Object.defineProperty(navigator,'clipboard',{configurable:true,value:{writeText:async()=>{throw Error('CM injected denial')}}}));await page.getByRole('button',{name:'Копировать',exact:true}).click();o.json.copyDenial=await page.getByRole('status').allTextContents();await page.screenshot({path:'/tmp/progcode-ds-cm-f5/json-result-copydenial-1440.png'});
await page.setViewportSize({width:390,height:1000});o.figures={};for(const [id,path]of[['bitrix','/articles/bitrix-api-add-foto-editor/'],['gc','/articles/dconf-2017-под-капотом-мусорщика-ди-дмитрий-ол/'],['uikit','/ui-kit/']]){await page.goto(base+path);await page.getByLabel('Тема',{exact:true}).selectOption('dark');let figures=page.locator('figure');o.figures[id]=[];for(let i=0;i<await figures.count();i++){const fig=figures.nth(i);await fig.scrollIntoViewIfNeeded();await fig.locator('img').evaluateAll(async imgs=>{await Promise.all(imgs.map(i=>i.decode().catch(()=>{})))});o.figures[id].push(await fig.evaluate(e=>({caption:e.querySelector('figcaption')?.innerText,images:[...e.querySelectorAll('img')].map(i=>({src:i.getAttribute('src'),complete:i.complete,natural:i.naturalWidth,width:i.getBoundingClientRect().width})),width:e.getBoundingClientRect().width})));await fig.screenshot({path:'/tmp/progcode-ds-cm-f5/'+id+'-figure'+i+'-390-dark.png'});}if(id==='uikit'){o.specimens=await page.locator('.specimen-label').allTextContents();o.downloadNA=(await page.locator('main').innerText()).includes('N/A');}}
await page.goto(base+'/accessibility/');await page.keyboard.press('Tab');o.skip=await page.evaluate(()=>({text:document.activeElement.innerText,href:document.activeElement.getAttribute('href')}));await page.screenshot({path:'/tmp/progcode-ds-cm-f5/a11y-skip-390-dark.png'});await page.keyboard.press('Enter');o.skip.after=await page.evaluate(()=>({hash:location.hash,focus:document.activeElement.id}));await page.goto(base+'/does-not-exist-cm-f5/');o.unknown={status:await page.locator('h1').innerText(),body:await page.locator('main').innerText()};await page.screenshot({path:'/tmp/progcode-ds-cm-f5/404-390-dark.png'});return o;}