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:
38
tests/unit/test_screen_signature.py
Normal file
38
tests/unit/test_screen_signature.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from datetime import datetime
|
||||
from core.execution.screen_signature import screen_signature
|
||||
from core.models.screen_state import ScreenState, RawLevel, PerceptionLevel, ContextLevel, WindowContext, EmbeddingRef
|
||||
from core.models.ui_element import UIElement, UIElementEmbeddings, VisualFeatures
|
||||
|
||||
def E(eid, role, bbox, label="", etype="ui"):
|
||||
return UIElement(
|
||||
element_id=eid, type=etype, role=role, bbox=bbox,
|
||||
center=(bbox[0]+bbox[2]//2, bbox[1]+bbox[3]//2),
|
||||
label=label, label_confidence=1.0,
|
||||
embeddings=UIElementEmbeddings(image=None, text=None),
|
||||
visual_features=VisualFeatures(dominant_color="n/a", has_icon=False, shape="rectangle", size_category="medium"),
|
||||
confidence=0.9, tags=[], metadata={}
|
||||
)
|
||||
|
||||
def S(elements, title):
|
||||
return ScreenState(
|
||||
screen_state_id="s",
|
||||
timestamp=datetime.now(),
|
||||
session_id="sess",
|
||||
window=WindowContext(app_name="app", window_title=title, screen_resolution=[1920,1080]),
|
||||
raw=RawLevel(screenshot_path="x", capture_method="test", file_size_bytes=1),
|
||||
perception=PerceptionLevel(embedding=EmbeddingRef(provider="p", vector_id="v", dimensions=1),
|
||||
detected_text=[], text_detection_method="none", confidence_avg=0.0),
|
||||
context=ContextLevel(),
|
||||
ui_elements=elements
|
||||
)
|
||||
|
||||
def test_layout_signature_robust_to_text_variations():
|
||||
ui1 = [E("a", "label", (100,100,120,20), "Username"), E("b", "input", (240,95,260,30), "", "text_input")]
|
||||
ui2 = [E("a2", "label", (102,98,120,20), "USER\u00A0NAME"), E("b2", "input", (242,96,260,30), "", "text_input")]
|
||||
|
||||
s1 = S(ui1, "Login")
|
||||
s2 = S(ui2, " LOGIN ")
|
||||
|
||||
sig1 = screen_signature(s1, ui1, mode="layout")
|
||||
sig2 = screen_signature(s2, ui2, mode="layout")
|
||||
assert sig1 == sig2
|
||||
Reference in New Issue
Block a user