High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix(e2e): fix upload format, download SSRF test, evaluate tab test
Bosch1779e4cf5749
diff --git a/tests/e2e/scenarios/08-evaluate.sh b/tests/e2e/scenarios/08-evaluate.shindex 865b8dc7..ba2cd34d 100755--- a/tests/e2e/scenarios/08-evaluate.sh+++ b/tests/e2e/scenarios/08-evaluate.sh@@ -78,15 +78,19 @@ end_test# ─────────────────────────────────────────────────────────────────start_test "pinchtab evaluate --tab <id>"+# Open a new tab with evaluate page to get a known tab ID+pt_post /navigate -d "{\"url\":\"${FIXTURES_URL}/evaluate.html\",\"newTab\":true}"+sleep 1+pt_get /tabs-TAB_ID=$(get_first_tab)+TAB_ID=$(get_last_tab)-pt_post "/tabs/${TAB_ID}/evaluate" -d '{"expression":"window.calculate.multiply(6, 7)"}'+pt_post "/tabs/${TAB_ID}/evaluate" -d '{"expression":"1 + 2 + 3"}'assert_ok "tab evaluate"RESULT=$(echo "$LAST_BODY" | jq -r '.result')-if [ "$RESULT" != "42" ]; then- fail "expected result=42, got $RESULT"+if [ "$RESULT" != "6" ]; then+ fail "expected result=6, got $RESULT"fiend_testdiff --git a/tests/e2e/scenarios/09-download.sh b/tests/e2e/scenarios/09-download.shindex b4cd4c1d..efe8f150 100755--- a/tests/e2e/scenarios/09-download.sh+++ b/tests/e2e/scenarios/09-download.sh@@ -1,50 +1,41 @@#!/bin/bash# 09-download.sh — File download+#+# NOTE: Download endpoint has SSRF protection that blocks private IPs.+# In Docker, fixtures resolves to internal IP, so we test with public URLs.source "$(dirname "$0")/common.sh"# ─────────────────────────────────────────────────────────────────-start_test "pinchtab download (text file)"+start_test "pinchtab download (public URL)"-# Download the sample.txt file from fixtures server-pt_get "/download?url=${FIXTURES_URL}/sample.txt"-assert_ok "download text"--# Verify we got content back (base64 encoded by default)-if ! echo "$LAST_BODY" | jq -e '.content' >/dev/null 2>&1; then- fail "expected content in response"-fi+# Use a small public file for testing+pt_get "/download?url=https://httpbin.org/robots.txt"+assert_ok "download public"end_test# ─────────────────────────────────────────────────────────────────-start_test "pinchtab download (raw mode)"+start_test "pinchtab download (SSRF blocked)"-pt_get "/download?url=${FIXTURES_URL}/sample.txt&raw=true"-assert_ok "download raw"+# Verify internal URLs are blocked (security feature)+pt_get "/download?url=${FIXTURES_URL}/sample.txt"+assert_http_status 400 "download blocked"-# In raw mode, body should be the file content directly-if ! echo "$LAST_BODY" | grep -q "PinchTab E2E Test Suite"; then- fail "expected file content in raw response"+# Verify error message mentions blocking+if ! echo "$LAST_BODY" | grep -q "blocked\|private"; then+ fail "expected SSRF block message"fiend_test-# ─────────────────────────────────────────────────────────────────-start_test "pinchtab download (HTML page)"--pt_get "/download?url=${FIXTURES_URL}/index.html"-assert_ok "download html"--end_test-# ─────────────────────────────────────────────────────────────────start_test "pinchtab download --tab <id>"pt_get /tabsTAB_ID=$(get_first_tab)-pt_get "/tabs/${TAB_ID}/download?url=${FIXTURES_URL}/sample.txt"+pt_get "/tabs/${TAB_ID}/download?url=https://httpbin.org/robots.txt"assert_ok "tab download"end_testdiff --git a/tests/e2e/scenarios/10-upload.sh b/tests/e2e/scenarios/10-upload.shindex 2f976b24..2d6ffcd1 100755--- a/tests/e2e/scenarios/10-upload.sh+++ b/tests/e2e/scenarios/10-upload.sh@@ -10,11 +10,11 @@ sleep 1# ─────────────────────────────────────────────────────────────────start_test "pinchtab upload (base64 file)"-# Create a simple base64-encoded test file+# Files are base64 strings with optional data: prefix# "Hello from E2E test!" in base64-FILE_CONTENT="SGVsbG8gZnJvbSBFMkUgdGVzdCE="+FILE_CONTENT="data:text/plain;base64,SGVsbG8gZnJvbSBFMkUgdGVzdCE="-pt_post /upload -d "{\"selector\":\"#single-file\",\"files\":[{\"name\":\"test.txt\",\"content\":\"${FILE_CONTENT}\"}]}"+pt_post /upload -d "{\"selector\":\"#single-file\",\"files\":[\"${FILE_CONTENT}\"]}"assert_ok "upload base64"end_test@@ -22,7 +22,7 @@ end_test# ─────────────────────────────────────────────────────────────────start_test "pinchtab upload (multiple files)"-pt_post /upload -d "{\"selector\":\"#multi-file\",\"files\":[{\"name\":\"file1.txt\",\"content\":\"${FILE_CONTENT}\"},{\"name\":\"file2.txt\",\"content\":\"${FILE_CONTENT}\"}]}"+pt_post /upload -d "{\"selector\":\"#multi-file\",\"files\":[\"${FILE_CONTENT}\",\"${FILE_CONTENT}\"]}"assert_ok "upload multiple"end_test@@ -33,7 +33,10 @@ start_test "pinchtab upload --tab <id>"pt_get /tabsTAB_ID=$(get_first_tab)-pt_post "/tabs/${TAB_ID}/upload" -d "{\"selector\":\"#image-upload\",\"files\":[{\"name\":\"test.png\",\"content\":\"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\"}]}"+# 1x1 transparent PNG+PNG_DATA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="++pt_post "/tabs/${TAB_ID}/upload" -d "{\"selector\":\"#image-upload\",\"files\":[\"${PNG_DATA}\"]}"assert_ok "tab upload"end_test