-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_connectivity.py
More file actions
46 lines (39 loc) · 1.59 KB
/
Copy pathtest_connectivity.py
File metadata and controls
46 lines (39 loc) · 1.59 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
#!/usr/bin/env python3
"""
Test script to verify connectivity from Selenium container to localhost:3000
"""
import requests
import time
import sys
def test_connectivity():
"""Test if host.docker.internal:3000 is accessible"""
url = "http://host.docker.internal:3000"
print(f"Testing connectivity to {url}...")
try:
response = requests.get(url, timeout=10)
print(f"✅ SUCCESS! Status: {response.status_code}")
print(f"Response headers: {dict(response.headers)}")
return True
except requests.exceptions.ConnectionError:
print("❌ CONNECTION FAILED: Could not connect to host.docker.internal:3000")
print("Make sure your development server is running on localhost:3000")
return False
except requests.exceptions.Timeout:
print("❌ TIMEOUT: Request timed out")
return False
except Exception as e:
print(f"❌ ERROR: {e}")
return False
if __name__ == "__main__":
print("🔍 Testing Docker container connectivity to Mac localhost:3000")
print("=" * 60)
success = test_connectivity()
if not success:
print("\n💡 Troubleshooting tips:")
print("1. Make sure your dev server is running: npm start or similar")
print("2. Check if server binds to 0.0.0.0:3000, not just 127.0.0.1:3000")
print("3. Verify Docker container is running: docker ps")
print("4. Test from container: docker exec -it selenium-chrome-97 curl -I http://host.docker.internal:3000")
sys.exit(1)
else:
print("\n🎉 Ready for Selenium testing!")