Files
git.stella-ops.org/src/Web/StellaOps.Web/tmp-debug-errors.js
2026-02-18 15:01:04 +02:00

59 lines
2.1 KiB
JavaScript

const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: true, args: ['--disable-dev-shm-usage'] });
const context = await browser.newContext({ ignoreHTTPSErrors: true });
const page = await context.newPage();
const events = [];
const push = (kind, payload) => events.push({ ts: new Date().toISOString(), kind, ...payload, page: page.url() });
page.on('console', msg => {
if (msg.type() === 'error') {
push('console_error', { text: msg.text() });
}
});
page.on('requestfailed', request => {
const url = request.url();
if (/\.(css|js|map|png|jpg|jpeg|svg|woff2?)($|\?)/i.test(url)) return;
push('request_failed', {
method: request.method(),
url,
error: request.failure()?.errorText ?? 'unknown'
});
});
page.on('response', response => {
const url = response.url();
if (/\.(css|js|map|png|jpg|jpeg|svg|woff2?)($|\?)/i.test(url)) return;
if (response.status() >= 400) {
push('response_error', { status: response.status(), method: response.request().method(), url });
}
});
await page.goto('https://stella-ops.local/welcome', { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(1200);
const cta = page.locator('button.cta').first();
if (await cta.count()) {
await cta.click({ force: true, noWaitAfter: true });
await page.waitForTimeout(1000);
}
if (page.url().includes('/connect/authorize')) {
await page.locator('input[name="username"]').first().fill('admin');
await page.locator('input[name="password"]').first().fill('Admin@Stella2026!');
await page.locator('button[type="submit"], button:has-text("Sign In")').first().click();
await page.waitForURL(url => !url.toString().includes('/connect/authorize'), { timeout: 20000 });
await page.waitForTimeout(1200);
}
for (const path of ['/evidence/proof-chains', '/policy/packs']) {
await page.goto(`https://stella-ops.local${path}`, { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(6000);
}
console.log(JSON.stringify(events, null, 2));
await browser.close();
})();