commits
tags
from rpa import desktop_capture, schema
def test_safe_name_sanitizes():
assert desktop_capture._safe_name("knapp ok") == "knapp ok"
for bad in ("../hemligt", "a/b/c", "a\\b", 'a:"*?'):
clean = desktop_capture._safe_name(bad)
assert not any(c in clean for c in '/\\:"*?<>|')
assert desktop_capture._safe_name("bild.png") == "bild" # .png strippas
assert desktop_capture._safe_name("").startswith("bild_") # auto-namn
def test_image_steps_use_image_field_kind():
for t in ("desktop_click_image", "desktop_wait_for_image"):
spec = schema.STEP_BY_TYPE[t]
img = next(f for f in spec["fields"] if f["key"] == "image")
assert img["kind"] == "image"
def test_image_field_kind_does_not_break_validation():
flow = {
"nodes": [{"id": "n1", "type": "desktop_click_image", "image": "knapp.png", "confidence": 0.9}],
"edges": [],
"settings": {},
}
assert schema.validate_graph(flow) == []