98 lines
3.5 KiB
JavaScript
98 lines
3.5 KiB
JavaScript
const { start, assert, sanitized } = require('./portal-visual-qa-lib.cjs');
|
|
void (async () => {
|
|
const q = await start('next-installer-preview-chromium-20261010');
|
|
try {
|
|
const holder = await q.context('super_first');
|
|
await q.login(holder.page, 'super_first');
|
|
const url =
|
|
'/management/opportunity-resources-install/organization-country';
|
|
q.phase(
|
|
'Authenticated holder: installed QA extension, separate readiness',
|
|
);
|
|
const r = await q.open(holder.page, url);
|
|
assert.equal(r.status(), 200);
|
|
const plan = await q.json(holder.page, url);
|
|
assert.equal(plan.status, 200);
|
|
assert.equal(
|
|
plan.data.migration,
|
|
'2026_10_10_050000_extend_organization_country',
|
|
);
|
|
assert.equal(plan.data.installed, true);
|
|
assert.equal(plan.data.consistent, true);
|
|
assert.equal(
|
|
plan.data.target.database,
|
|
'desk_restore_20261009_174726_test',
|
|
);
|
|
assert.equal(plan.data.target.port, 55441);
|
|
assert(
|
|
await holder.page
|
|
.getByRole('button', {
|
|
name: 'Aplicar plano de gestão',
|
|
exact: true,
|
|
})
|
|
.isDisabled(),
|
|
);
|
|
q.proof.preview = {
|
|
installed: true,
|
|
consistent: true,
|
|
ready: plan.data.ready,
|
|
code_hash: plan.data.code_hash,
|
|
no_apply: true,
|
|
};
|
|
await q.shot(holder.page, 'installed-qa-not-readiness');
|
|
await holder.ctx.close();
|
|
const promoter = await q.context('promoter');
|
|
await q.login(promoter.page, 'promoter');
|
|
assert.equal((await q.json(promoter.page, url)).status, 403);
|
|
q.proof.checks.non_holder_denied = true;
|
|
await promoter.ctx.close();
|
|
const audit = await q.context('multiple');
|
|
await q.login(audit.page, 'multiple');
|
|
await q.open(audit.page, '/investidor/profile');
|
|
const profile = await q.json(audit.page, '/api/v1/investment/profile');
|
|
assert.equal(profile.status, 200);
|
|
const org = profile.data.organizations.find(
|
|
(o) => o.id === '99964753-2632-4658-a687-8ebc6a178296',
|
|
);
|
|
assert(org && !org.canEdit);
|
|
const box = audit.page.getByRole('region', {
|
|
name: 'Cadastro mestre: Synthetic QA organization',
|
|
exact: true,
|
|
});
|
|
assert(
|
|
await box
|
|
.getByRole('combobox', {
|
|
name: 'País de constituição da organização',
|
|
exact: true,
|
|
})
|
|
.isDisabled(),
|
|
);
|
|
assert(
|
|
await box
|
|
.getByRole('button', {
|
|
name: 'Guardar país no cadastro mestre',
|
|
exact: true,
|
|
})
|
|
.isDisabled(),
|
|
);
|
|
q.proof.checks.auditor_override_in_browser = true;
|
|
await q.shot(audit.page, 'auditor-master-read-only');
|
|
q.proof.result = 'passed';
|
|
} catch (e) {
|
|
q.proof.result = 'failed';
|
|
q.proof.error = sanitized(e);
|
|
} finally {
|
|
q.proof.completed_at = new Date().toISOString();
|
|
q.save();
|
|
await q.browser.close();
|
|
}
|
|
console.log(
|
|
JSON.stringify({
|
|
result: q.proof.result,
|
|
checks: q.proof.checks,
|
|
error: q.proof.error,
|
|
}),
|
|
);
|
|
if (q.proof.result === 'failed') process.exitCode = 1;
|
|
})();
|