test(cua): await foreground fixture readiness

This commit is contained in:
creatixchu committed 2026-09-30 13:24:16 +08:00
1 parent c58e90ee1e
commit 9b1494d8d2
1 file changed
+2 -1
@@ -124,7 +124,8 @@ def main():
shutil.copy2(binary, foreground_binary)
pending_foreground = helper.call('getApp', {'selector': str(foreground_binary.parents[2])})
foreground = helper.call('launchApp', {'appHandle': pending_foreground['appHandle']})['pid']
wait_state(lambda state: not state['active'], 'foreground fixture did not take focus')
wait_state(lambda state: foreground_path.exists() and json.loads(foreground_path.read_text()).get('active')
and not state['active'], 'foreground fixture did not take focus')
for number, key, target in [(signal.SIGALRM, 'hidden', owner),
(signal.SIGHUP, 'minimized', {**owner, 'windowId': window_id})]:
os.kill(fixture, number)