All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m33s
- Credits and episode endings open Up Next: the video keeps playing in a top-left mini-player beside the next episode, season and related shows. Play next episode carries the only countdown; any remote press stops it. Left then OK on the video, or Back, returns to the credits. - Wait for the player's final timeline report before reloading Home, so Continue Watching reflects the episode just watched. - Remove the source label above Home's featured title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
132 lines
8.2 KiB
Python
132 lines
8.2 KiB
Python
"""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 await_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()<deadline:
|
|
if f'READY item={item}' in adb('logcat','-d','-s','KaleidoPlayback:I').decode(errors='replace'):time.sleep(1);return
|
|
time.sleep(.5)
|
|
raise AssertionError(f'Playback of {item} never became ready')
|
|
|
|
def controls():
|
|
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
|
|
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset','90000','--ei','testMode','1','--ez','testValidation','true')
|
|
await_ready(7599);key(127);focused('Play')
|
|
screenshot('direct-stream-episode')
|
|
key(4);wait(lambda r:not labels(r),'One Back must hide controls rather than only clearing focus')
|
|
key(23);focused('Play');key(126);time.sleep(6)
|
|
wait(lambda r:not labels(r),'Controls must auto-hide during playback')
|
|
key(4);wait(lambda r:'Continue Watching' in labels(r),'Back must exit hidden player')
|
|
print('PASS one-press Back, OK reveal, timed hide, and exit')
|
|
|
|
def browse():
|
|
launch();key(20)
|
|
if focus(snapshot()) in ('Play','Resume'):key(20)
|
|
wait(lambda r:focus(r) not in ('','Home','Play','Resume'),'Content focus')
|
|
tracing='--trace' in sys.argv
|
|
if tracing:adb('shell','atrace','--async_start','-b','32768','-a','tv.kaleido.app','gfx','view','sched')
|
|
adb('shell','dumpsys','gfxinfo','tv.kaleido.app','reset')
|
|
geometry=[]
|
|
for _ in range(5):
|
|
root=snapshot();node=next(n for n in root.iter('node') if n.get('focused')=='true')
|
|
bounds=list(map(int,re.findall(r'\d+',node.get('bounds'))))
|
|
geometry.append({'focus':focus(root),'bounds':bounds});key(22)
|
|
adb('shell','input','keyevent',*(['KEYCODE_DPAD_RIGHT']*15))
|
|
adb('shell','input','keyevent',*(['KEYCODE_DPAD_UP']*12))
|
|
stats=adb('shell','dumpsys','gfxinfo','tv.kaleido.app','framestats').decode(errors='replace')
|
|
if tracing:(OUT/'browse-regression-atrace.txt').write_bytes(adb('shell','atrace','--async_stop','-a','tv.kaleido.app','gfx','view','sched'))
|
|
(OUT/'browse-framestats.txt').write_text(stats)
|
|
(OUT/'browse-geometry.json').write_text(json.dumps(geometry,indent=2))
|
|
print(json.dumps(geometry),flush=True)
|
|
print('\n'.join(x for x in stats.splitlines() if any(k in x for k in ('Total frames','Janky frames','percentile','Missed Vsync'))),flush=True)
|
|
ys=[r['bounds'][1] for r in geometry]
|
|
assert max(ys)-min(ys)<=3,f'Horizontal navigation moved row vertically by {max(ys)-min(ys)}px'
|
|
print('PASS stable horizontal focus geometry')
|
|
p95=int(re.search(r'95th percentile: (\d+)ms',stats)[1])
|
|
assert p95<40,f'Browsing frame pacing regression: p95={p95}ms (target below 40ms)'
|
|
|
|
def episode():
|
|
from inspect_server import get
|
|
titles=get('/library/metadata/6115/allLeaves').get('Metadata',[])
|
|
item=titles[0];expected=str(titles[1]['ratingKey'])
|
|
adb('shell','am','force-stop','tv.kaleido.app')
|
|
adb('logcat','-c')
|
|
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId',str(item['ratingKey']),'--el','testOffset','90000','--ei','testMode','2','--ez','testValidation','true')
|
|
await_ready(item["ratingKey"]);key(127);focused('Play')
|
|
for _ in range(6):
|
|
if 'Next episode' in focus(snapshot()):break
|
|
key(22)
|
|
focused('Next episode');key(23);time.sleep(5)
|
|
logs=adb('logcat','-d','-t','700','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
|
|
(OUT/'episode-replacement.log').write_text(logs)
|
|
print(logs[-10000:],flush=True)
|
|
assert 'FATAL EXCEPTION' not in logs,'Next episode crashed Android runtime'
|
|
assert adb('shell','pidof','tv.kaleido.app').strip(),'Process exited'
|
|
assert re.search(r'topResumedActivity=.*tv\.kaleido\.app',adb('shell','dumpsys','activity','activities').decode(errors='replace')),'Lost foreground'
|
|
assert 'item='+expected in logs,'Next episode did not become the active player'
|
|
print('PASS next episode replaced player with expected title')
|
|
|
|
def postplay(mode=2):
|
|
from inspect_server import get
|
|
item=get('/library/metadata/7599?includeMarkers=1')['Metadata'][0]
|
|
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
|
|
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset',str(item['duration']-12000),'--ei','testMode',str(mode),'--ez','testValidation','true')
|
|
deadline=time.monotonic()+(90 if mode<=0 else 45)
|
|
while time.monotonic()<deadline:
|
|
time.sleep(1)
|
|
logs=adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
|
|
if 'READY item=8594' in logs or 'FATAL EXCEPTION' in logs:break
|
|
(OUT/'postplay-ended.log').write_text(logs);print(logs[-8000:],flush=True)
|
|
assert 'FATAL EXCEPTION' not in logs,'Episode end crashed'
|
|
assert 'reason=ended' in logs,'Natural end did not open postplay'
|
|
assert 'AUTOPLAY starting next=8594' in logs,'Five-second countdown did not start next episode'
|
|
assert 'READY item=8594' in logs,'Autoplay did not reach READY'
|
|
print('PASS natural end -> five-second countdown -> next episode READY')
|
|
|
|
def credits():
|
|
from inspect_server import get
|
|
item=get('/library/metadata/7599?includeMarkers=1')['Metadata'][0]
|
|
marker=next(m for m in item['Marker'] if m['type']=='credits')
|
|
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
|
|
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset',str(marker['startTimeOffset']+2000),'--ei','testMode','2','--ez','testValidation','true')
|
|
await_ready(7599)
|
|
def log():return adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
|
|
# Automatic credits open Up Next at once; with "Show button" the Skip credits button opens it.
|
|
deadline=time.monotonic()+4
|
|
while time.monotonic()<deadline and 'POSTPLAY focus=play' not in log():time.sleep(.2)
|
|
if 'POSTPLAY focus=play' not in log():
|
|
key(127);focused('Play');key(19);focused('Playback timeline');key(19);focused('Skip credits')
|
|
screenshot('skip-credits-contrast');key(23)
|
|
deadline=time.monotonic()+8
|
|
while time.monotonic()<deadline and 'POSTPLAY focus=play' not in log():time.sleep(.1)
|
|
assert 'POSTPLAY focus=play' in log(),'Up Next initial action never received focus'
|
|
screenshot('up-next')
|
|
key(20) # any press stops the countdown
|
|
time.sleep(6);root=snapshot();found=labels(root)
|
|
assert 'Up next' in found or 'UP NEXT' in found,'Cancellation failed to keep Up Next open'
|
|
assert any(l.startswith('Season ') for l in found),'Season episodes absent'
|
|
assert 'Related shows' in found,'Related shows absent'
|
|
logs=log()
|
|
assert 'AUTOPLAY cancelled' in logs and 'AUTOPLAY starting' not in logs,'Cancelled autoplay still advanced'
|
|
key(4);time.sleep(1)
|
|
assert 'POSTPLAY closed' in log(),'Back did not return to the video'
|
|
(OUT/'postplay-cancel.log').write_text(log())
|
|
print('PASS credits -> Up Next, episode/related rows, any press stops autoplay, Back returns to video')
|
|
|
|
if __name__=='__main__':globals()[sys.argv[1]]()
|