import json,re from pathlib import Path from playwright.sync_api import sync_playwright,expect ROOT=Path(__file__).resolve().parent;BASE=re.search(r'Now listening on: (http://127.0.0.1:\d+)',Path('/tmp/mx-ui-final-host.log').read_text()).group(1);rows=[] with sync_playwright() as p: b=p.chromium.launch(channel='chromium',headless=True);page=b.new_page() for width in [1440,390]: page.set_viewport_size({'width':width,'height':844}) for role in ['admin','viewer']: for route,title in [('/','Overview'),('/browse','Browse'),('/apikeys','API keys')]: page.goto(BASE+route+'?principal='+role);page.wait_for_selector('html[data-mx-ready="true"]');expect(page.get_by_role('heading',level=1)).to_have_text(title);expect(page).to_have_title('MXAccess Gateway — '+title) if width<992:page.locator('summary.rail-toggle').click() active=page.locator('nav.side-rail a.active');assert active.count()==1;assert active.get_attribute('href')==route if route=='/apikeys':assert page.get_by_role('button',name='Create API key',exact=True).count()==(1 if role=='admin' else 0) rows.append({'route':route,'title':page.title(),'principal':role,'width':width,'active':active.get_attribute('href')}) b.close() (ROOT/'evidence/mx-final/navigation-destinations.json').write_text(json.dumps(rows,indent=2));print('12 actual destination/principal/width cases passed')