"""On-device regression loops for focus geometry, frame pacing, and episode replacement.""" import sys,time,re,json from device import adb,OUT,screenshot from verify_ui import key,snapshot,focus,labels,wait,focused,launch def sections(): # The splash gates remote input; switch as soon as the first browsing frame is available. # Initialization must remain independent of tab loading on slow servers. adb('shell','am','force-stop','tv.kaleido.app') adb('shell','am','start','-n','tv.kaleido.app/.MainActivity') wait(lambda r:'Home' in labels(r) and all(n.get('content-desc')!='Kaleido starting' for n in r.iter('node')),'Cold-start splash must finish') key(22) wait(lambda r:'Recently released' in labels(r),'Movies must finish loading after a startup tab switch') focused('Movies');screenshot('cold-tabs-fixed') key(22);wait(lambda r:'Next episodes' in labels(r),'TV recommendations must load');focused('TV Shows') key(21);wait(lambda r:'Recently released' in labels(r),'Cached Movies must return');focused('Movies') print('PASS startup tab switch, TV loading, and cached section return') def ready(item,timeout=45): # A pause sent while the player is still preparing is overridden when playback starts. deadline=time.monotonic()+timeout while time.monotonic()