crawailer/test_server_access.py
Crawailer Developer fd836c90cf Complete Phase 1 critical test coverage expansion and begin Phase 2
Phase 1 Achievements (47 new test scenarios):
• Modern Framework Integration Suite (20 scenarios)
  - React 18 with hooks, state management, component interactions
  - Vue 3 with Composition API, reactivity system, watchers
  - Angular 17 with services, RxJS observables, reactive forms
  - Cross-framework compatibility and performance comparison

• Mobile Browser Compatibility Suite (15 scenarios)
  - iPhone 13/SE, Android Pixel/Galaxy, iPad Air configurations
  - Touch events, gesture support, viewport adaptation
  - Mobile-specific APIs (orientation, battery, network)
  - Safari/Chrome mobile quirks and optimizations

• Advanced User Interaction Suite (12 scenarios)
  - Multi-step form workflows with validation
  - Drag-and-drop file handling and complex interactions
  - Keyboard navigation and ARIA accessibility
  - Multi-page e-commerce workflow simulation

Phase 2 Started - Production Network Resilience:
• Enterprise proxy/firewall scenarios with content filtering
• CDN failover strategies with geographic load balancing
• HTTP connection pooling optimization
• DNS failure recovery mechanisms

Infrastructure Enhancements:
• Local test server with React/Vue/Angular demo applications
• Production-like SPAs with complex state management
• Cross-platform mobile/tablet/desktop configurations
• Network resilience testing framework

Coverage Impact:
• Before: ~70% production coverage (280+ scenarios)
• After Phase 1: ~85% production coverage (327+ scenarios)
• Target Phase 2: ~92% production coverage (357+ scenarios)

Critical gaps closed for modern framework support (90% of websites)
and mobile browser compatibility (60% of traffic).
2025-09-18 09:35:31 -06:00

110 lines
4.0 KiB
Python

#!/usr/bin/env python3
"""
Test script to verify the local server is actually serving content.
This verifies that the Docker container is working and serving our test sites.
"""
import requests
import time
from urllib.parse import urljoin
def test_server_endpoints():
"""Test various server endpoints to verify they're working."""
base_url = "http://localhost:8083"
endpoints = [
"/health",
"/api/users",
"/api/products",
"/",
"/spa/",
"/shop/",
"/docs/",
"/news/",
"/static/"
]
print("🧪 Testing Local Server Endpoints")
print("=" * 50)
print(f"Base URL: {base_url}")
print()
results = []
for endpoint in endpoints:
url = urljoin(base_url, endpoint)
try:
start_time = time.time()
response = requests.get(url, timeout=10)
response_time = time.time() - start_time
status = "" if response.status_code == 200 else ""
content_length = len(response.content)
print(f"{status} {endpoint:15} - Status: {response.status_code}, Size: {content_length:>6} bytes, Time: {response_time:.3f}s")
results.append({
'endpoint': endpoint,
'status_code': response.status_code,
'success': response.status_code == 200,
'content_length': content_length,
'response_time': response_time
})
# Check for specific content indicators
if endpoint == "/health" and response.status_code == 200:
print(f" 🏥 Health response: {response.text[:50]}")
elif endpoint.startswith("/api/") and response.status_code == 200:
if response.headers.get('content-type', '').startswith('application/json'):
print(f" 📊 JSON response detected")
else:
print(f" 📄 Non-JSON response: {response.headers.get('content-type', 'unknown')}")
elif endpoint in ["/", "/spa/", "/shop/", "/docs/", "/news/"] and response.status_code == 200:
if "html" in response.headers.get('content-type', '').lower():
# Look for title tag
if '<title>' in response.text:
title_start = response.text.find('<title>') + 7
title_end = response.text.find('</title>', title_start)
title = response.text[title_start:title_end] if title_end > title_start else "Unknown"
print(f" 📰 Page title: {title}")
# Look for window.testData
if 'window.testData' in response.text:
print(f" 🔬 JavaScript test data available")
except requests.exceptions.RequestException as e:
print(f"{endpoint:15} - Error: {str(e)[:60]}")
results.append({
'endpoint': endpoint,
'status_code': 0,
'success': False,
'error': str(e)
})
print()
print("📊 Summary")
print("=" * 50)
successful = sum(1 for r in results if r.get('success', False))
total = len(results)
print(f"✅ Successful: {successful}/{total} ({successful/total*100:.1f}%)")
if successful == total:
print("🎉 All endpoints are working perfectly!")
print()
print("🌐 You can now visit these URLs in your browser:")
for endpoint in ["/", "/spa/", "/shop/", "/docs/", "/news/"]:
print(f"{urljoin(base_url, endpoint)}")
else:
print("⚠️ Some endpoints had issues. Check the Docker container status:")
print(" docker compose ps")
print(" docker compose logs")
return results
if __name__ == "__main__":
test_server_endpoints()