"""Focused long unbroken identifier case for the actual DataTable region.""" import json,sys from pathlib import Path from playwright.sync_api import sync_playwright sys.path.insert(0,'/Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/theme-1.0.0/canary') from browser_zoom import zoom_browser,set_browser_zoom results=[] with sync_playwright() as p: with zoom_browser(p,width=1440,height=1000) as (context,worker): for width,zoom in [(390,1),(1440,2)]: for scheme in ['light','dark']: page=context.new_page();page.set_viewport_size({'width':width,'height':1000});page.emulate_media(reduced_motion='reduce');page.goto('http://127.0.0.1:5201/presentation',wait_until='networkidle');page.evaluate('s=>window.sbTheme.set(s)',scheme) if zoom==2:set_browser_zoom(worker,page,2) region=page.get_by_role('region',name='Synthetic records',exact=True);region.focus();page.keyboard.press('ArrowRight');page.wait_for_function('selector=>document.querySelector(selector).scrollLeft>0',arg='[aria-label="Synthetic records"]') result=region.evaluate('e=>({width:e.clientWidth,scrollWidth:e.scrollWidth,scrollLeft:e.scrollLeft,focused:e===document.activeElement,payloadLength:e.querySelector("tbody td span").textContent.length,font:getComputedStyle(e.querySelector("tbody td span")).fontFamily})');result.update(page.evaluate('({innerWidth,documentScrollWidth:document.documentElement.scrollWidth,DPR:devicePixelRatio})'));result.update({'scheme':scheme,'physicalWidth':width,'zoom':zoom});result['passed']=result['scrollWidth']>result['width'] and result['scrollLeft']>0 and result['focused'] and result['innerWidth']==result['documentScrollWidth'] and result['payloadLength']==221;results.append(result) if zoom==2:set_browser_zoom(worker,page,1) page.close() Path('docs/ui-consistency/evidence/sb07-09/focused-table-overflow.json').write_text(json.dumps({'results':results,'passed':all(r['passed'] for r in results)},indent=2)+'\n');print(results)