test(cua): raise and observe the selected native hover window

This commit is contained in:
creatixchu committed 2026-10-13 11:31:09 +08:00
1 parent 5ae8ba49db
commit ac9eebafdf
2 files changed
+6

No files matched your search

@@ -181,6 +181,11 @@ def main():
def check_hover():
call("activate", owner)
current = call("getState", primary_params)
window_element = next(element for element in current["elements"] if element["role"] == "AXWindow")
call("performSecondaryAction", {**owner, "snapshotId": current["snapshotId"],
"elementIndex": window_element["index"], "action": "raise"})
call("getState", primary_params)
x, y, width, height = json.loads(state_path.read_text())["dragBounds"]
call("hover", {**owner, "windowId": primary["windowId"], "x": x + 20, "y": y + 20})
wait_state(lambda actual: actual["hoverVisible"], "AppKit tracking area did not reveal hover controls")
@@ -125,6 +125,7 @@ def main():
(args.artifacts / 'fixture-state.json').write_text(state_path.read_text())
def hover_sequence():
state = observe()
window = next(window for window in state['windows'] if window['windowId'] == window_id)
trigger = next(element for element in state['elements'] if element['role'] == 'AXButton' and
'Reveal hover details' in (element.get('title') or element.get('description') or ''))
before = json.loads(state_path.read_text())