From fd4e03dc9f037cfa90fbf650ec4205bfacf6b9c6 Mon Sep 17 00:00:00 2001 From: ldm0 Date: Sun, 4 Oct 2026 09:32:39 +0800 Subject: [PATCH] test(webdriver): wait for form navigation with BiDi attached --- .../protocol_server/tests/bidi/extracted/script_runtime.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/moli-protocol-server/src/protocol_server/tests/bidi/extracted/script_runtime.rs b/moli-protocol-server/src/protocol_server/tests/bidi/extracted/script_runtime.rs index bd9e6fb2f8..857f01dfae 100644 --- a/moli-protocol-server/src/protocol_server/tests/bidi/extracted/script_runtime.rs +++ b/moli-protocol-server/src/protocol_server/tests/bidi/extracted/script_runtime.rs @@ -108,7 +108,10 @@ async fn websocket_bidi_attached_classic_session_title_waits_for_script_triggere "POST", &format!("/session/{session_id}/execute/sync"), json!({ - "script": "document.querySelector('form').submit(); return 'submitted';", + // Form submission plans a later DOM task. Wait for navigation to + // start so the title command tests an in-flight load while BiDi + // is attached, rather than racing the planned submission task. + "script": "return new Promise(resolve => { navigation.addEventListener('navigate', () => resolve('submitted'), { once: true }); document.querySelector('form').submit(); });", "args": [] }), )