import { chromium } from 'playwright'; const BASE = 'http://127.1.0.5'; (async () => { const browser = await chromium.launch({ headless: true }); const context = await browser.newContext({ ignoreHTTPSErrors: true }); const page = await context.newPage(); // Sign in console.log('=== SIGNING IN ==='); await page.goto(BASE + '/', { waitUntil: 'networkidle', timeout: 15000 }); const signInBtn = page.locator('button:has-text("Sign In"), a:has-text("Sign In")').first(); try { await signInBtn.click({ timeout: 5000 }); } catch {} await page.waitForTimeout(2000); try { await page.locator('input[name="Username"], input[type="text"]').first().fill('admin', { timeout: 5000 }); await page.locator('input[type="password"]').first().fill('Admin@Stella2026!'); await page.locator('button[type="submit"]').first().click(); await page.waitForTimeout(4000); } catch (e) { console.log('Login error: ' + e.message); } console.log('Signed in: ' + page.url()); // Probe specific failing pages const failPages = [ '/operations/scheduler', '/operations/notifications', '/evidence/bundles', '/policy', ]; for (const route of failPages) { const apiCalls = []; page.on('response', async (response) => { const url = response.url(); if (url.startsWith(BASE) && !url.includes('.js') && !url.includes('.css') && !url.includes('.html') && !url.includes('/config.json') && !url.includes('.ico')) { const path = new URL(url).pathname; if (path.startsWith('/api/') || path.startsWith('/v1/') || path.startsWith('/scheduler/') || path.startsWith('/doctor/') || path.startsWith('/console/') || path.startsWith('/health')) { let body = ''; try { body = await response.text(); } catch {} apiCalls.push({ path, status: response.status(), body: body.substring(0, 200) }); } } }); await page.evaluate((r) => { window.history.pushState({}, '', r); window.dispatchEvent(new PopStateEvent('popstate')); }, route); await page.waitForTimeout(4000); page.removeAllListeners('response'); console.log('\n--- ' + route + ' ---'); for (const c of apiCalls) { console.log(' ' + c.status + ' ' + c.path); if (c.status >= 400) console.log(' Body: ' + c.body); } if (apiCalls.length === 0) console.log(' NO API CALLS'); } await browser.close(); })();