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>
This commit is contained in:
112
tests/integration/test_backend_vwb_simple_09jan2026.py
Normal file
112
tests/integration/test_backend_vwb_simple_09jan2026.py
Normal file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test simple du backend VWB avec environnement virtuel.
|
||||
|
||||
Auteur : Dom, Alice, Kiro - 09 janvier 2026
|
||||
|
||||
Ce test vérifie que le backend VWB fonctionne correctement avec l'environnement virtuel.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Ajouter le répertoire racine au path
|
||||
ROOT_DIR = Path(__file__).parent.parent.parent
|
||||
sys.path.insert(0, str(ROOT_DIR))
|
||||
|
||||
def test_backend_direct():
|
||||
"""Teste le backend directement avec l'environnement virtuel."""
|
||||
print("🔍 Test direct du backend VWB...")
|
||||
|
||||
# Utiliser l'environnement virtuel
|
||||
venv_python = ROOT_DIR / "venv_v3" / "bin" / "python3"
|
||||
|
||||
if not venv_python.exists():
|
||||
print("❌ Environnement virtuel non trouvé")
|
||||
return False
|
||||
|
||||
# Test des fonctions backend directement
|
||||
test_script = f'''
|
||||
import sys
|
||||
from pathlib import Path
|
||||
ROOT_DIR = Path("{ROOT_DIR}")
|
||||
sys.path.insert(0, str(ROOT_DIR))
|
||||
sys.path.insert(0, str(ROOT_DIR / "visual_workflow_builder" / "backend"))
|
||||
|
||||
try:
|
||||
from app_lightweight import capture_screen_to_base64, create_visual_embedding
|
||||
|
||||
print("🔄 Test de capture d'écran...")
|
||||
result = capture_screen_to_base64()
|
||||
|
||||
if result['success']:
|
||||
print(f"✅ Capture réussie - {{result['width']}}x{{result['height']}}")
|
||||
|
||||
# Test d'embedding
|
||||
print("🔄 Test d'embedding...")
|
||||
bounding_box = {{'x': 100, 'y': 100, 'width': 200, 'height': 150}}
|
||||
|
||||
embedding_result = create_visual_embedding(
|
||||
result['screenshot'],
|
||||
bounding_box,
|
||||
'test_backend_simple'
|
||||
)
|
||||
|
||||
if embedding_result['success']:
|
||||
print(f"✅ Embedding créé - ID: {{embedding_result['embedding_id']}}")
|
||||
print("✅ BACKEND FONCTIONNE CORRECTEMENT")
|
||||
else:
|
||||
print(f"❌ Erreur embedding: {{embedding_result['error']}}")
|
||||
else:
|
||||
print(f"❌ Erreur capture: {{result['error']}}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Erreur: {{e}}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
'''
|
||||
|
||||
try:
|
||||
# Exécuter le test avec l'environnement virtuel
|
||||
result = subprocess.run(
|
||||
[str(venv_python), "-c", test_script],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
cwd=str(ROOT_DIR)
|
||||
)
|
||||
|
||||
print("Sortie du test:")
|
||||
print(result.stdout)
|
||||
|
||||
if result.stderr:
|
||||
print("Erreurs:")
|
||||
print(result.stderr)
|
||||
|
||||
return "BACKEND FONCTIONNE CORRECTEMENT" in result.stdout
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Erreur lors du test: {e}")
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Fonction principale de test."""
|
||||
print("=" * 60)
|
||||
print(" TEST BACKEND VWB SIMPLE")
|
||||
print("=" * 60)
|
||||
print("Auteur : Dom, Alice, Kiro - 09 janvier 2026")
|
||||
print("")
|
||||
|
||||
success = test_backend_direct()
|
||||
|
||||
if success:
|
||||
print("\n✅ Le backend VWB fonctionne correctement !")
|
||||
else:
|
||||
print("\n❌ Le backend VWB ne fonctionne pas correctement")
|
||||
|
||||
return success
|
||||
|
||||
if __name__ == '__main__':
|
||||
success = main()
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in New Issue
Block a user