72 lines
2.8 KiB
JavaScript
72 lines
2.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/v92-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(e.message));
|
|
page.on('console', m => { if (m.type() === 'error') errs.push(`console: ${m.text().substring(0,150)}`); });
|
|
|
|
// Test enterprise-model POST V91 fix
|
|
await page.goto('https://weval-consulting.com/enterprise-model.html', { waitUntil: 'load', timeout: 30000 });
|
|
await page.waitForTimeout(8000); // Wait for canvas animation to fully initialize
|
|
|
|
const diag = await page.evaluate(() => {
|
|
// Check actual canvas content & AG/DP runtime state
|
|
const canvas = document.querySelector('canvas');
|
|
let canvasInfo = null;
|
|
if (canvas) {
|
|
canvasInfo = {
|
|
width: canvas.width,
|
|
height: canvas.height,
|
|
hasContext: !!canvas.getContext('2d'),
|
|
// Check if canvas has drawn pixels (not all transparent)
|
|
hasPixels: (() => {
|
|
try {
|
|
const ctx = canvas.getContext('2d');
|
|
const data = ctx.getImageData(0, 0, Math.min(canvas.width, 100), Math.min(canvas.height, 100)).data;
|
|
let nonTransparent = 0;
|
|
for (let i = 3; i < data.length; i += 4) {
|
|
if (data[i] > 0) nonTransparent++;
|
|
}
|
|
return nonTransparent;
|
|
} catch(e) { return 'err:' + e.message; }
|
|
})()
|
|
};
|
|
}
|
|
|
|
// Access global AG + DP
|
|
const agState = {
|
|
AG_exists: typeof AG !== 'undefined',
|
|
AG_length: typeof AG !== 'undefined' ? AG.length : 0,
|
|
DP_exists: typeof DP !== 'undefined',
|
|
DP_length: typeof DP !== 'undefined' ? DP.length : 0,
|
|
};
|
|
|
|
return { canvasInfo, agState };
|
|
});
|
|
|
|
await page.screenshot({ path: '/tmp/v92-enterprise-model-full.png', fullPage: true });
|
|
|
|
await ctx.close();
|
|
await browser.close();
|
|
|
|
const result = {
|
|
ts: new Date().toISOString(),
|
|
test: 'V92 Canvas + AG/DP runtime validation',
|
|
diag,
|
|
js_errors: errs.slice(0, 5),
|
|
};
|
|
fs.writeFileSync('/var/www/html/api/playwright-v92-canvas-check.json', JSON.stringify(result, null, 2));
|
|
console.log(JSON.stringify(result, null, 2));
|
|
})();
|