Files
rpa_vision_v3/test_vwb_startup_final.py
Dom a27b74cf22 v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- 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>
2026-01-29 11:23:51 +01:00

158 lines
4.6 KiB
Python

#!/usr/bin/env python3
"""
Test Final de Démarrage VWB - Post Correction TypeScript
Auteur : Dom, Alice, Kiro - 8 janvier 2026
Valide que le Visual Workflow Builder démarre correctement après les corrections TypeScript.
"""
import subprocess
import time
import requests
import sys
from pathlib import Path
def test_vwb_startup():
"""Test de démarrage complet du VWB."""
print("🚀 Test de démarrage du Visual Workflow Builder...")
vwb_path = Path("visual_workflow_builder")
if not vwb_path.exists():
print("❌ Répertoire VWB non trouvé")
return False
# Démarrage du VWB en arrière-plan
print("📋 Démarrage des services...")
try:
# Démarrage du backend
backend_process = subprocess.Popen(
["python3", "backend/app.py"],
cwd=vwb_path,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
# Attendre que le backend soit prêt
print("⏳ Attente du backend...")
for i in range(30): # 30 secondes max
try:
response = requests.get("http://localhost:5002/health", timeout=2)
if response.status_code == 200:
print("✅ Backend prêt sur http://localhost:5002")
break
except:
time.sleep(1)
else:
print("❌ Backend non accessible après 30s")
backend_process.terminate()
return False
# Test des endpoints critiques
endpoints = [
"/health",
"/api/workflows",
"/api/real-demo/monitors"
]
print("🔍 Test des endpoints...")
for endpoint in endpoints:
try:
response = requests.get(f"http://localhost:5002{endpoint}", timeout=5)
if response.status_code in [200, 404]: # 404 acceptable pour certains endpoints
print(f"{endpoint}")
else:
print(f"⚠️ {endpoint} - Status: {response.status_code}")
except Exception as e:
print(f"{endpoint} - Erreur: {e}")
# Nettoyage
backend_process.terminate()
backend_process.wait(timeout=5)
print("✅ Test de démarrage réussi")
return True
except Exception as e:
print(f"❌ Erreur lors du test: {e}")
return False
def test_frontend_build():
"""Test de build du frontend."""
print("🔨 Test de build du frontend...")
frontend_path = Path("visual_workflow_builder/frontend")
try:
result = subprocess.run(
["npm", "run", "build"],
cwd=frontend_path,
capture_output=True,
text=True,
timeout=60
)
if result.returncode == 0:
print("✅ Build frontend réussi")
return True
else:
print(f"❌ Erreur de build: {result.stderr}")
return False
except subprocess.TimeoutExpired:
print("❌ Timeout lors du build")
return False
except Exception as e:
print(f"❌ Erreur: {e}")
return False
def main():
"""Fonction principale."""
print("=" * 60)
print("TEST FINAL - DÉMARRAGE VWB POST-CORRECTION")
print("Auteur : Dom, Alice, Kiro - 8 janvier 2026")
print("=" * 60)
tests = [
("Build Frontend", test_frontend_build),
("Démarrage VWB", test_vwb_startup)
]
results = []
for test_name, test_func in tests:
print(f"\n📋 {test_name}")
print("-" * 40)
try:
result = test_func()
results.append((test_name, result))
except Exception as e:
print(f"❌ Erreur dans {test_name}: {e}")
results.append((test_name, False))
# Résumé
print("\n" + "=" * 60)
print("RÉSUMÉ FINAL")
print("=" * 60)
passed = sum(1 for _, result in results if result)
total = len(results)
for test_name, result in results:
status = "✅ RÉUSSI" if result else "❌ ÉCHEC"
print(f"{test_name:<20} {status}")
print(f"\nRésultat: {passed}/{total} tests réussis")
if passed == total:
print("\n🎉 VALIDATION COMPLÈTE RÉUSSIE !")
print("✅ Le VWB fonctionne parfaitement après les corrections TypeScript")
print("✅ Prêt pour la production")
return 0
else:
print("\n⚠️ Certains tests ont échoué")
return 1
if __name__ == "__main__":
sys.exit(main())