High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
refactor: assert_ok and assert_http_status helpers
Bosch32900a38642e
diff --git a/tests/e2e/scenarios/06-screenshot-pdf.sh b/tests/e2e/scenarios/06-screenshot-pdf.shindex cf86229d..7cae3744 100755--- a/tests/e2e/scenarios/06-screenshot-pdf.sh+++ b/tests/e2e/scenarios/06-screenshot-pdf.sh@@ -10,13 +10,7 @@ pt_post /navigate -d "{\"url\":\"${FIXTURES_URL}/table.html\"}"sleep 1pt_get /screenshot-if [ "$HTTP_STATUS" = "200" ]; then- echo -e " ${GREEN}✓${NC} Screenshot returned 200"- ((ASSERTIONS_PASSED++)) || true-else- echo -e " ${RED}✗${NC} Screenshot failed (status: $HTTP_STATUS)"- ((ASSERTIONS_FAILED++)) || true-fi+assert_ok "screenshot"end_test@@ -35,7 +29,8 @@ start_test "pinchtab screenshot --tab <id>"pt_get /tabsTAB_ID=$(echo "$RESULT" | jq -r '.tabs[0].id')-assert_status 200 "${PINCHTAB_URL}/tabs/${TAB_ID}/screenshot"+pt_get "/tabs/${TAB_ID}/screenshot"+assert_ok "tab screenshot"end_test@@ -45,6 +40,7 @@ start_test "pinchtab pdf --tab <id>"pt_get /tabsTAB_ID=$(echo "$RESULT" | jq -r '.tabs[0].id')-assert_status 200 "${PINCHTAB_URL}/tabs/${TAB_ID}/pdf"+pt_get "/tabs/${TAB_ID}/pdf"+assert_ok "tab pdf"end_testdiff --git a/tests/e2e/scenarios/common.sh b/tests/e2e/scenarios/common.shindex 9ade0108..210e1ed4 100755--- a/tests/e2e/scenarios/common.sh+++ b/tests/e2e/scenarios/common.sh@@ -219,6 +219,37 @@ pt() { pinchtab "$@"; }pt_get() { pinchtab GET "$1"; echo "$RESULT"; }pt_post() { pinchtab POST "$1" -d "$2"; echo "$RESULT"; }+# ================================================================+# HTTP status assertions+# ================================================================++# Assert last request returned expected status (uses $HTTP_STATUS from pinchtab())+assert_ok() {+ local label="${1:-request}"++ if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "201" ]; then+ echo -e " ${GREEN}✓${NC} $label → $HTTP_STATUS"+ ((ASSERTIONS_PASSED++)) || true+ else+ echo -e " ${RED}✗${NC} $label failed (status: $HTTP_STATUS)"+ ((ASSERTIONS_FAILED++)) || true+ fi+}++# Assert last request returned specific status+assert_http_status() {+ local expected="$1"+ local label="${2:-request}"++ if [ "$HTTP_STATUS" = "$expected" ]; then+ echo -e " ${GREEN}✓${NC} $label → $HTTP_STATUS"+ ((ASSERTIONS_PASSED++)) || true+ else+ echo -e " ${RED}✗${NC} $label: expected $expected, got $HTTP_STATUS"+ ((ASSERTIONS_FAILED++)) || true+ fi+}+# ================================================================# Element interaction helpers# ================================================================