-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-console.mjs
More file actions
74 lines (63 loc) · 1.95 KB
/
Copy pathcheck-console.mjs
File metadata and controls
74 lines (63 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { chromium } from 'playwright';
const browser = await chromium.launch({
args: [
'--use-gl=angle',
'--use-angle=swiftshader',
'--enable-webgl',
'--enable-webgl2',
'--no-sandbox',
'--ignore-gpu-blocklist',
'--enable-features=Vulkan',
]
});
const page = await browser.newPage();
const errors = [];
const warnings = [];
const logs = [];
const networkErrors = [];
page.on('console', msg => {
const type = msg.type();
const text = msg.text();
if (type === 'error') errors.push(text);
else if (type === 'warning') warnings.push(text);
else logs.push(text.substring(0, 300));
});
page.on('pageerror', err => {
errors.push('PAGE ERROR: ' + err.message);
});
page.on('response', resp => {
if (resp.status() >= 400) {
networkErrors.push(resp.status() + ' ' + resp.url());
}
});
try {
await page.goto('http://localhost:5001/', { waitUntil: 'networkidle', timeout: 30000 });
} catch (e) {
console.log('Navigation issue:', e.message);
}
// Wait for graph to fully initialize
await page.waitForTimeout(6000);
// Also check for failed network requests
const failedRequests = [];
page.on('requestfailed', req => {
failedRequests.push(req.url() + ' - ' + (req.failure()?.errorText || 'unknown'));
});
console.log('=== ERRORS (' + errors.length + ') ===');
errors.forEach((e, i) => console.log((i + 1) + '. ' + e));
console.log('');
console.log('=== WARNINGS (' + warnings.length + ') ===');
warnings.forEach((w, i) => console.log((i + 1) + '. ' + w));
console.log('');
console.log('=== INFO LOGS (first 30) ===');
logs.slice(0, 30).forEach((l, i) => console.log((i + 1) + '. ' + l));
if (failedRequests.length) {
console.log('');
console.log('=== FAILED REQUESTS ===');
failedRequests.forEach((r, i) => console.log((i + 1) + '. ' + r));
}
if (networkErrors.length) {
console.log('');
console.log('=== HTTP ERRORS (status >= 400) ===');
networkErrors.forEach((r, i) => console.log((i + 1) + '. ' + r));
}
await browser.close();