Skip to content

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

test: adding coverate for --not-text

Mario6544f337429a
diff --git a/tests/e2e/scenarios/api/browser-extended.sh b/tests/e2e/scenarios/api/browser-extended.sh
index 2e08b7e5..ef71414c 100644
--- a/tests/e2e/scenarios/api/browser-extended.sh
+++ b/tests/e2e/scenarios/api/browser-extended.sh
@@ -261,6 +261,47 @@ assert_ok "wait for text"
end_test
+# ─────────────────────────────────────────────────────────────────
+start_test "POST /wait: wait for text to disappear (not-text immediate)"
+
+pt_post /navigate "{\"url\":\"${FIXTURES_URL}/buttons.html\"}"
+assert_ok "navigate"
+
+# Text that isn't present — should succeed immediately
+pt_post /wait '{"notText":"nonexistent-text-xyz","timeout":2000}'
+assert_ok "wait for not-text (absent)"
+
+end_test
+
+# ─────────────────────────────────────────────────────────────────
+start_test "POST /wait: wait for text to disappear (after toggle)"
+
+pt_post /navigate "{\"url\":\"${FIXTURES_URL}/buttons.html\"}"
+assert_ok "navigate"
+
+# Click toggle to hide the content (display: none removes from innerText)
+pt_post /action '{"kind":"click","selector":"#toggle-btn"}'
+assert_ok "click toggle button"
+
+# Wait for the toggled text to disappear
+pt_post /wait '{"notText":"This content can be toggled.","timeout":5000}'
+assert_ok "wait for toggled text to disappear"
+
+end_test
+
+# ─────────────────────────────────────────────────────────────────
+start_test "POST /wait: not-text timeout when text persists"
+
+pt_post /navigate "{\"url\":\"${FIXTURES_URL}/buttons.html\"}"
+assert_ok "navigate"
+
+# Text is present and never removed — should time out
+pt_post /wait '{"notText":"Increment","timeout":500}'
+assert_ok "wait returns 200 with timeout error"
+assert_json_eq "$RESULT" '.waited' 'false' "waited=false on timeout"
+
+end_test
+
# ─────────────────────────────────────────────────────────────────
start_test "POST /wait: invalid request (empty body)"
diff --git a/tests/e2e/scenarios/cli/actions-extended.sh b/tests/e2e/scenarios/cli/actions-extended.sh
index 49f1c529..9a5dcfbf 100644
--- a/tests/e2e/scenarios/cli/actions-extended.sh
+++ b/tests/e2e/scenarios/cli/actions-extended.sh
@@ -213,3 +213,34 @@ pt_ok eval "document.querySelector('#username').value"
assert_json_field ".result" "$LONG_TEXT" "long string typed correctly"
end_test
+
+# ─────────────────────────────────────────────────────────────────
+start_test "pinchtab wait --not-text (immediate, absent)"
+
+# Text that never existed — should succeed immediately.
+pt_ok nav "${FIXTURES_URL}/buttons.html"
+pt_ok wait --not-text "nonexistent-text-xyz" --timeout 2000
+assert_output_contains "waited" "wait response present"
+
+end_test
+
+# ─────────────────────────────────────────────────────────────────
+start_test "pinchtab wait --not-text (after DOM change)"
+
+# Toggle click hides #toggle-content (display:none removes innerText).
+pt_ok nav "${FIXTURES_URL}/buttons.html"
+pt_ok click --css "#toggle-btn"
+pt_ok wait --not-text "This content can be toggled." --timeout 5000
+assert_output_contains "waited" "wait returned after text disappeared"
+
+end_test
+
+# ─────────────────────────────────────────────────────────────────
+start_test "pinchtab wait --not-text (timeout when text persists)"
+
+# Text stays on page — command should return (200) with waited=false.
+pt_ok nav "${FIXTURES_URL}/buttons.html"
+pt_ok wait --not-text "Increment" --timeout 500
+assert_output_contains "timeout" "timeout reported when text persists"
+
+end_test