18 lines
924 B
JavaScript
18 lines
924 B
JavaScript
const { chromium } = require('playwright');
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true, args: ['--no-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 => { if (!req.url().includes('favicon')) errors.push('NET: ' + req.url()); });
|
|
await page.goto('http://host.docker.internal:3003', { waitUntil: 'domcontentloaded', timeout: 30000 });
|
|
await page.waitForTimeout(2000);
|
|
for (const t of ['overview','agents','history','recommendations','heatmap','impact']) {
|
|
try { await page.click(`button[onclick="switchTab('${t}')"]`); await page.waitForTimeout(1000); } catch(e) {}
|
|
}
|
|
await page.waitForTimeout(500);
|
|
await browser.close();
|
|
console.log(JSON.stringify(errors));
|
|
})();
|