@@ -1,43 +1,147 @@
|
||||
const { chromium } = require('C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const {
|
||||
chromium,
|
||||
} = require('C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const fs = require('node:fs');
|
||||
const assert = require('node:assert/strict');
|
||||
const base = 'http://127.0.0.1:18087';
|
||||
(async () => {
|
||||
const browser = await chromium.launch({headless:true, executablePath:'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe'});
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
executablePath:
|
||||
'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe',
|
||||
});
|
||||
try {
|
||||
const context = await browser.newContext();
|
||||
await context.route('**/*', route => route.request().url().startsWith(base) ? route.continue() : route.abort());
|
||||
await context.route('**/*', (route) =>
|
||||
route.request().url().startsWith(base)
|
||||
? route.continue()
|
||||
: route.abort(),
|
||||
);
|
||||
const page = await context.newPage();
|
||||
const errors = [];
|
||||
page.on('pageerror', error => errors.push(error.message));
|
||||
await page.goto(base+'/login');
|
||||
await page.locator('input[type=email]').fill('relationship-qa@example.invalid');
|
||||
await page.locator('input[type=password]').fill('QA-Relationship-2026!');
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
await page.goto(base + '/login');
|
||||
await page
|
||||
.locator('input[type=email]')
|
||||
.fill('relationship-qa@example.invalid');
|
||||
await page
|
||||
.locator('input[type=password]')
|
||||
.fill('QA-Relationship-2026!');
|
||||
await page.locator('button[type=submit]').click();
|
||||
await page.waitForURL(url => !url.pathname.startsWith('/login'));
|
||||
const response = await page.goto(base+'/management/relationship-repair', {waitUntil:'networkidle'});
|
||||
assert.equal(response.headers()['x-investmoz-qa-target'], 'anchor_restore_20261007_test:55441');
|
||||
await page.getByRole('heading',{name:'Fundamentadas: 2',exact:true}).waitFor();
|
||||
await page.getByRole('heading',{name:'Pendentes: 1',exact:true}).waitFor();
|
||||
await page.getByRole('heading',{name:'Contraditórias: 1',exact:true}).waitFor();
|
||||
const grounded = page.getByRole('region',{name:'Associações fundamentadas'});
|
||||
for (const text of ['Localização atual','Localização proposta','Documento de origem','Motivo','Sem coordenadas']) assert((await grounded.innerText()).includes(text));
|
||||
await grounded.getByRole('button',{name:'Aplicar esta associação',exact:true}).first().click();
|
||||
await grounded.getByRole('button',{name:'Associação aplicada',exact:true}).waitFor();
|
||||
assert.equal(await grounded.getByRole('button',{name:'Aplicar esta associação',exact:true}).count(),1);
|
||||
await grounded.getByRole('button',{name:'Aplicar esta associação',exact:true}).click();
|
||||
await page.waitForFunction(()=>document.querySelectorAll('[data-row-id] button').length===4 && [...document.querySelectorAll('[data-row-id] button')].filter(button=>button.textContent==='Associação aplicada').length===2);
|
||||
assert(await page.getByRole('region',{name:'Associações pendentes'}).getByRole('button').isDisabled());
|
||||
assert(await page.getByRole('region',{name:'Associações contraditórias'}).getByRole('button').isDisabled());
|
||||
await page.waitForURL((url) => !url.pathname.startsWith('/login'));
|
||||
const response = await page.goto(
|
||||
base + '/management/relationship-repair',
|
||||
{ waitUntil: 'networkidle' },
|
||||
);
|
||||
assert.equal(
|
||||
response.headers()['x-investmoz-qa-target'],
|
||||
'anchor_restore_20261007_test:55441',
|
||||
);
|
||||
await page
|
||||
.getByRole('heading', { name: 'Fundamentadas: 2', exact: true })
|
||||
.waitFor();
|
||||
await page
|
||||
.getByRole('heading', { name: 'Pendentes: 1', exact: true })
|
||||
.waitFor();
|
||||
await page
|
||||
.getByRole('heading', { name: 'Contraditórias: 1', exact: true })
|
||||
.waitFor();
|
||||
const grounded = page.getByRole('region', {
|
||||
name: 'Associações fundamentadas',
|
||||
});
|
||||
for (const text of [
|
||||
'Localização atual',
|
||||
'Localização proposta',
|
||||
'Documento de origem',
|
||||
'Motivo',
|
||||
'Sem coordenadas',
|
||||
])
|
||||
assert((await grounded.innerText()).includes(text));
|
||||
await grounded
|
||||
.getByRole('button', {
|
||||
name: 'Aplicar esta associação',
|
||||
exact: true,
|
||||
})
|
||||
.first()
|
||||
.click();
|
||||
await grounded
|
||||
.getByRole('button', { name: 'Associação aplicada', exact: true })
|
||||
.waitFor();
|
||||
assert.equal(
|
||||
await grounded
|
||||
.getByRole('button', {
|
||||
name: 'Aplicar esta associação',
|
||||
exact: true,
|
||||
})
|
||||
.count(),
|
||||
1,
|
||||
);
|
||||
await grounded
|
||||
.getByRole('button', {
|
||||
name: 'Aplicar esta associação',
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelectorAll('[data-row-id] button').length ===
|
||||
4 &&
|
||||
[...document.querySelectorAll('[data-row-id] button')].filter(
|
||||
(button) => button.textContent === 'Associação aplicada',
|
||||
).length === 2,
|
||||
);
|
||||
assert(
|
||||
await page
|
||||
.getByRole('region', { name: 'Associações pendentes' })
|
||||
.getByRole('button')
|
||||
.isDisabled(),
|
||||
);
|
||||
assert(
|
||||
await page
|
||||
.getByRole('region', { name: 'Associações contraditórias' })
|
||||
.getByRole('button')
|
||||
.isDisabled(),
|
||||
);
|
||||
assert((await page.locator('body').innerText()).includes('Autor:'));
|
||||
assert((await page.locator('body').innerText()).includes('Data:'));
|
||||
for (const width of [1440,390]) {
|
||||
await page.setViewportSize({width,height:1000});
|
||||
assert(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth));
|
||||
await page.screenshot({path:`docs/investmoz/relationships/territorial-${width}.png`,fullPage:true});
|
||||
for (const width of [1440, 390]) {
|
||||
await page.setViewportSize({ width, height: 1000 });
|
||||
assert(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth <= innerWidth,
|
||||
),
|
||||
);
|
||||
await page.screenshot({
|
||||
path: `docs/investmoz/relationships/territorial-${width}.png`,
|
||||
fullPage: true,
|
||||
});
|
||||
}
|
||||
assert.deepEqual(errors,[]);
|
||||
fs.writeFileSync('docs/investmoz/relationships/territorial-browser-qa.json',JSON.stringify({target:'anchor_restore_20261007_test:55441',passed:true,individualApplications:2,pendingRetained:1,contradictoryRetained:1,noCoordinatesAccepted:true,auditAuthorDateSource:true,viewports:[1440,390],errors},null,2));
|
||||
console.log('QA territorial browser passed: two individual applications, conflicts retained, author/date/source, desktop/mobile.');
|
||||
} finally { await browser.close(); }
|
||||
})().catch(error=>{console.error(error);process.exitCode=1;});
|
||||
assert.deepEqual(errors, []);
|
||||
fs.writeFileSync(
|
||||
'docs/investmoz/relationships/territorial-browser-qa.json',
|
||||
JSON.stringify(
|
||||
{
|
||||
target: 'anchor_restore_20261007_test:55441',
|
||||
passed: true,
|
||||
individualApplications: 2,
|
||||
pendingRetained: 1,
|
||||
contradictoryRetained: 1,
|
||||
noCoordinatesAccepted: true,
|
||||
auditAuthorDateSource: true,
|
||||
viewports: [1440, 390],
|
||||
errors,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
console.log(
|
||||
'QA territorial browser passed: two individual applications, conflicts retained, author/date/source, desktop/mobile.',
|
||||
);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
})().catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user