Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: handoff POST returns expiresAt, fix e2e test navigation and endpoint

Luigi Agostifb09e00541b0
diff --git a/internal/handlers/handoff.go b/internal/handlers/handoff.go
index fb5c8ef4..0033a9bf 100644
--- a/internal/handlers/handoff.go
+++ b/internal/handlers/handoff.go
@@ -90,12 +90,16 @@ func (h *Handlers) HandleTabHandoff(w http.ResponseWriter, r *http.Request) {
})
}
- httpx.JSON(w, 200, map[string]any{
+ resp := map[string]any{
"tabId": resolvedTabID,
"status": "paused_handoff",
"reason": reason,
"timeoutMs": req.TimeoutMs,
- })
+ }
+ if timeout > 0 {
+ resp["expiresAt"] = time.Now().UTC().Add(timeout).Format(time.RFC3339)
+ }
+ httpx.JSON(w, 200, resp)
}
func (h *Handlers) HandleTabResume(w http.ResponseWriter, r *http.Request) {
diff --git a/tests/e2e/scenarios/api/tabs-extended.sh b/tests/e2e/scenarios/api/tabs-extended.sh
index 8432db30..f72fd5c7 100644
--- a/tests/e2e/scenarios/api/tabs-extended.sh
+++ b/tests/e2e/scenarios/api/tabs-extended.sh
@@ -354,6 +354,9 @@ end_test
# ─────────────────────────────────────────────────────────────────
start_test "handoff: actions work after resume"
+pt_post "/tabs/${BLOCK_TAB}/navigate" -d "{\"url\":\"${FIXTURES_URL}/buttons.html\"}"
+assert_ok "navigate to buttons page"
+
pt_post /action -d "{\"kind\":\"click\",\"selector\":\"#btn-1\",\"tabId\":\"${BLOCK_TAB}\"}"
assert_ok "action succeeds after resume"
@@ -369,7 +372,7 @@ show_tab "created" "$BATCH_TAB"
pt_post "/tabs/${BATCH_TAB}/handoff" -d '{"reason":"captcha"}'
assert_ok "pause tab"
-pt_post /actions/batch -d "{\"tabId\":\"${BATCH_TAB}\",\"actions\":[{\"kind\":\"click\",\"selector\":\"#btn-1\"}]}"
+pt_post /actions -d "{\"tabId\":\"${BATCH_TAB}\",\"actions\":[{\"kind\":\"click\",\"selector\":\"#btn-1\"}]}"
assert_http_status 409 "batch action blocked during handoff"
pt_post "/tabs/${BATCH_TAB}/resume" -d '{}'
@@ -398,6 +401,9 @@ pt_get "/tabs/${TIMEOUT_TAB}/handoff"
assert_ok "check status after timeout"
assert_json_eq "$RESULT" '.status' 'active' "auto-expired to active"
+pt_post "/tabs/${TIMEOUT_TAB}/navigate" -d "{\"url\":\"${FIXTURES_URL}/buttons.html\"}"
+assert_ok "navigate to buttons page"
+
pt_post /action -d "{\"kind\":\"click\",\"selector\":\"#btn-1\",\"tabId\":\"${TIMEOUT_TAB}\"}"
assert_ok "action succeeds after timeout expiry"