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

66 lines
2.7 KiB
JavaScript

const { chromium } = require('playwright');
const fs = require('fs');
(async () => {
console.log('V93 starting...');
const browser = await chromium.launch({ headless: true });
const ctx = await browser.newContext({
viewport: { width: 1920, height: 1080 },
recordVideo: { dir: '/tmp/v93b-videos/', size: { width: 1920, height: 1080 } }
});
const page = await ctx.newPage();
await page.addInitScript(() => {
try { localStorage.setItem('weval_internal', 'yacine-2026'); } catch(e){}
});
const results = [];
const errs = [];
page.on('pageerror', e => errs.push(e.message.substring(0,150)));
const urls = [
{ n: 'enterprise-model', u: 'https://weval-consulting.com/enterprise-model.html' },
{ n: 'wevia-em-big4', u: 'https://weval-consulting.com/wevia-em-big4.html' },
{ n: 'business-kpi', u: 'https://weval-consulting.com/business-kpi-dashboard.php' },
{ n: 'wevia-master', u: 'https://weval-consulting.com/wevia-master.html' },
{ n: 'crm', u: 'https://weval-consulting.com/crm.html' },
{ n: 'wtp', u: 'https://weval-consulting.com/weval-technology-platform.html' },
];
for (const target of urls) {
try {
console.log(`${target.n}`);
await page.goto(target.u, { waitUntil: 'load', timeout: 20000 });
await page.waitForTimeout(3000);
const diag = await page.evaluate(() => ({
title: document.title.substring(0, 60),
url: location.href,
body_len: document.body.innerText.length,
canvas: document.querySelectorAll('canvas').length,
svg: document.querySelectorAll('svg').length,
ag_defined: typeof window.AG !== 'undefined',
ag_count: typeof window.AG !== 'undefined' ? window.AG.length : 0,
}));
await page.screenshot({ path: `/tmp/v93b-${target.n}.png`, fullPage: false });
results.push({ name: target.n, status: 'OK', ...diag });
} catch (e) {
results.push({ name: target.n, status: 'FAIL', err: e.message.substring(0, 150) });
}
}
await ctx.close();
await browser.close();
const summary = {
ts: new Date().toISOString(),
test: 'V93b Simple Video Business',
results,
errs,
ok: results.filter(r => r.status === 'OK').length,
fail: results.filter(r => r.status === 'FAIL').length,
};
fs.writeFileSync('/var/www/html/api/playwright-v93b-business.json', JSON.stringify(summary, null, 2));
console.log(`DONE: ${summary.ok}/${results.length} errs=${errs.length}`);
})();