110 lines
5.5 KiB
JavaScript
Executable File
110 lines
5.5 KiB
JavaScript
Executable File
|
|
const { chromium } = require('playwright');
|
|
const fs = require('fs');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({headless:true, args:['--no-sandbox','--disable-dev-shm-usage','--use-gl=swiftshader']});
|
|
const ctxOpts = {viewport:{width:1440,height:900}};
|
|
if (fs.existsSync('/opt/weval-l99/sso-state.json')) ctxOpts.storageState = '/opt/weval-l99/sso-state.json';
|
|
const ctx = await browser.newContext(ctxOpts);
|
|
const page = await ctx.newPage();
|
|
|
|
const log = [];
|
|
function step(name, ok, details) {
|
|
log.push({name, ok, details, ts: Date.now()});
|
|
console.log(`${ok?'✅':'❌'} ${name}: ${details||''}`);
|
|
}
|
|
|
|
// SCENARIO 1: Yacine ouvre WTP (point d'entrée ERP)
|
|
await page.goto('https://weval-consulting.com/weval-technology-platform.html', {waitUntil:'domcontentloaded', timeout:30000});
|
|
await page.waitForTimeout(4000);
|
|
const wtpTitle = await page.title();
|
|
step('1.WTP_loads', wtpTitle.includes('Technology Platform') || wtpTitle.includes('ERP'), `title="${wtpTitle.substring(0,60)}"`);
|
|
|
|
// 1.b: Banner Mega Master visible
|
|
const banner = await page.$('#wtp-mega-master-banner');
|
|
step('1b.WTP_mega_banner', !!banner, banner ? 'found' : 'NOT FOUND');
|
|
|
|
// 1.c: KPI widget visible
|
|
const kpiWidget = await page.$('#wtp-pilotage-kpi-live');
|
|
step('1c.WTP_kpi_widget', !!kpiWidget, kpiWidget ? 'found' : 'NOT FOUND');
|
|
|
|
// 1.d: Compte les KPI cards live data
|
|
const kpiVals = await page.$$eval('.kpi .n, .k .n, [class*="kpi"] [class*="value"], [class*="metric"]', els => els.map(e => e.textContent.trim()).filter(t => t && t.length < 20).slice(0,15));
|
|
step('1d.WTP_kpi_values', kpiVals.length > 5, `${kpiVals.length} values: ${JSON.stringify(kpiVals.slice(0,8))}`);
|
|
|
|
// SCENARIO 2: Click sur Mega Master link depuis banner
|
|
try {
|
|
await page.click('a[href*="weval-mega-master"]', {timeout:5000});
|
|
await page.waitForLoadState('domcontentloaded', {timeout:15000});
|
|
await page.waitForTimeout(2000);
|
|
const url = page.url();
|
|
step('2.Click_to_Mega', url.includes('mega-master'), `URL: ${url.substring(0,60)}`);
|
|
} catch(e) { step('2.Click_to_Mega', false, e.message.substring(0,80)); }
|
|
|
|
// SCENARIO 3: Search dans Mega Master pour "ethica"
|
|
try {
|
|
await page.fill('#q', 'ethica');
|
|
await page.waitForTimeout(800);
|
|
const visible = await page.$$eval('.lnk', els => els.filter(e => e.offsetParent !== null).length);
|
|
step('3.Mega_search_ethica', visible > 0 && visible < 100, `${visible} ethica results visible`);
|
|
} catch(e) { step('3.Mega_search_ethica', false, e.message.substring(0,80)); }
|
|
|
|
// SCENARIO 4: Naviguer Arsenal Master
|
|
await page.goto('https://weval-consulting.com/arsenal-master.html', {waitUntil:'domcontentloaded', timeout:20000});
|
|
await page.waitForTimeout(2000);
|
|
const arsenalLinks = await page.$$eval('a.lnk', a => a.length);
|
|
step('4.Arsenal_Master_links', arsenalLinks >= 180, `${arsenalLinks} arsenal links`);
|
|
|
|
// 4.b: 3 ext services présents
|
|
const extServices = await page.$$eval('.ext a', a => a.map(x => x.textContent.trim().substring(0,40)));
|
|
step('4b.Arsenal_ext_services', extServices.length === 3, `${extServices.length} ext: ${JSON.stringify(extServices)}`);
|
|
|
|
// SCENARIO 5: Cliquer sur YouTube Honest depuis Arsenal Master
|
|
try {
|
|
await page.click('a[href*="youtube-factory"]', {timeout:5000});
|
|
await page.waitForLoadState('domcontentloaded', {timeout:15000});
|
|
await page.waitForTimeout(1500);
|
|
const t = await page.title();
|
|
const has0Channels = (await page.content()).includes('>0<');
|
|
const noFakes = !(await page.content()).includes('58,800');
|
|
step('5.YouTube_honest', t.includes('Honest') && noFakes, `title="${t}" has_0=${has0Channels} no_fakes=${noFakes}`);
|
|
} catch(e) { step('5.YouTube_honest', false, e.message.substring(0,80)); }
|
|
|
|
// SCENARIO 6: Arsenal History page
|
|
await page.goto('https://weval-consulting.com/arsenal-history/', {waitUntil:'domcontentloaded', timeout:15000});
|
|
await page.waitForTimeout(1500);
|
|
const histCards = await page.$$eval('.card', c => c.length);
|
|
step('6.History_6_cards', histCards === 6, `${histCards} versions cards`);
|
|
|
|
// SCENARIO 7: Test WEVIA Master chat
|
|
await page.goto('https://weval-consulting.com/wevia-master.html', {waitUntil:'domcontentloaded', timeout:20000});
|
|
await page.waitForTimeout(3000);
|
|
const wmTitle = await page.title();
|
|
const wmInput = await page.$('input[type="text"], textarea');
|
|
const wmButtons = await page.$$('button');
|
|
step('7.WEVIA_Master_loads', wmTitle.includes('WEVIA') && wmInput && wmButtons.length > 5,
|
|
`title="${wmTitle}" input=${!!wmInput} buttons=${wmButtons.length}`);
|
|
|
|
// SCENARIO 8: All-IA Hub
|
|
await page.goto('https://weval-consulting.com/all-ia-hub.html', {waitUntil:'domcontentloaded', timeout:15000});
|
|
await page.waitForTimeout(2500);
|
|
const aiButtons = await page.$$eval('button', b => b.length);
|
|
step('8.All_IA_Hub_buttons', aiButtons >= 30, `${aiButtons} IA buttons`);
|
|
|
|
// SCREENSHOT FINAL — chaque étape capture
|
|
await page.goto('https://weval-consulting.com/weval-technology-platform.html', {waitUntil:'domcontentloaded'});
|
|
await page.waitForTimeout(3000);
|
|
await page.screenshot({path:'/tmp/scenario_final_wtp.png', fullPage:false}).catch(()=>{});
|
|
|
|
// RAPPORT
|
|
const passed = log.filter(l => l.ok).length;
|
|
const total = log.length;
|
|
console.log(`\n=== SCENARIO BUSINESS ===`);
|
|
console.log(`Passed: ${passed}/${total} = ${Math.round(100*passed/total)}%`);
|
|
|
|
fs.writeFileSync('/tmp/scenario_results.json', JSON.stringify({passed, total, log, ts: new Date().toISOString()}, null, 2));
|
|
|
|
await browser.close();
|
|
})();
|