-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-app.sh
More file actions
executable file
·64 lines (56 loc) · 1.85 KB
/
test-app.sh
File metadata and controls
executable file
·64 lines (56 loc) · 1.85 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
echo "Testing PacketView Application"
echo "=================================="
echo ""
if curl -s http://localhost:3001/api/interfaces > /dev/null 2>&1; then
echo "✓ Backend is running"
INTERFACES=$(curl -s http://localhost:3001/api/interfaces)
INTERFACE_COUNT=$(echo "$INTERFACES" | python3 -c "import sys, json; data=json.load(sys.stdin); print(len(data['interfaces']))")
echo " Found $INTERFACE_COUNT network interfaces"
else
echo "✗ Backend is not running"
echo " Starting backend..."
cd backend && npm run dev &
sleep 3
fi
echo ""
if curl -s http://localhost:5173 > /dev/null 2>&1; then
echo "✓ Frontend is running"
if curl -s http://localhost:5173 | grep -q "PacketView"; then
echo " HTML loaded correctly"
else
echo " HTML content issue"
fi
else
echo "✗ Frontend is not running"
echo " Starting frontend..."
cd frontend && npm run dev &
sleep 3
fi
echo ""
if command -v websocat &> /dev/null; then
echo "Testing WebSocket connection..."
if timeout 2 websocat ws://localhost:3001/ws 2>&1 | grep -q "Connected"; then
echo "✓ WebSocket connection successful"
else
echo "✗ WebSocket connection failed"
fi
else
echo "Note: Install websocat to test WebSocket connection"
fi
echo ""
echo "Test Summary"
echo "============"
echo "Backend API: http://localhost:3001/api"
echo "Frontend URL: http://localhost:5173"
echo "WebSocket URL: ws://localhost:3001/ws"
echo ""
echo "To test the application:"
echo "1. Open http://localhost:5173 in your browser"
echo "2. Select a network interface"
echo "3. Click 'Start Capture'"
echo "4. Generate some network traffic (ping, curl, etc.)"
echo "5. Check visualization for devices and connections"
echo ""
echo "Servers are running. Press Ctrl+C to stop test script (servers will continue)."
wait