-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_local.sh
More file actions
executable file
·46 lines (35 loc) · 1.17 KB
/
test_local.sh
File metadata and controls
executable file
·46 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Local testing script for Screenshot API
set -e
echo "🧪 Testing Screenshot API locally..."
# Check if cargo-lambda is installed
if ! command -v cargo-lambda &> /dev/null; then
echo "❌ cargo-lambda not found. Please install it first:"
echo " cargo install cargo-lambda"
exit 1
fi
# Start local server in background
echo "🚀 Starting local Lambda server..."
cargo lambda watch &
SERVER_PID=$!
# Wait for server to start
echo "⏳ Waiting for server to start..."
sleep 5
# Function to cleanup
cleanup() {
echo "🧹 Cleaning up..."
kill $SERVER_PID 2>/dev/null || true
exit
}
# Set trap to cleanup on exit
trap cleanup EXIT INT TERM
# Test basic functionality
echo "📸 Testing basic screenshot..."
curl -s "http://localhost:9000/lambda-url/screenshotapi/?url=https://example.com" | jq .
echo ""
echo "📸 Testing with custom parameters..."
curl -s "http://localhost:9000/lambda-url/screenshotapi/?url=https://httpbin.org/html&width=800&height=600&wait=2000" | jq .
echo ""
echo "✅ Local tests completed!"
echo "💡 You can also test manually with:"
echo " curl 'http://localhost:9000/lambda-url/screenshotapi/?url=https://example.com'"