Skip to content

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

test(e2e): a scheduled task must run to done on the managed instance, not merely reach a terminal state

Luigi Agosti507ad96f1be7
diff --git a/tests/e2e/scenarios/infra/system-extended.sh b/tests/e2e/scenarios/infra/system-extended.sh
index 660bc82d..2a935a2f 100644
--- a/tests/e2e/scenarios/infra/system-extended.sh
+++ b/tests/e2e/scenarios/infra/system-extended.sh
@@ -469,6 +469,23 @@ fi
end_test
+# ─────────────────────────────────────────────────────────────────
+start_test "a scheduled task runs to done on the managed instance"
+
+pt_post /tasks -d "{\"agentId\":\"${AGENT}-run\",\"action\":\"hover\",\"selector\":\"body\",\"tabId\":\"${TAB_ID}\"}"
+assert_http_status "202" "task accepted"
+RUN_TASK_ID=$(echo "$RESULT" | jq -r '.taskId')
+RUN_STATE=""
+for _ in $(seq 1 100); do
+ pt_get "/tasks/${RUN_TASK_ID}"
+ RUN_STATE=$(echo "$RESULT" | jq -r '.state // empty')
+ case "$RUN_STATE" in queued|assigned|running|"") sleep 0.1 ;; *) break ;; esac
+done
+assert_json_eq "$RESULT" ".state" "done" "the executor reached the instance and the task completed"
+assert_json_eq "$RESULT" ".error // \"\"" "" "no executor error"
+
+end_test
+
# ─────────────────────────────────────────────────────────────────
start_test "GET /tasks — list tasks"