mirror of
https://github.com/actionbook/actionbook.git
synced 2026-09-19 03:28:06 +08:00
5662e46c3a
Add #[allow(dead_code)] attributes to: - Camoufox WebDriver driver unused fields and methods - Camoufox REST API client unused imports - Browser router helper methods (as_cdp, as_camofox, etc.) - Fingerprint generator module (Phase 2 - not yet integrated) - Human behavior simulation module (Phase 3 - not yet integrated) - Enhanced stealth module (Phase 1 - not yet integrated) These are preparatory implementations for future Camoufox backend integration. Suppressing warnings keeps build output clean while preserving the code for upcoming CLI integration. Modified files: - src/browser/camofox/mod.rs - src/browser/camofox_webdriver/driver.rs - src/browser/fingerprint_generator.rs - src/browser/human_behavior.rs - src/browser/mod.rs - src/browser/router.rs - src/browser/stealth_enhanced.rs
48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test Camoufox REST API endpoints
|
|
|
|
BASE_URL="http://localhost:9377"
|
|
|
|
echo "🧪 Testing Camoufox REST API Server"
|
|
echo "===================================="
|
|
echo
|
|
|
|
# Test 1: Health check
|
|
echo "1. Testing /health endpoint..."
|
|
curl -s "$BASE_URL/health" | jq '.'
|
|
echo
|
|
|
|
# Test 2: Create tab
|
|
echo "2. Creating tab..."
|
|
TAB_RESPONSE=$(curl -s -X POST "$BASE_URL/tabs" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"userId":"test","sessionKey":"test","url":"https://example.com"}')
|
|
echo "$TAB_RESPONSE" | jq '.'
|
|
|
|
TAB_ID=$(echo "$TAB_RESPONSE" | jq -r '.id')
|
|
echo "Tab ID: $TAB_ID"
|
|
echo
|
|
|
|
# Test 3: Get accessibility tree
|
|
echo "3. Getting accessibility tree..."
|
|
curl -s "$BASE_URL/tabs/$TAB_ID/snapshot?user_id=test" | jq '.tree | {role, name, children: (.children | length)}'
|
|
echo
|
|
|
|
# Test 4: Screenshot
|
|
echo "4. Taking screenshot..."
|
|
SCREENSHOT_DATA=$(curl -s "$BASE_URL/tabs/$TAB_ID/screenshot?user_id=test" | jq -r '.data')
|
|
SCREENSHOT_SIZE=$(echo "$SCREENSHOT_DATA" | wc -c)
|
|
echo "Screenshot size: $SCREENSHOT_SIZE bytes (base64)"
|
|
echo
|
|
|
|
# Save screenshot
|
|
echo "$SCREENSHOT_DATA" | base64 -d > /tmp/camoufox-test.png
|
|
echo "Screenshot saved to: /tmp/camoufox-test.png"
|
|
file /tmp/camoufox-test.png
|
|
echo
|
|
|
|
echo "✅ All API tests completed!"
|
|
echo
|
|
echo "To view screenshot:"
|
|
echo " open /tmp/camoufox-test.png"
|