"""Remote-only UI regression checks on the authorized onn; captures remain private.""" import argparse,json,pathlib,re,sys,time,xml.etree.ElementTree as ET sys.path.insert(0,str(pathlib.Path(__file__).resolve().parent)) from device import adb,OUT,screenshot results=[] def key(code,count=1): for _ in range(count): adb('shell','input','keyevent',str(code));time.sleep(.22) def snapshot(): adb('shell','uiautomator','dump','/data/local/tmp/kaleido-window.xml') return ET.fromstring(adb('shell','cat','/data/local/tmp/kaleido-window.xml')) def labels(root):return [n.get('text','') for n in root.iter('node') if n.get('text')] def focus(root): n=next((n for n in root.iter('node') if n.get('focused')=='true'),None) if n is None:return '' return n.get('content-desc','') or ' '.join(labels(n)) def wait(check,description,timeout=25): deadline=time.monotonic()+timeout;root=ET.fromstring('') while time.monotonic()