Files
Investidor-V2/tools/portal-workflow-upgrade-final-ui-qa.cjs
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

12 lines
2.8 KiB
JavaScript

const {start,assert,DIR,path,fs,sanitized}=require('./portal-workflow-upgrade-browser-lib.cjs');
void(async()=>{const q=await start('workflow-upgrade-final-ui-chromium-20261011');const contexts=[];try{
const prior=JSON.parse(fs.readFileSync(path.join(DIR,'workflow-upgrade-document-pipeline-chromium-20261011.json'),'utf8'));
const p=await q.context('promoter',390);contexts.push(p.ctx);await q.login(p.page,'promoter');await q.open(p.page,`/minhas-oportunidades/${prior.opportunity_id}/resources`);
await p.page.getByRole('button',{name:'Imagens',exact:true}).click();await p.page.locator('main').first().waitFor();await p.page.waitForTimeout(1500);q.proof.actual_privacy=(await p.page.locator('body').innerText()).split('O Superutilizador')[1]?.slice(0,240);q.proof.current_path=new URL(p.page.url()).pathname;q.proof.headings=await p.page.locator('h1,h2').allTextContents();q.proof.visible_body_excerpt=(await p.page.locator('body').innerText()).slice(0,1500);if(q.proof.current_path.endsWith('/resources'))await q.shot(p.page,'privacy-render-diagnostic',false);q.save();assert(q.proof.actual_privacy?.includes('perfil operacional'),JSON.stringify(q.proof.actual_privacy));await p.page.getByRole('button',{name:'Imagens',exact:true}).click();await p.page.locator('img[src*="/resources/images/"]').first().waitFor();
assert(await p.page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth));await q.shot(p.page,'final-privacy-scope-and-derivative-390',false);q.proof.checks.actual_privacy_warning_and_preview_390=true;
const s=await q.context('super_first');contexts.push(s.ctx);await q.login(s.page,'super_first');await q.open(s.page,'/perfis/gestao');assert.equal(await s.page.locator('option[value="view"]').textContent(),'Consultar dossier e anexos');q.proof.checks.read_elevation_labeled_in_administration=true;
const build=JSON.parse(fs.readFileSync(path.join(DIR,'workflow-upgrade-production-build-20261011.json'),'utf8'));const asset=Object.keys(build.assets).find(n=>/^assets\/opportunity-resources-/.test(n)&&n.endsWith('.js'));
const checksum=await p.page.evaluate(async asset=>{const r=await fetch('/build/'+asset);const b=await r.arrayBuffer(),hash=await crypto.subtle.digest('SHA-256',b);return{status:r.status,sha256:[...new Uint8Array(hash)].map(v=>v.toString(16).padStart(2,'0')).join('')};},asset);assert.equal(checksum.status,200);assert.equal(checksum.sha256,build.assets[asset]);q.proof.loaded_asset={asset,...checksum};q.proof.checks.loaded_production_bundle_hash_matches=true;
q.proof.result='passed';q.proof.AB_C37_not_repeated=true;q.save();console.log(JSON.stringify({result:'passed',checks:q.proof.checks,active_writes:0}));
}catch(e){q.proof.result='failed';q.proof.failure=sanitized(e);q.save();console.log(JSON.stringify({result:'failed',failure:q.proof.failure}));process.exitCode=1;}finally{for(const ctx of contexts)await ctx.close();await q.browser.close();}})();