High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test(cli): add pdf, tabs new, and instance management tests
Boschc6094c990875
diff --git a/tests/e2e/scenarios-cli/13-pdf.sh b/tests/e2e/scenarios-cli/13-pdf.shnew file mode 100755index 00000000..27b7e45c--- /dev/null+++ b/tests/e2e/scenarios-cli/13-pdf.sh@@ -0,0 +1,38 @@+#!/bin/bash+# 13-pdf.sh — CLI PDF export command++source "$(dirname "$0")/common.sh"++# ─────────────────────────────────────────────────────────────────+start_test "pinchtab pdf"++pt_ok nav "${FIXTURES_URL}/form.html"++# PDF outputs binary data to stdout by default+pt pdf+if [ "$PT_CODE" -eq 0 ] && [ -n "$PT_OUT" ]; then+ echo -e " ${GREEN}✓${NC} pdf export succeeded"+ ((ASSERTIONS_PASSED++)) || true+else+ echo -e " ${RED}✗${NC} pdf export failed or empty"+ ((ASSERTIONS_FAILED++)) || true+fi++end_test++# ─────────────────────────────────────────────────────────────────+start_test "pinchtab pdf -o <file>"++TMPFILE="/tmp/test-export-$$.pdf"+pt_ok pdf -o "$TMPFILE"++if [ -f "$TMPFILE" ] && [ -s "$TMPFILE" ]; then+ echo -e " ${GREEN}✓${NC} pdf saved to file"+ ((ASSERTIONS_PASSED++)) || true+ rm -f "$TMPFILE"+else+ echo -e " ${RED}✗${NC} pdf file not created or empty"+ ((ASSERTIONS_FAILED++)) || true+fi++end_testdiff --git a/tests/e2e/scenarios-cli/14-tabs-new.sh b/tests/e2e/scenarios-cli/14-tabs-new.shnew file mode 100755index 00000000..ab8596f0--- /dev/null+++ b/tests/e2e/scenarios-cli/14-tabs-new.sh@@ -0,0 +1,25 @@+#!/bin/bash+# 14-tabs-new.sh — CLI tabs new command++source "$(dirname "$0")/common.sh"++# ─────────────────────────────────────────────────────────────────+start_test "pinchtab tabs new <url>"++pt_ok tabs new "${FIXTURES_URL}/buttons.html"+assert_output_json+assert_output_contains "tabId" "returns new tab ID"++# Save the tab ID for cleanup+NEW_TAB_ID=$(echo "$PT_OUT" | jq -r '.tabId')++# Verify it appears in tabs list+pt_ok tabs+assert_output_contains "$NEW_TAB_ID" "new tab appears in list"++# Cleanup+if [ -n "$NEW_TAB_ID" ] && [ "$NEW_TAB_ID" != "null" ]; then+ pt tabs close "$NEW_TAB_ID" > /dev/null 2>&1 || true+fi++end_testdiff --git a/tests/e2e/scenarios-cli/15-instance.sh b/tests/e2e/scenarios-cli/15-instance.shnew file mode 100755index 00000000..c5c5564e--- /dev/null+++ b/tests/e2e/scenarios-cli/15-instance.sh@@ -0,0 +1,39 @@+#!/bin/bash+# 15-instance.sh — CLI instance management commands++source "$(dirname "$0")/common.sh"++# ─────────────────────────────────────────────────────────────────+start_test "pinchtab instance (info)"++# Get default instance ID from health+pt_ok health+INSTANCE_ID=$(echo "$PT_OUT" | jq -r '.defaultInstance.id // empty')++if [ -n "$INSTANCE_ID" ]; then+ pt_ok instance "$INSTANCE_ID"+ assert_output_json+ assert_output_contains "id" "returns instance info"+else+ echo -e " ${YELLOW}⚠${NC} No default instance found, skipping"+ ((ASSERTIONS_PASSED++)) || true+fi++end_test++# ─────────────────────────────────────────────────────────────────+start_test "pinchtab instance logs"++if [ -n "$INSTANCE_ID" ]; then+ pt_ok instance logs "$INSTANCE_ID"+ # Logs might be empty but command should succeed+ echo -e " ${GREEN}✓${NC} instance logs succeeded"+ ((ASSERTIONS_PASSED++)) || true+else+ echo -e " ${YELLOW}⚠${NC} No instance ID, skipping logs test"+ ((ASSERTIONS_PASSED++)) || true+fi++end_test++# Note: instance start/stop not tested to avoid disrupting the running instance