#!/usr/bin/env python3 # SPDX-License-Identifier: MPL-2.0 """Check core Gaia panels at Nokia size without calling, sending or saving data. These are programmatic UI checks, not a physical keypad qualification. """ import argparse import importlib.util import json from pathlib import Path import time spec=importlib.util.spec_from_file_location('wifi',Path(__file__).with_name('test-beatles-wifi.py')) bridge=importlib.util.module_from_spec(spec);spec.loader.exec_module(bridge) probe=bridge.probe def wait(app,script,seconds=40): deadline=time.monotonic()+seconds while time.monotonic()0;') report['checks'][label]['newContactForm']=True if label=='sms': probe(app,'document.querySelector("#threads-composer-link").click();return true;') wait(app,'return document.querySelector("#messages-recipients-list [contenteditable]")?.getBoundingClientRect().height>0;') report['checks'][label]['recipientComposer']=True # Close only the app just launched, discarding empty unsaved forms. probe('system','const a=Service.query("getActiveApp");if(a?.manifestURL!=='+json.dumps(params['manifestURL'])+')throw Error("Unexpected active app");a.kill();return true;') time.sleep(.5) for value in report['checks'].values(): assert value['width']==240 and value['scrollX']==0,value # Gaia Settings keeps inactive panels offscreen behind an overflow clip. assert value['documentWidth']<=242 or value['overflowX'] in ('hidden','clip'),value control=value['control'] assert control['width']>0 and control['visible'],value assert control['x']>=-1 and control['x']+control['width']<=241,value print(json.dumps(report,indent=2)) finally: probe('system','dispatchEvent(new CustomEvent("home"));return true;') args.output.parent.mkdir(parents=True,exist_ok=True) args.output.write_text(json.dumps(report,indent=2)+'\n') if __name__=='__main__':main()