33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
const { chromium } = require('playwright');
|
|
const TARGET_URL = process.env.TARGET_URL || 'http://localhost:3003';
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] });
|
|
const page = await browser.newPage();
|
|
const errors = [];
|
|
page.on('console', msg => { if (msg.type() === 'error') errors.push(msg.text()); });
|
|
page.on('pageerror', err => { errors.push('PAGE: ' + err.message); });
|
|
page.on('requestfailed', req => { errors.push('NET: ' + req.url()); });
|
|
|
|
await page.goto(TARGET_URL, { waitUntil: 'domcontentloaded', timeout: 30000 });
|
|
await page.waitForTimeout(2000);
|
|
|
|
for (const tab of ['overview','agents','history','recommendations','heatmap','impact']) {
|
|
try {
|
|
await page.click(`button[onclick="switchTab('${tab}')"]`);
|
|
await page.waitForTimeout(1000);
|
|
} catch(e) {}
|
|
}
|
|
await page.waitForTimeout(500);
|
|
await browser.close();
|
|
|
|
console.log('TOTAL ERRORS:', errors.length);
|
|
if (errors.length > 0) {
|
|
errors.forEach((e, i) => console.log(i + ':', e.slice(0, 120)));
|
|
} else {
|
|
console.log('Console error monitor — Dashboard');
|
|
console.log('Console errors: 0');
|
|
console.log('Network errors: 0');
|
|
}
|
|
})();
|