"""Capture each implemented mobile frame in its fixed reference state.""" import json, pathlib, subprocess, time, sys root=pathlib.Path(__file__).resolve().parents[1] scenes=json.loads((root/'src/design/scenes.json').read_text()) udid='85638E91-52BB-440F-91F9-35604A771A28' selection=set(json.loads(pathlib.Path(sys.argv[1]).read_text())) if len(sys.argv)>1 else None frames=[s for s in scenes if s['w']==402 and (selection is None or s['id'] in selection)] for i,scene in enumerate(frames): slug=scene['id'].replace(':','-') log=pathlib.Path('/tmp/haptika-mobile-metro.log') offset=log.stat().st_size subprocess.run(['xcrun','simctl','openurl',udid,'haptika-mobile://screen/'+slug+'?preview=1'],check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) deadline=time.time()+12 while time.time()