75 lines
2.6 KiB
JavaScript
75 lines
2.6 KiB
JavaScript
const {
|
|
start,
|
|
DIR,
|
|
path,
|
|
assert: _assert,
|
|
sanitized,
|
|
} = require('./portal-visual-qa-lib.cjs');
|
|
void (async () => {
|
|
const q = await start('layout-map-diagnosis-chromium-20261010');
|
|
let page, ctx;
|
|
try {
|
|
({ page, ctx } = await q.context('investor18', 390));
|
|
await q.login(page, 'investor18');
|
|
const e = require(path.join(DIR, 'investor-ab-chromium-20261010.json'))
|
|
.scenarios.A;
|
|
await q.open(page, '/investimentos/' + e.id);
|
|
await page
|
|
.getByRole('heading', { name: e.title, exact: true })
|
|
.waitFor();
|
|
q.proof.overflow = await page.evaluate(() =>
|
|
Array.from(document.querySelectorAll('main *'))
|
|
.filter((n) => n.getBoundingClientRect().right > innerWidth + 1)
|
|
.map((n) => ({
|
|
tag: n.tagName,
|
|
id: n.id,
|
|
class: n.className,
|
|
type: n.getAttribute('type'),
|
|
right: n.getBoundingClientRect().right,
|
|
}))
|
|
.slice(-16),
|
|
);
|
|
await ctx.close();
|
|
({ page, ctx } = await q.context('promoter', 390));
|
|
await q.login(page, 'promoter');
|
|
await q.open(page, '/minhas-oportunidades/30/edit');
|
|
await page.getByRole('heading').first().waitFor();
|
|
q.proof.canonical_selectors = await page
|
|
.getByRole('combobox')
|
|
.evaluateAll((ns) =>
|
|
ns.map((n) => ({
|
|
name:
|
|
n.getAttribute('aria-label') ||
|
|
n.labels?.[0]?.textContent?.trim(),
|
|
id: n.id,
|
|
value: n.value,
|
|
options:
|
|
n.tagName === 'SELECT'
|
|
? Array.from(n.options).map((o) => ({
|
|
value: o.value,
|
|
label: o.text,
|
|
}))
|
|
: [],
|
|
})),
|
|
);
|
|
await q.shot(page, 'canonical-editor');
|
|
await ctx.close();
|
|
q.proof.result = 'diagnosed';
|
|
} 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,
|
|
overflow: q.proof.overflow,
|
|
receipt: q.receipt,
|
|
}),
|
|
);
|
|
if (q.proof.result === 'failed') process.exitCode = 1;
|
|
}
|
|
})();
|