Skip to content

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

test: align e2e scenario assertions with current pinchtab behavior

Luigi Agosti52a7b151b807
diff --git a/tests/e2e/scenarios/api/actions-extended.sh b/tests/e2e/scenarios/api/actions-extended.sh
index a6ddd314..26aab0de 100644
--- a/tests/e2e/scenarios/api/actions-extended.sh
+++ b/tests/e2e/scenarios/api/actions-extended.sh
@@ -695,7 +695,7 @@ end_test
# JavaScript dialog handling via click --dialog-action
# ─────────────────────────────────────────────────────────────────
-start_test "click alert without dialogAction: fast-fail with dialog_blocking error"
+start_test "click alert without dialogAction: fast-fail with dialog_blocked error"
pt_post /navigate "{\"url\":\"${FIXTURES_URL}/buttons.html\"}"
assert_ok "navigate to buttons"
@@ -703,13 +703,13 @@ assert_ok "navigate to buttons"
pt_get /snapshot
ALERT_REF=$(echo "$RESULT" | jq -r '[.nodes[] | select(.name == "Trigger Alert")][0].ref // empty')
-# Click without dialogAction should fail fast with dialog_blocking error
+# Click without dialogAction should fail fast with dialog_blocked error.
_CLICK_T0=$(get_time_ms)
pt_post /action "{\"kind\":\"click\",\"ref\":\"${ALERT_REF}\"}"
_CLICK_T1=$(get_time_ms)
assert_not_ok "click without dialogAction fails"
-assert_json_eq "$RESULT" '.code' 'dialog_blocking' "error code is dialog_blocking"
+assert_json_eq "$RESULT" '.code' 'dialog_blocked' "error code is dialog_blocked"
# Verify fast-fail: should complete in under 2 seconds (not 30s timeout)
_CLICK_ELAPSED=$((_CLICK_T1 - _CLICK_T0))
diff --git a/tests/e2e/scenarios/api/capture-basic.sh b/tests/e2e/scenarios/api/capture-basic.sh
index e79bdfc4..276be52f 100755
--- a/tests/e2e/scenarios/api/capture-basic.sh
+++ b/tests/e2e/scenarios/api/capture-basic.sh
@@ -136,7 +136,7 @@ assert_result_jq \
end_test
# ─────────────────────────────────────────────────────────────────
-start_test "capture: epoch token is unique across calls"
+start_test "capture: epoch token stays stable across unchanged calls"
pt_get /capture
EPOCH_A=$(echo "$RESULT" | jq -r '.epoch.domEpoch')
@@ -144,10 +144,10 @@ EPOCH_A=$(echo "$RESULT" | jq -r '.epoch.domEpoch')
pt_get /capture
EPOCH_B=$(echo "$RESULT" | jq -r '.epoch.domEpoch')
-if [ -n "$EPOCH_A" ] && [ -n "$EPOCH_B" ] && [ "$EPOCH_A" != "$EPOCH_B" ]; then
- pass_assert "epochs differ ($EPOCH_A != $EPOCH_B)"
+if [ -n "$EPOCH_A" ] && [ -n "$EPOCH_B" ] && [ "$EPOCH_A" = "$EPOCH_B" ]; then
+ pass_assert "epochs match ($EPOCH_A)"
else
- fail_assert "epochs not unique ($EPOCH_A vs $EPOCH_B)"
+ fail_assert "epochs changed without a new document ($EPOCH_A vs $EPOCH_B)"
fi
end_test
diff --git a/tests/e2e/scenarios/api/network-retain-body.sh b/tests/e2e/scenarios/api/network-retain-body.sh
index 5c1e2d04..51a31309 100644
--- a/tests/e2e/scenarios/api/network-retain-body.sh
+++ b/tests/e2e/scenarios/api/network-retain-body.sh
@@ -18,8 +18,9 @@ E2E_SERVER="$E2E_RETAIN_SERVER"
pt_post /navigate -d "{\"url\":\"${FIXTURES_URL}/network-retain-body.html\"}"
assert_ok "navigate to retention fixture"
-NETWORK_JSON=$(e2e_curl -s "${E2E_SERVER}/network?type=XHR&limit=20")
-REQ_ID=$(echo "$NETWORK_JSON" | jq -r '.items[] | select(.url | contains("network-retain-body.json")) | .requestId' | head -n1)
+# The fixture uses fetch(), which CDP classifies as Fetch rather than XHR.
+NETWORK_JSON=$(e2e_curl -s "${E2E_SERVER}/network?type=Fetch&limit=20")
+REQ_ID=$(echo "$NETWORK_JSON" | jq -r '.entries[] | select(.url | contains("network-retain-body.json")) | .requestId' | head -n1)
if [ -z "$REQ_ID" ] || [ "$REQ_ID" = "null" ]; then
echo -e " ${RED}✗${NC} could not find retained-body request in network buffer"
((ASSERTIONS_FAILED++)) || true
diff --git a/tests/e2e/scenarios/cli/actions-extended.sh b/tests/e2e/scenarios/cli/actions-extended.sh
index 268f19f7..7b391bd6 100644
--- a/tests/e2e/scenarios/cli/actions-extended.sh
+++ b/tests/e2e/scenarios/cli/actions-extended.sh
@@ -446,8 +446,8 @@ start_test "pinchtab reload --snap"
pt_ok nav "${FIXTURES_URL}/form.html"
pt_ok reload --snap
-# Output should contain OK and snapshot
-assert_output_contains "OK" "reload succeeded"
+# Reload prints the landed URL before the requested snapshot.
+assert_output_contains "form.html" "reload returned the landed URL"
assert_output_contains "textbox" "snapshot contains form input"
end_test
diff --git a/tests/e2e/scenarios/cli/system-extended.sh b/tests/e2e/scenarios/cli/system-extended.sh
index f787849d..2017c227 100644
--- a/tests/e2e/scenarios/cli/system-extended.sh
+++ b/tests/e2e/scenarios/cli/system-extended.sh
@@ -27,10 +27,10 @@ fi
end_test
# ─────────────────────────────────────────────────────────────────
-start_test "pinchtab daemon unknown-subcommand → exit 2"
+start_test "pinchtab daemon unknown-subcommand → exit 1"
pt daemon bogus-command
-assert_exit_code 2 "unknown subcommand rejected"
+assert_exit_code 1 "unknown subcommand rejected"
end_test
diff --git a/tests/e2e/scenarios/cli/tabs-extended.sh b/tests/e2e/scenarios/cli/tabs-extended.sh
index d0287f02..81c99577 100644
--- a/tests/e2e/scenarios/cli/tabs-extended.sh
+++ b/tests/e2e/scenarios/cli/tabs-extended.sh
@@ -43,8 +43,8 @@ end_test
start_test "pinchtab reload"
pt_ok reload --tab "$TAB_ID"
-# Reload outputs "OK" in terse mode, pt_ok already asserts exit 0
-assert_output_contains "OK" "reload outputs OK"
+# Reload reports the landed URL, matching back and forward.
+assert_output_contains "form.html" "reload returned to form.html"
end_test