- 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>
167 lines
6.4 KiB
Python
167 lines
6.4 KiB
Python
"""
|
|
Tests d'Intégration - Propriétés d'Étapes VWB Complètes
|
|
Auteur : Dom, Alice, Kiro - 12 janvier 2026
|
|
|
|
Tests pour valider l'implémentation complète des propriétés d'étapes
|
|
pour toutes les actions du catalogue VWB.
|
|
"""
|
|
|
|
import pytest
|
|
import json
|
|
from pathlib import Path
|
|
from typing import Dict, Any
|
|
|
|
|
|
class TestProprietesEtapesCompletes:
|
|
"""Tests d'intégration pour les propriétés d'étapes VWB."""
|
|
|
|
def test_catalogue_statique_coherent(self):
|
|
"""Test que le catalogue statique est cohérent."""
|
|
catalogue_path = Path("visual_workflow_builder/frontend/src/data/staticCatalog.ts")
|
|
assert catalogue_path.exists(), "Catalogue statique manquant"
|
|
|
|
with open(catalogue_path, 'r', encoding='utf-8') as f:
|
|
contenu = f.read()
|
|
|
|
# Vérifier la présence des actions essentielles
|
|
actions_essentielles = [
|
|
'click_anchor',
|
|
'type_text',
|
|
'type_secret',
|
|
'focus_anchor',
|
|
'wait_for_anchor',
|
|
'extract_text',
|
|
'navigate_to_url',
|
|
'verify_element_exists'
|
|
]
|
|
|
|
for action in actions_essentielles:
|
|
assert f"id: '{action}'" in contenu, f"Action {action} manquante"
|
|
|
|
def test_composants_frontend_existent(self):
|
|
"""Test que tous les composants frontend existent."""
|
|
composants = [
|
|
"visual_workflow_builder/frontend/src/components/PropertiesPanel/index.tsx",
|
|
"visual_workflow_builder/frontend/src/components/PropertiesPanel/VWBActionProperties.tsx",
|
|
"visual_workflow_builder/frontend/src/hooks/useVWBStepIntegration.ts",
|
|
"visual_workflow_builder/frontend/src/types/catalog.ts"
|
|
]
|
|
|
|
for composant in composants:
|
|
assert Path(composant).exists(), f"Composant manquant : {composant}"
|
|
|
|
def test_actions_backend_existent(self):
|
|
"""Test que les actions backend existent."""
|
|
actions_backend = [
|
|
"visual_workflow_builder/backend/actions/vision_ui/click_anchor.py",
|
|
"visual_workflow_builder/backend/actions/vision_ui/type_text.py",
|
|
"visual_workflow_builder/backend/actions/navigation/navigate_to_url.py",
|
|
"visual_workflow_builder/backend/actions/validation/verify_element_exists.py"
|
|
]
|
|
|
|
for action in actions_backend:
|
|
assert Path(action).exists(), f"Action backend manquante : {action}"
|
|
|
|
def test_types_typescript_coherents(self):
|
|
"""Test que les types TypeScript sont cohérents."""
|
|
catalog_types_path = Path("visual_workflow_builder/frontend/src/types/catalog.ts")
|
|
assert catalog_types_path.exists(), "Types catalogue manquants"
|
|
|
|
with open(catalog_types_path, 'r', encoding='utf-8') as f:
|
|
contenu = f.read()
|
|
|
|
types_essentiels = [
|
|
'VWBCatalogAction',
|
|
'VWBActionParameter',
|
|
'VWBVisualAnchor',
|
|
'VWBActionValidationResult'
|
|
]
|
|
|
|
for type_name in types_essentiels:
|
|
assert f"interface {type_name}" in contenu, f"Type {type_name} manquant"
|
|
|
|
def test_integration_properties_panel(self):
|
|
"""Test l'intégration du panneau de propriétés."""
|
|
properties_path = Path("visual_workflow_builder/frontend/src/components/PropertiesPanel/index.tsx")
|
|
|
|
with open(properties_path, 'r', encoding='utf-8') as f:
|
|
contenu = f.read()
|
|
|
|
# Vérifier les fonctionnalités essentielles
|
|
fonctionnalites = [
|
|
'stepParametersConfig',
|
|
'useVWBStepIntegration',
|
|
'VWBActionProperties',
|
|
'VisualSelector',
|
|
'VariableAutocomplete'
|
|
]
|
|
|
|
for fonctionnalite in fonctionnalites:
|
|
assert fonctionnalite in contenu, f"Fonctionnalité manquante : {fonctionnalite}"
|
|
|
|
def test_integration_vwb_action_properties(self):
|
|
"""Test l'intégration des propriétés d'actions VWB."""
|
|
vwb_props_path = Path("visual_workflow_builder/frontend/src/components/PropertiesPanel/VWBActionProperties.tsx")
|
|
|
|
with open(vwb_props_path, 'r', encoding='utf-8') as f:
|
|
contenu = f.read()
|
|
|
|
# Vérifier les fonctionnalités VWB
|
|
fonctionnalites_vwb = [
|
|
'VisualAnchorEditor',
|
|
'validateParameters',
|
|
'VWBCatalogAction',
|
|
'VWBActionValidationResult'
|
|
]
|
|
|
|
for fonctionnalite in fonctionnalites_vwb:
|
|
assert fonctionnalite in contenu, f"Fonctionnalité VWB manquante : {fonctionnalite}"
|
|
|
|
def test_hook_integration_complet(self):
|
|
"""Test que le hook d'intégration est complet."""
|
|
hook_path = Path("visual_workflow_builder/frontend/src/hooks/useVWBStepIntegration.ts")
|
|
|
|
with open(hook_path, 'r', encoding='utf-8') as f:
|
|
contenu = f.read()
|
|
|
|
# Vérifier les méthodes du hook
|
|
methodes = [
|
|
'createVWBStep',
|
|
'isVWBAction',
|
|
'getVWBAction',
|
|
'loadVWBAction',
|
|
'validateVWBStep',
|
|
'convertDragDataToVWBStep'
|
|
]
|
|
|
|
for methode in methodes:
|
|
assert methode in contenu, f"Méthode hook manquante : {methode}"
|
|
|
|
def test_registry_backend_fonctionnel(self):
|
|
"""Test que le registry backend est fonctionnel."""
|
|
try:
|
|
from visual_workflow_builder.backend.actions.registry import get_global_registry
|
|
|
|
registry = get_global_registry()
|
|
actions = registry.list_actions()
|
|
|
|
# Vérifier qu'il y a des actions enregistrées
|
|
assert len(actions) > 0, "Aucune action dans le registry"
|
|
|
|
# Vérifier quelques actions essentielles
|
|
actions_essentielles = ['click_anchor', 'type_text']
|
|
for action in actions_essentielles:
|
|
assert action in actions, f"Action {action} non enregistrée"
|
|
|
|
# Tester la création d'instance
|
|
instance = registry.create_action(action, {})
|
|
assert instance is not None, f"Impossible de créer instance {action}"
|
|
|
|
except ImportError as e:
|
|
pytest.skip(f"Registry backend non disponible : {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# Exécuter les tests
|
|
pytest.main([__file__, "-v"])
|