Kaleido/scripts/verify_details_layout.py
Elijah 784921dba9
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m25s
Release Kaleido 0.1.9 with responsive navigation and clearer show details
2026-10-26 09:57:02 -07:00

39 lines
2.7 KiB
Python

"""Check a fresh show page keeps its Back control and description in the safe area."""
import re
from device import screenshot
from verify_ui import launch,key,focused,wait,focus,labels,snapshot
launch();key(22,2);focused('TV Shows');key(20);focused('Discover');key(22);focused('Library');key(23)
wait(lambda r:any(x.startswith('All genres') for x in labels(r)),'Show library loaded');focused('Library');key(20)
if '3 Body Problem' not in focus(snapshot()):key(21)
focused('3 Body Problem');key(23);focused('Watch next')
root=snapshot();screenshot('show-layout-current')
title=next(n for n in root.iter('node') if n.get('text')=='3 Body Problem')
bounds=list(map(int,re.findall(r'\d+',title.get('bounds'))))
back=next((n for n in root.iter('node') if n.get('content-desc')=='Back'),None)
print('Title bounds:',bounds,'Back visible:',back is not None,flush=True)
assert bounds[1]>=88,'Show title was scrolled above the safe header area on initial focus'
assert back is not None,'Back control must remain visible on initial show entry'
back_bounds=list(map(int,re.findall(r'\d+',back.get('bounds'))))
assert back_bounds[1]>=0 and back_bounds[3]>back_bounds[1],'Back control must stay inside the visible header'
assert 'Seasons' in labels(root),'Seasons must lead the rows beneath show information'
screen=list(map(int,re.findall(r'\d+',root.find('node').get('bounds'))))
captions=[n for n in root.iter('node') if re.fullmatch(r'Season \d+',n.get('text',''))]
assert captions,'Season captions must be visible without scrolling'
for caption in captions:
box=list(map(int,re.findall(r'\d+',caption.get('bounds'))))
assert box[3]<=screen[3]-24,'Season caption must fit inside the bottom safe area'
summary=max((n for n in root.iter('node') if len(n.get('text',''))>120),key=lambda n:len(n.get('text')))
summary_bounds=list(map(int,re.findall(r'\d+',summary.get('bounds'))))
assert summary_bounds[2]-summary_bounds[0]<=screen[2]*560/960+2,'Show synopsis must use the bounded movie-detail text width'
print('PASS safe show header, bounded synopsis, and complete season captions on initial entry')
key(22,2);focused('Synopsis');key(23);focused('Close')
dialog=snapshot();screenshot('show-full-synopsis')
assert summary.get('text') in labels(dialog),'Full synopsis must remain available in the dialog'
key(20);key(19);focused('Close');key(23);focused('Synopsis')
key(23);focused('Close');key(4);focused('Synopsis')
print('PASS full synopsis opens, scrolls, and restores focus after Close or Back')
key(20);focused('Season 1');key(20)
wait(lambda r:'Cast' in labels(r) and bool(focus(r)) and 'Season 1' not in focus(r),'Cast focus beneath Seasons')
screenshot('show-scrolled-cast')
print('PASS Seasons-to-Cast navigation; captured scrolled backdrop for visual review')