From 0b7ae1ef3ffe4f4559bd0d8b4ec7ec5eb8eda4c3 Mon Sep 17 00:00:00 2001 From: ypshim Date: Wed, 21 Oct 2026 18:11:57 +0900 Subject: [PATCH] test(ui): capture console errors and exceptions during the UI check (V10 3) - verify-ui.cjs collects console error/warning, uncaught exceptions, and log entries over the whole run; prints CONSOLE_EVENTS - run with the user's three-sheet workbook: 0 events Co-Authored-By: Claude Haiku 5.5 --- scripts/verify-ui.cjs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/verify-ui.cjs b/scripts/verify-ui.cjs index 016351e..fe0185a 100644 --- a/scripts/verify-ui.cjs +++ b/scripts/verify-ui.cjs @@ -25,11 +25,21 @@ async function main() { let seq = 0; const waiting = new Map(); + // Console and exception events, collected from the first navigation onward (V10 ③). + const consoleEvents = []; ws.onmessage = (ev) => { const m = JSON.parse(ev.data); if (m.id && waiting.has(m.id)) { waiting.get(m.id)(m); waiting.delete(m.id); + } else if (m.method === 'Runtime.consoleAPICalled' && ['error', 'warning'].includes(m.params.type)) { + const text = m.params.args.map((a) => a.value ?? a.description ?? '').join(' '); + consoleEvents.push(`console.${m.params.type}: ${text}`); + } else if (m.method === 'Runtime.exceptionThrown') { + const d = m.params.exceptionDetails; + consoleEvents.push(`exception: ${d.exception?.description || d.text}`); + } else if (m.method === 'Log.entryAdded' && ['error', 'warning'].includes(m.params.entry.level)) { + consoleEvents.push(`log.${m.params.entry.level}: ${m.params.entry.text} ${m.params.entry.url || ''}`.trim()); } }; const send = (method, params = {}) => @@ -51,6 +61,7 @@ async function main() { await send('Page.enable'); await send('Runtime.enable'); + await send('Log.enable'); await send('DOM.enable'); await send('Emulation.setDeviceMetricsOverride', { width: 1600, height: 1000, deviceScaleFactor: 1, mobile: false }); await send('Page.navigate', { url: APP_URL }); @@ -90,7 +101,9 @@ async function main() { console.log('PRESSED', label, await evalJs(`[...document.querySelectorAll('#views button')].filter((b) => b.getAttribute('aria-pressed') === 'true').map((b) => b.textContent).join(',')`)); } - // V10 ③ — console errors surfaced by the page (checked via a reload with error capture). + // V10 ③ — every console error/warning and uncaught exception seen during the run above. + console.log(`CONSOLE_EVENTS ${consoleEvents.length}`); + for (const e of consoleEvents) console.log(` ${e}`); ws.close(); }