Files
html/api/v93_deep_em_audit.js
2026-04-20 15:30:03 +02:00

108 lines
4.8 KiB
JavaScript

const { chromium } = require('playwright');
const fs = require('fs');
(async () => {
const browser = await chromium.launch({ headless: true });
const ctx = await browser.newContext({
viewport: { width: 1920, height: 1080 },
recordVideo: { dir: '/tmp/v93-videos/' }
});
const page = await ctx.newPage();
await page.addInitScript(() => {
try { localStorage.setItem('weval_internal', 'yacine-2026'); } catch(e){}
});
const errs = [];
page.on('pageerror', e => errs.push(`pageerror: ${e.message.substring(0,150)}`));
page.on('console', m => { if (m.type() === 'error') errs.push(`console: ${m.text().substring(0,150)}`); });
const results = {};
// TEST 1: Enterprise-model - deep audit visuel
await page.goto('https://weval-consulting.com/enterprise-model.html', { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(10000); // Longer wait for full render
const emDiag = await page.evaluate(() => {
const agentsWithName = typeof AG !== 'undefined' ? AG.filter(a => a && a.n && a.n.trim()) : [];
const agentsAnon = typeof AG !== 'undefined' ? AG.filter(a => !a || !a.n || !a.n.trim() || a.n === 'Sync') : [];
const deadAgents = typeof AG !== 'undefined' ? AG.filter(a => a && a.rm === 'dead') : [];
const agentsNoActions = typeof AG !== 'undefined' ? AG.filter(a => a && (!a.act || a.act.length === 0 || (a.act[0]==='Sync' && a.act.length===4))) : [];
const agentsNoSkill = typeof AG !== 'undefined' ? AG.filter(a => a && (!a.d || a.d === 'general' || a.d === 'Paperclip')) : [];
// DP stats
const dps = typeof DP !== 'undefined' ? DP : [];
const emptyDps = dps.filter(d => typeof AG !== 'undefined' ? AG.filter(a => a.rm === d.id).length === 0 : true);
return {
AG_total: typeof AG !== 'undefined' ? AG.length : 0,
AG_with_name: agentsWithName.length,
AG_anonymous: agentsAnon.length,
AG_dead: deadAgents.length,
AG_no_real_actions: agentsNoActions.length,
AG_no_skill: agentsNoSkill.length,
DP_total: dps.length,
DP_empty: emptyDps.length,
DP_empty_names: emptyDps.map(d => d.id).slice(0, 5),
sample_dead: deadAgents.slice(0, 5).map(a => ({ n: a.n, rm: a.rm, d: a.d }))
};
});
results.enterprise_model = { diag: emDiag, js_errors: [...errs] };
errs.length = 0;
// TEST 2: wevia-em-big4
await page.goto('https://weval-consulting.com/wevia-em-big4.html', { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(5000);
const big4Diag = await page.evaluate(() => {
return {
url: location.href,
title: document.title,
body_len: document.body.innerText.length,
has_auth: location.href.includes('login'),
};
});
results.em_big4 = { diag: big4Diag, js_errors: [...errs] };
errs.length = 0;
// TEST 3: agents-archi
await page.goto('https://weval-consulting.com/agents-archi.html', { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(5000);
const archDiag = await page.evaluate(() => {
const canvases = document.querySelectorAll('canvas');
const nodes = document.querySelectorAll('.node, [class*="agent-node"], .agent-dot, circle');
return {
url: location.href,
title: document.title,
body_len: document.body.innerText.length,
canvas_count: canvases.length,
nodes_visible: nodes.length,
has_auth: location.href.includes('login'),
};
});
await page.screenshot({ path: '/tmp/v93-agents-archi.png', fullPage: true });
results.agents_archi = { diag: archDiag, js_errors: [...errs] };
errs.length = 0;
// TEST 4: value-streaming
await page.goto('https://weval-consulting.com/value-streaming.html', { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(5000);
const vsDiag = await page.evaluate(() => {
const canvases = document.querySelectorAll('canvas');
const svgs = document.querySelectorAll('svg');
return {
url: location.href,
title: document.title,
body_len: document.body.innerText.length,
canvas_count: canvases.length,
svg_count: svgs.length,
has_auth: location.href.includes('login'),
};
});
await page.screenshot({ path: '/tmp/v93-value-streaming.png', fullPage: true });
results.value_streaming = { diag: vsDiag, js_errors: [...errs] };
await ctx.close();
await browser.close();
fs.writeFileSync('/var/www/html/api/playwright-v93-deep-audit.json', JSON.stringify(results, null, 2));
console.log(JSON.stringify(results, null, 2));
})();