Skip to content

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

fix: align network/clear e2e tests with the intentional intercept capability gate

Luigi Agosti8d20323f0eed
diff --git a/tests/e2e/config/pinchtab.json b/tests/e2e/config/pinchtab.json
index f786fea3..c4d8a846 100644
--- a/tests/e2e/config/pinchtab.json
+++ b/tests/e2e/config/pinchtab.json
@@ -44,7 +44,6 @@
"allowUpload": true,
"allowClipboard": true,
"allowStateExport": true,
- "allowNetworkIntercept": true,
"allowedDomains": [
"localhost",
"127.0.0.1",
diff --git a/tests/e2e/scenarios/api/browser-extended.sh b/tests/e2e/scenarios/api/browser-extended.sh
index 9672adef..b5a01924 100644
--- a/tests/e2e/scenarios/api/browser-extended.sh
+++ b/tests/e2e/scenarios/api/browser-extended.sh
@@ -435,16 +435,13 @@ assert_not_ok "rejects non-existent tab"
end_test
# ─────────────────────────────────────────────────────────────────
-start_test "POST /network/clear: clear network data"
+# /network/clear is gated behind security.allowNetworkIntercept, which this
+# server leaves off by default — see network-route-extended.sh for the
+# happy-path assertion against the full-permissive server.
+start_test "POST /network/clear: 403 when capability off (default server)"
pt_post /network/clear "{\"tabId\":\"${TAB_ID}\"}"
-assert_ok "clear network data"
-
-# Verify entries are cleared
-pt_get "/network?tabId=${TAB_ID}"
-assert_ok "get network after clear"
-ENTRIES_COUNT=$(echo "$RESULT" | jq '.entries | length')
-echo -e " ${GREEN}✓${NC} entries after clear: $ENTRIES_COUNT"
-((ASSERTIONS_PASSED++)) || true
+assert_not_ok "rejects when allowNetworkIntercept=false"
+assert_json_contains "$RESULT" '.code' 'network_intercept_disabled' "error code identifies the disabled capability"
end_test
diff --git a/tests/e2e/scenarios/api/network-route-extended.sh b/tests/e2e/scenarios/api/network-route-extended.sh
index b3b4bf94..ac2a21ec 100755
--- a/tests/e2e/scenarios/api/network-route-extended.sh
+++ b/tests/e2e/scenarios/api/network-route-extended.sh
@@ -196,5 +196,13 @@ assert_not_ok "second unroute on cleared tab returns error"
end_test
+# ─────────────────────────────────────────────────────────────────
+start_test "POST /network/clear works when capability on (full-permissive)"
+
+pt_post /network/clear "{\"tabId\":\"${TAB_ID}\"}"
+assert_ok "clear network data"
+
+end_test
+
netroute_restore_server
trap - EXIT
diff --git a/tests/e2e/scenarios/infra/network-basic.sh b/tests/e2e/scenarios/infra/network-basic.sh
index def6445f..9b678dc9 100755
--- a/tests/e2e/scenarios/infra/network-basic.sh
+++ b/tests/e2e/scenarios/infra/network-basic.sh
@@ -61,22 +61,14 @@ assert_not_ok "rejects bad tab"
end_test
# ─────────────────────────────────────────────────────────────────
-start_test "POST /network/clear: clears entries"
+# /network/clear is gated behind security.allowNetworkIntercept, which this
+# server leaves off by default — see network-route-extended.sh for the
+# happy-path assertion against the full-permissive server.
+start_test "POST /network/clear: 403 when capability off (default server)"
pt_post /network/clear "{\"tabId\":\"${TAB_ID}\"}"
-assert_ok "clear network"
-
-pt_get "/network?tabId=${TAB_ID}"
-assert_ok "get after clear"
-
-ENTRIES_COUNT=$(echo "$RESULT" | jq '.entries | length')
-if [ "$ENTRIES_COUNT" -eq 0 ]; then
- echo -e " ${GREEN}✓${NC} entries cleared"
- ((ASSERTIONS_PASSED++)) || true
-else
- echo -e " ${YELLOW}~${NC} $ENTRIES_COUNT entries remain after clear"
- ((ASSERTIONS_PASSED++)) || true
-fi
+assert_not_ok "rejects when allowNetworkIntercept=false"
+assert_json_contains "$RESULT" '.code' 'network_intercept_disabled' "error code identifies the disabled capability"
end_test