Files
Investidor-V2/tools/portal-keyboard-visual-qa.cjs
T
nala 20971d523f
tests / ci (push) Canceled after 0s
oportunidades 6
2026-10-10 21:17:46 +02:00

5 lines
1.3 KiB
JavaScript

const {start,assert,sanitized}=require('./portal-visual-qa-lib.cjs');
(async()=>{const q=await start('keyboard-chromium-20261010');let page,ctx;
try{({page,ctx}=await q.context('anonymous',390));q.proof.pages=[];for(const route of ['/agronegocio','/turismo','/manifestar-interesse']){await q.open(page,route);await page.getByRole('heading').first().waitFor();await page.keyboard.press('Tab');const focus=await page.evaluate(()=>({text:document.activeElement.textContent.trim(),href:document.activeElement.getAttribute('href'),width:document.activeElement.getBoundingClientRect().width}));assert.equal(focus.href,'#portal-content');assert(focus.width>10);await page.keyboard.press('Enter');assert.equal(await page.evaluate(()=>document.activeElement.id),'portal-content');q.proof.pages.push({route,skip_link_first:true,visible_on_focus:true,keyboard_target_reached:true});await q.shot(page,route.replace(/\W/g,'_')+'-keyboard',false);}q.proof.checks.keyboard_skip_links=true;q.proof.screen_reader_tested=false;q.proof.result='passed';
}catch(e){q.proof.result='failed';q.proof.error=sanitized(e);}finally{q.proof.finished_at=new Date().toISOString();q.save();await q.browser.close();console.log(JSON.stringify({result:q.proof.result,pages:q.proof.pages?.length,receipt:q.receipt}));if(q.proof.result!=='passed')process.exitCode=1;}})();