Liga acervo documental e guias a jornada do investidor

This commit is contained in:
2026-10-08 18:54:24 +02:00
parent 51c7fb92b1
commit 30acdc9934
18 changed files with 14024 additions and 1 deletions
@@ -0,0 +1,135 @@
const {
chromium,
} = require('C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
const assert = require('node:assert/strict');
const fs = require('node:fs');
(async () => {
const b = await chromium.launch({
headless: true,
executablePath:
'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe',
});
const checks = [];
try {
for (const width of [1440, 390]) {
const c = await b.newContext({ viewport: { width, height: 850 } });
await c.route('**/*', (r) =>
r.request().url().startsWith('http://127.0.0.1:18092')
? r.continue()
: r.abort(),
);
const p = await c.newPage();
const errors = [];
p.on('pageerror', (e) => errors.push(e.message));
for (const path of [
'/documentos',
'/legislacao',
'/como-investir',
]) {
const r = await p.goto('http://127.0.0.1:18092' + path);
assert.equal(
r.headers()['x-investmoz-qa-target'],
'investmoz_v2_20261008_test:55441',
);
const section = p.getByRole('region', {
name: 'Fontes e guias para a jornada',
exact: true,
});
await section.waitFor();
await section
.getByText(
'Guia de preparação fiscal — 14 etapas da fonte',
{ exact: true },
)
.click();
assert.equal(
await section.locator('details ol > li').count(),
14,
);
assert.match(
await section.locator('details').innerText(),
/p\.973–1042/,
);
assert.match(
await section
.locator('details ol > li')
.first()
.innerText(),
/973 \(histórico: 1782\)/,
);
assert.match(
await section.innerText(),
/não concede benefícios/,
);
assert.match(
await section.innerText(),
/estados independentes/,
);
await section
.getByRole('link', {
name: 'Consultar exemplares de formulários',
exact: true,
})
.click();
await p.waitForURL(
(u) =>
u.pathname === '/documentos' &&
u.searchParams.get('document_type') === 'official_form',
);
await p
.getByRole('region', {
name: 'Fontes e guias para a jornada',
exact: true,
})
.getByRole('link', {
name: 'Consultar guias disponíveis',
exact: true,
})
.click();
await p.waitForURL(
(u) => u.searchParams.get('document_type') === 'guide',
);
await p
.getByRole('region', {
name: 'Fontes e guias para a jornada',
exact: true,
})
.getByRole('link', {
name: 'Explorar todo o acervo autorizado',
exact: true,
})
.click();
await p.waitForURL(
(u) => u.pathname === '/documentos' && !u.search,
);
checks.push({
width,
path,
formFilter: true,
guideFilter: true,
unrestrictedLibrary: true,
});
}
assert.deepEqual(errors, []);
await p.screenshot({
path: `storage/app/private/investmoz-v2/legal-journey-${width}.png`,
fullPage: true,
});
await c.close();
}
fs.writeFileSync(
'storage/app/private/investmoz-v2/legal-journey-browser.json',
JSON.stringify(
{ qa: 'investmoz_v2_20261008_test:55441', checks },
null,
2,
),
);
console.log('Legal journey QA navigation passed');
} finally {
await b.close();
}
})().catch((e) => {
console.error(e);
process.exitCode = 1;
});