@@ -1,51 +1,165 @@
|
||||
const {chromium} = require('C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const fs = require('node:fs'), assert = require('node:assert/strict');
|
||||
const {
|
||||
chromium,
|
||||
} = require('C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const fs = require('node:fs'),
|
||||
assert = require('node:assert/strict');
|
||||
const base = 'http://127.0.0.1:18096';
|
||||
(async () => {
|
||||
const browser = await chromium.launch({headless:true, executablePath:'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe'});
|
||||
const errors = [], results = [];
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
executablePath:
|
||||
'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe',
|
||||
});
|
||||
const errors = [],
|
||||
results = [];
|
||||
async function login(width) {
|
||||
const context = await browser.newContext({viewport:{width,height:900}});
|
||||
await context.route('**/*', route => route.request().url().startsWith(base) || route.request().url().startsWith('data:') ? route.continue() : route.abort());
|
||||
const page = await context.newPage(); page.on('pageerror', e => errors.push(e.message));
|
||||
await page.goto(base+'/login');
|
||||
assert.match((await page.request.get(base+'/login')).headers()['x-investmoz-qa-target'], /_test:55441$/);
|
||||
await page.getByLabel('Email address').fill('opportunity-manager@example.invalid');
|
||||
await page.getByLabel('Password',{exact:true}).fill('Opportunity-QA-2026!');
|
||||
await page.getByRole('button',{name:'Log in',exact:true}).click(); await page.waitForURL('**/dashboard');
|
||||
return {page,context};
|
||||
const context = await browser.newContext({
|
||||
viewport: { width, height: 900 },
|
||||
});
|
||||
await context.route('**/*', (route) =>
|
||||
route.request().url().startsWith(base) ||
|
||||
route.request().url().startsWith('data:')
|
||||
? route.continue()
|
||||
: route.abort(),
|
||||
);
|
||||
const page = await context.newPage();
|
||||
page.on('pageerror', (e) => errors.push(e.message));
|
||||
await page.goto(base + '/login');
|
||||
assert.match(
|
||||
(await page.request.get(base + '/login')).headers()[
|
||||
'x-investmoz-qa-target'
|
||||
],
|
||||
/_test:55441$/,
|
||||
);
|
||||
await page
|
||||
.getByLabel('Email address')
|
||||
.fill('opportunity-manager@example.invalid');
|
||||
await page
|
||||
.getByLabel('Password', { exact: true })
|
||||
.fill('Opportunity-QA-2026!');
|
||||
await page.getByRole('button', { name: 'Log in', exact: true }).click();
|
||||
await page.waitForURL('**/dashboard');
|
||||
return { page, context };
|
||||
}
|
||||
const desktop = await login(1280), p = desktop.page;
|
||||
await p.goto(base+'/investidor/profile');
|
||||
const desktop = await login(1280),
|
||||
p = desktop.page;
|
||||
await p.goto(base + '/investidor/profile');
|
||||
await p.locator('#residence_country_codeaccount').selectOption('PT');
|
||||
const saved = p.waitForResponse(r => r.request().method() === 'PUT' && r.url().endsWith('/investidor/profile'));
|
||||
await p.getByRole('button',{name:'Guardar perfil de investimento',exact:true}).click();
|
||||
const saved = p.waitForResponse(
|
||||
(r) =>
|
||||
r.request().method() === 'PUT' &&
|
||||
r.url().endsWith('/investidor/profile'),
|
||||
);
|
||||
await p
|
||||
.getByRole('button', {
|
||||
name: 'Guardar perfil de investimento',
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
const response = await saved;
|
||||
assert([200, 302, 303].includes(response.status()), `Guardar perfil: HTTP ${response.status()}`);
|
||||
await p.getByText('Perfil de investimento guardado.', {exact:true}).waitFor();
|
||||
await p.reload(); assert.equal(await p.locator('#residence_country_codeaccount').inputValue(),'PT');
|
||||
results.push({route:'/investidor/profile',action:'guardar residência',http:response.status(),visibleResult:true,recovered:true});
|
||||
assert(
|
||||
[200, 302, 303].includes(response.status()),
|
||||
`Guardar perfil: HTTP ${response.status()}`,
|
||||
);
|
||||
await p
|
||||
.getByText('Perfil de investimento guardado.', { exact: true })
|
||||
.waitFor();
|
||||
await p.reload();
|
||||
assert.equal(
|
||||
await p.locator('#residence_country_codeaccount').inputValue(),
|
||||
'PT',
|
||||
);
|
||||
results.push({
|
||||
route: '/investidor/profile',
|
||||
action: 'guardar residência',
|
||||
http: response.status(),
|
||||
visibleResult: true,
|
||||
recovered: true,
|
||||
});
|
||||
await desktop.context.close();
|
||||
const mobile = await login(390), m = mobile.page;
|
||||
await m.goto(base+'/investidor/profile'); await m.evaluate(()=>localStorage.clear()); await m.reload();
|
||||
assert.equal(await m.locator('#residence_country_codeaccount').inputValue(),'PT');
|
||||
const search = m.getByRole('textbox',{name:'Pesquisar país'}).first(); await search.fill('portugal');
|
||||
assert.equal(await m.locator('#residence_country_codeaccount option').count(),2);
|
||||
assert(await m.evaluate(()=>document.documentElement.scrollWidth <= innerWidth+1));
|
||||
await m.screenshot({path:'storage/app/private/investmoz-v2/functional-country-mobile.png',fullPage:true});
|
||||
results.push({route:'/investidor/profile',action:'nova sessão móvel e pesquisa',serverRecovery:true,localStorage:false});
|
||||
await m.goto(base+'/oportunidades?dimension=cluster');
|
||||
assert.equal(await m.getByText('ZEE',{exact:true}).count(),0);
|
||||
await m.getByRole('textbox',{name:'Pesquisar Província'}).fill('Maputo');
|
||||
await m.getByLabel('Província',{exact:true}).locator('option').nth(1).waitFor({state:'attached'});
|
||||
assert(await m.getByLabel('Província',{exact:true}).locator('option').count()>1);
|
||||
results.push({route:'/oportunidades?dimension=cluster',action:'filtros contextuais e pesquisa provincial',visible:true});
|
||||
await m.goto(base+'/oportunidades?view=map');
|
||||
await m.getByRole('region', {name:'Estruturas territoriais consultáveis'}).waitFor();
|
||||
assert(await m.getByRole('region', {name:'Estruturas territoriais consultáveis'}).getByRole('link').count() > 0);
|
||||
results.push({route:'/oportunidades?view=map',action:'consultar estruturas sem inventar coordenadas',visible:true});
|
||||
assert.deepEqual(errors,[]);
|
||||
const proof={captured_at:new Date().toISOString(),results,errors,active_writes:0,scope:'country profile and catalogue filters only; not full portal acceptance'};
|
||||
fs.writeFileSync('storage/app/private/investmoz-v2/functional-country-browser.json',JSON.stringify(proof,null,2));
|
||||
console.log(JSON.stringify(proof)); await browser.close();
|
||||
})().catch(e=>{console.error(e);process.exit(1)});
|
||||
const mobile = await login(390),
|
||||
m = mobile.page;
|
||||
await m.goto(base + '/investidor/profile');
|
||||
await m.evaluate(() => localStorage.clear());
|
||||
await m.reload();
|
||||
assert.equal(
|
||||
await m.locator('#residence_country_codeaccount').inputValue(),
|
||||
'PT',
|
||||
);
|
||||
const search = m.getByRole('textbox', { name: 'Pesquisar país' }).first();
|
||||
await search.fill('portugal');
|
||||
assert.equal(
|
||||
await m.locator('#residence_country_codeaccount option').count(),
|
||||
2,
|
||||
);
|
||||
assert(
|
||||
await m.evaluate(
|
||||
() => document.documentElement.scrollWidth <= innerWidth + 1,
|
||||
),
|
||||
);
|
||||
await m.screenshot({
|
||||
path: 'storage/app/private/investmoz-v2/functional-country-mobile.png',
|
||||
fullPage: true,
|
||||
});
|
||||
results.push({
|
||||
route: '/investidor/profile',
|
||||
action: 'nova sessão móvel e pesquisa',
|
||||
serverRecovery: true,
|
||||
localStorage: false,
|
||||
});
|
||||
await m.goto(base + '/oportunidades?dimension=cluster');
|
||||
assert.equal(await m.getByText('ZEE', { exact: true }).count(), 0);
|
||||
await m
|
||||
.getByRole('textbox', { name: 'Pesquisar Província' })
|
||||
.fill('Maputo');
|
||||
await m
|
||||
.getByLabel('Província', { exact: true })
|
||||
.locator('option')
|
||||
.nth(1)
|
||||
.waitFor({ state: 'attached' });
|
||||
assert(
|
||||
(await m
|
||||
.getByLabel('Província', { exact: true })
|
||||
.locator('option')
|
||||
.count()) > 1,
|
||||
);
|
||||
results.push({
|
||||
route: '/oportunidades?dimension=cluster',
|
||||
action: 'filtros contextuais e pesquisa provincial',
|
||||
visible: true,
|
||||
});
|
||||
await m.goto(base + '/oportunidades?view=map');
|
||||
await m
|
||||
.getByRole('region', { name: 'Estruturas territoriais consultáveis' })
|
||||
.waitFor();
|
||||
assert(
|
||||
(await m
|
||||
.getByRole('region', {
|
||||
name: 'Estruturas territoriais consultáveis',
|
||||
})
|
||||
.getByRole('link')
|
||||
.count()) > 0,
|
||||
);
|
||||
results.push({
|
||||
route: '/oportunidades?view=map',
|
||||
action: 'consultar estruturas sem inventar coordenadas',
|
||||
visible: true,
|
||||
});
|
||||
assert.deepEqual(errors, []);
|
||||
const proof = {
|
||||
captured_at: new Date().toISOString(),
|
||||
results,
|
||||
errors,
|
||||
active_writes: 0,
|
||||
scope: 'country profile and catalogue filters only; not full portal acceptance',
|
||||
};
|
||||
fs.writeFileSync(
|
||||
'storage/app/private/investmoz-v2/functional-country-browser.json',
|
||||
JSON.stringify(proof, null, 2),
|
||||
);
|
||||
console.log(JSON.stringify(proof));
|
||||
await browser.close();
|
||||
})().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user