← Commit history

battery: re-anchor dialog test on the harness; detect relay-drop in the CLI error path (was grading fake FAILs)

John Lauer ·05e0331ae7 ·2mo ago ·parent 554fdbd
1 file changed +9
tools/verb-battery.mjs+9
@@ -38,6 +38,9 @@ function call(verb, args = {}, timeoutMs = 90000) {     return d;   } catch (e) {     const out = String(e.stdout || '');+    // The relay-gone response exits NON-ZERO, so it lands HERE - and this branch didn't run the+    // TARGET_LOST check, so a mid-run relay drop graded 15 fake FAILs instead of aborting (2026-08-22).+    if (/No connected Adom Bridge matches|target_not_found/i.test(out + String(e.message))) TARGET_LOST = `target '${TARGET}' left the relay mid-run`;     try { const d = JSON.parse(out); if (typeof d.output === 'string') { try { return { ...d, ...JSON.parse(d.output) }; } catch {} } return d; } catch {}     return { _err: String(e.message).slice(0, 200), _raw: out.slice(0, 300) };   }@@ -166,6 +169,12 @@ const T = {     // PRE-ANSWER contract (Chrome cancels dialogs itself while a debugger is attached, so "hold it     // open and answer later" is impossible - measured 2026-08-22): arm accept:true BEFORE the click,     // the page answers the confirm with true the moment it fires, disarm returns what was seen.+    // Re-anchor on the harness FIRST: the preceding spawn test can leave the session's active-tab+    // tracking on the spawned page, and the arm/click/eval would then hit a page with no #confirm-btn+    // (this was every earlier failure of this test). The pre-answer does not survive navigation, so+    // navigate BEFORE arming.+    call('nbrowser_navigate', { sessionId: SID, url: `${HARNESS}?dlg=${CB}` });+    call('nbrowser_wait_for', { sessionId: SID, selector: '#confirm-btn' });     const arm = call('nbrowser_handle_dialog', { sessionId: SID, policy: 'manual', accept: true });     call('nbrowser_click', { sessionId: SID, selector: '#confirm-btn', retry: false });     settle(400);