-
-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy pathcheck_runtime.mjs
More file actions
80 lines (68 loc) · 1.99 KB
/
check_runtime.mjs
File metadata and controls
80 lines (68 loc) · 1.99 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
75
76
77
78
79
80
import { chromium } from 'playwright';
async function main() {
// Start Xvfb
console.log('Starting application...');
const browser = await chromium.launch({
executablePath: '/home/runner/work/MQTT-Explorer/MQTT-Explorer/node_modules/electron/dist/electron',
args: ['.', '--enable-mcp-introspection', '--no-sandbox'],
env: { ...process.env, DISPLAY: ':99' }
});
const context = browser.contexts()[0];
const page = context.pages()[0] || await context.newPage();
// Collect console messages
const messages = [];
page.on('console', msg => {
messages.push({
type: msg.type(),
text: msg.text(),
location: msg.location()
});
});
// Collect page errors
const errors = [];
page.on('pageerror', error => {
errors.push({
message: error.message,
stack: error.stack
});
});
// Wait for the page to load
await page.waitForTimeout(8000);
console.log('\n=== CONSOLE MESSAGES ===');
const errorMessages = messages.filter(m => m.type === 'error');
const warningMessages = messages.filter(m => m.type === 'warning');
if (errorMessages.length > 0) {
console.log('\nERRORS:');
errorMessages.forEach(msg => {
console.log(` [${msg.type}] ${msg.text}`);
if (msg.location) {
console.log(` at ${msg.location.url}:${msg.location.lineNumber}`);
}
});
} else {
console.log('No console errors!');
}
if (warningMessages.length > 0) {
console.log('\nWARNINGS:');
warningMessages.forEach(msg => {
console.log(` [${msg.type}] ${msg.text}`);
});
}
console.log('\n=== PAGE ERRORS ===');
if (errors.length === 0) {
console.log('No page errors found! ✅');
} else {
errors.forEach(err => {
console.log(`ERROR: ${err.message}`);
if (err.stack) {
console.log(err.stack);
}
});
}
await browser.close();
process.exit(errors.length > 0 ? 1 : 0);
}
main().catch(err => {
console.error('Test failed:', err);
process.exit(1);
});