Files
rpa_vision_v3/test_proprietes_debug_simple.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

187 lines
6.3 KiB
Python

#!/usr/bin/env python3
"""
Test Simple de Debug des Propriétés VWB
Auteur : Dom, Alice, Kiro - 12 janvier 2026
Ce script teste directement le problème de configuration des outils
en simulant les étapes créées dans l'interface.
"""
import json
import sys
from pathlib import Path
def test_step_type_mapping():
"""Test du mapping des types d'étapes"""
print("🔍 Test du mapping des types d'étapes VWB")
print("=" * 50)
# Types d'étapes qui devraient être reconnus
test_steps = [
{
"id": "step_1",
"type": "navigate_to_url",
"name": "Naviguer vers URL",
"data": {
"parameters": {
"url": "https://example.com"
}
}
},
{
"id": "step_2",
"type": "click_anchor",
"name": "Cliquer sur élément",
"data": {
"isVWBCatalogAction": True,
"vwbActionId": "click_anchor"
}
},
{
"id": "step_3",
"type": "type_text",
"name": "Saisir texte",
"data": {
"isVWBCatalogAction": True,
"vwbActionId": "type_text"
}
},
{
"id": "step_4",
"type": "click",
"name": "Clic standard",
"data": {
"parameters": {
"target": "button"
}
}
}
]
# Configuration des paramètres standard (comme dans StepTypeResolver)
step_parameters_config = {
"click": [
{
"name": "target",
"label": "Élément cible",
"type": "visual",
"required": True
},
{
"name": "clickType",
"label": "Type de clic",
"type": "select",
"options": [
{"value": "left", "label": "Clic gauche"},
{"value": "right", "label": "Clic droit"}
]
}
],
"type": [
{
"name": "target",
"label": "Champ de saisie",
"type": "visual",
"required": True
},
{
"name": "text",
"label": "Texte à saisir",
"type": "text",
"required": True
}
]
}
# Actions VWB connues
known_vwb_actions = [
'click_anchor', 'type_text', 'type_secret', 'wait_for_anchor',
'extract_text', 'screenshot_evidence', 'scroll_to_anchor',
'focus_anchor', 'hotkey', 'navigate_to_url', 'browser_back',
'verify_element_exists', 'verify_text_content'
]
print("📋 Configuration des paramètres standard:")
for step_type, config in step_parameters_config.items():
print(f" - {step_type}: {len(config)} paramètres")
print(f"\n🎯 Actions VWB connues: {len(known_vwb_actions)}")
for action in known_vwb_actions:
print(f" - {action}")
print("\n🧪 Test des étapes:")
print("-" * 30)
for step in test_steps:
step_type = step["type"]
step_data = step.get("data", {})
print(f"\n📝 Étape: {step['name']} (type: {step_type})")
# Détection VWB
is_vwb_flag = step_data.get("isVWBCatalogAction", False)
has_vwb_action_id = bool(step_data.get("vwbActionId"))
is_known_vwb = step_type in known_vwb_actions
is_vwb_action = is_vwb_flag or has_vwb_action_id or is_known_vwb
print(f" 🎯 Détection VWB:")
print(f" - Flag VWB: {is_vwb_flag}")
print(f" - Action ID VWB: {has_vwb_action_id}")
print(f" - Action connue: {is_known_vwb}")
print(f" - EST VWB: {is_vwb_action}")
# Configuration des paramètres
if is_vwb_action:
print(f" ✅ Action VWB détectée - Utilise VWBActionProperties")
print(f" - Action ID: {step_data.get('vwbActionId', step_type)}")
else:
# Vérifier la configuration standard
config = step_parameters_config.get(step_type, [])
print(f" 📋 Configuration standard:")
print(f" - Paramètres trouvés: {len(config)}")
if config:
print(f" - Paramètres disponibles:")
for param in config:
print(f" * {param['name']} ({param['type']}) - {param.get('label', 'Sans label')}")
print(f" ✅ Devrait afficher StandardParametersEditor")
else:
print(f" ❌ PROBLÈME: Aucune configuration trouvée pour le type '{step_type}'")
print(f" - Types disponibles: {list(step_parameters_config.keys())}")
print(f" - Devrait afficher EmptyStateMessage")
print("\n" + "=" * 50)
print("🎯 DIAGNOSTIC:")
# Vérifier les problèmes potentiels
problems = []
# Problème 1: Types VWB non détectés
vwb_steps = [s for s in test_steps if s["type"] in known_vwb_actions]
for step in vwb_steps:
if not step.get("data", {}).get("isVWBCatalogAction"):
problems.append(f"Étape VWB '{step['type']}' sans flag isVWBCatalogAction")
# Problème 2: Types standard sans configuration
standard_steps = [s for s in test_steps if s["type"] not in known_vwb_actions]
for step in standard_steps:
if step["type"] not in step_parameters_config:
problems.append(f"Type standard '{step['type']}' sans configuration de paramètres")
if problems:
print("❌ PROBLÈMES IDENTIFIÉS:")
for i, problem in enumerate(problems, 1):
print(f" {i}. {problem}")
else:
print("✅ Aucun problème détecté dans la logique")
print("\n💡 RECOMMANDATIONS:")
print("1. Vérifier que les étapes VWB ont le flag 'isVWBCatalogAction: true'")
print("2. Vérifier que les types d'étapes correspondent aux clés de stepParametersConfig")
print("3. Ajouter des logs dans le PropertiesPanel pour tracer la résolution")
print("4. Tester avec des étapes réelles créées dans l'interface")
if __name__ == "__main__":
test_step_type_mapping()