- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
157 lines
4.2 KiB
Python
157 lines
4.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Real Functionality Test Configuration
|
|
|
|
Configuration for real functionality testing without mocks or simulations.
|
|
Defines real service endpoints, timeouts, and validation criteria.
|
|
"""
|
|
|
|
import os
|
|
from dataclasses import dataclass
|
|
from typing import Dict, List, Optional
|
|
|
|
|
|
@dataclass
|
|
class RealServiceConfig:
|
|
"""Configuration for real services used in testing."""
|
|
name: str
|
|
port: int
|
|
health_endpoint: str
|
|
timeout_seconds: int = 5
|
|
required_for_test: bool = True
|
|
|
|
|
|
@dataclass
|
|
class RealTestConfig:
|
|
"""Configuration for real functionality testing."""
|
|
|
|
# Real services that must be running
|
|
services: List[RealServiceConfig]
|
|
|
|
# Real browser configuration
|
|
browser_timeout_seconds: int = 20
|
|
page_load_timeout_seconds: int = 15
|
|
element_wait_timeout_seconds: int = 10
|
|
|
|
# Real API endpoints to validate
|
|
api_endpoints: Dict[str, str]
|
|
|
|
# Real UI selectors (no test-specific mocks)
|
|
ui_selectors: Dict[str, List[str]]
|
|
|
|
# Real data validation criteria
|
|
min_documentation_tools: int = 1
|
|
min_content_length: int = 20
|
|
required_api_fields: List[str]
|
|
|
|
|
|
# Real production-like test configuration
|
|
REAL_TEST_CONFIG = RealTestConfig(
|
|
services=[
|
|
RealServiceConfig(
|
|
name="Frontend",
|
|
port=3000,
|
|
health_endpoint="http://localhost:3000",
|
|
timeout_seconds=5,
|
|
required_for_test=True
|
|
),
|
|
RealServiceConfig(
|
|
name="Backend",
|
|
port=5002,
|
|
health_endpoint="http://localhost:5002/health",
|
|
timeout_seconds=5,
|
|
required_for_test=True
|
|
)
|
|
],
|
|
|
|
browser_timeout_seconds=20,
|
|
page_load_timeout_seconds=15,
|
|
element_wait_timeout_seconds=10,
|
|
|
|
api_endpoints={
|
|
"documentation": "http://localhost:5002/api/documentation",
|
|
"tools": "http://localhost:5002/api/tools",
|
|
"health": "http://localhost:5002/health"
|
|
},
|
|
|
|
ui_selectors={
|
|
"palette": [
|
|
"[data-testid='palette']",
|
|
".palette",
|
|
"[class*='palette']",
|
|
".MuiPaper-root",
|
|
"[role='toolbar']"
|
|
],
|
|
"properties_panel": [
|
|
"[data-testid='properties-panel']",
|
|
".properties-panel",
|
|
"[class*='properties']",
|
|
".MuiDrawer-root",
|
|
".sidebar"
|
|
],
|
|
"tabs": [
|
|
"[role='tab']",
|
|
".MuiTab-root",
|
|
"[class*='tab']",
|
|
"button[id*='tab']"
|
|
],
|
|
"documentation_content": [
|
|
"[role='tabpanel']",
|
|
".documentation-tab",
|
|
"[class*='documentation']",
|
|
".MuiTabPanel-root"
|
|
],
|
|
"canvas": [
|
|
".canvas",
|
|
".react-flow",
|
|
".workflow-area",
|
|
"#canvas"
|
|
]
|
|
},
|
|
|
|
min_documentation_tools=1,
|
|
min_content_length=20,
|
|
required_api_fields=["description", "parameters", "examples"]
|
|
)
|
|
|
|
|
|
def get_real_test_config() -> RealTestConfig:
|
|
"""Get the real test configuration."""
|
|
return REAL_TEST_CONFIG
|
|
|
|
|
|
def validate_real_environment() -> bool:
|
|
"""
|
|
Validate that the real environment is ready for testing.
|
|
No mocks - checks actual running services.
|
|
"""
|
|
import requests
|
|
|
|
config = get_real_test_config()
|
|
|
|
for service in config.services:
|
|
if service.required_for_test:
|
|
try:
|
|
response = requests.get(
|
|
service.health_endpoint,
|
|
timeout=service.timeout_seconds
|
|
)
|
|
if response.status_code != 200:
|
|
print(f"❌ Real service {service.name} unhealthy: {response.status_code}")
|
|
return False
|
|
else:
|
|
print(f"✅ Real service {service.name} healthy")
|
|
except Exception as e:
|
|
print(f"❌ Real service {service.name} unreachable: {e}")
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("🔧 Validating real test environment...")
|
|
if validate_real_environment():
|
|
print("✅ Real environment ready for testing")
|
|
else:
|
|
print("❌ Real environment not ready")
|
|
exit(1) |