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

26 lines
2.1 KiB
JavaScript

// Check only the changed fingerprint/preview and actual consolidated assets. No installation repeat.
const {start,assert,DIR,path,fs,sanitized,TARGET}=require('./portal-service-followup-browser-lib.cjs');
const manifest=JSON.parse(fs.readFileSync(path.join(__dirname,'../outputs/investmoz-workflow-consolidated-20261011/manifesto.json'),'utf8'));
void(async()=>{const q=await start('consolidated-preview-qa');let ctx;try{
const legacy=await q.context('manager');await q.login(legacy.page,'manager');
assert.equal((await q.json(legacy.page,'/management/profile-install')).status,403);
await legacy.ctx.close();
q.proof.checks.legacy_manager_without_initialized_pair_authority_denied=true;
const a=await q.context('super_first');ctx=a.ctx;await q.login(a.page,'super_first');
const profiles=await q.json(a.page,'/management/profile-install');
assert.equal(profiles.status,200);assert.equal(profiles.data.code_hash,manifest.profile_fingerprint);
assert.equal(profiles.data.installed,true);assert.equal(profiles.data.ready,true);
const resources=await q.json(a.page,'/management/opportunity-resources-install');
assert.equal(resources.status,200);assert.equal(resources.data.code_hash,manifest.resources_fingerprint);
assert.equal(resources.data.installed,true);assert.equal(resources.data.ready,true);
await q.open(a.page,'/management/profile-install');
assert((await a.page.locator('body').innerText()).includes('perfis'));
await q.shot(a.page,'consolidated-profile-preview',false);
q.proof.checks.changed_profile_fingerprint_and_readiness_match=true;
q.proof.checks.resource_dependency_fingerprint_and_readiness_match=true;
q.proof.checks.actual_consolidated_production_preview_rendered=true;
q.proof.installation_repeated=false;q.proof.result='passed';q.save();
console.log(JSON.stringify({result:'passed',target:TARGET,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{if(ctx)await ctx.close();await q.browser.close();}})();