From f455246fde086dda0cb61b92c84a5146a831a2bf Mon Sep 17 00:00:00 2001 From: cirakg Date: Tue, 20 Oct 2026 06:56:58 +0200 Subject: test(codes): compare QR with segno, decode QR dumps and the QR screenshot Co-Authored-By: Claude Opus 5.5 --- tools/ui_flow.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tools/ui_flow.py') diff --git a/tools/ui_flow.py b/tools/ui_flow.py index 82e5d65..5428509 100644 --- a/tools/ui_flow.py +++ b/tools/ui_flow.py @@ -60,6 +60,10 @@ WRONG_PIN = "000000" FAILURES_UNTIL_WAIT = 5 # source/storage/Lockout.mc: the 5th failure starts a delay SELECTOR_OK = 10 # source/ui/PinView.mc: selector positions 0-9, then OK GYM_CARD = "5901234123457" # source/app/Fixtures.mc: EAN-13 with its check digit +MEMBER_QR = ( # source/app/Fixtures.mc: a version 6 QR + "https://example.com/member/fake-0042?name=Alice%20Example&card=0000111122223333&valid=2027-12-31&level=gold" +) +QR_TIMEOUT_S = 30.0 # the QR is encoded in timer steps the first time class FlowError(Exception): @@ -426,7 +430,7 @@ def flow_lockout(f: Flow) -> None: def flow_code(f: Flow) -> None: - """The EAN-13 gym card (index 6): its screenshot must decode.""" + """The EAN-13 gym card (index 6) and the QR card (7): their screenshots must decode.""" f.act() f.back() # leave the waiting PIN screen f.expect("list") @@ -436,6 +440,18 @@ def flow_code(f: Flow) -> None: f.open_focused_row() f.expect("code") f.shot("code", expect_code=GYM_CARD) + # The QR card (index 7) is encoded on the watch as a job, then shown. + f.act() + f.back() + f.expect("list") + f.next() + f.act() + f.open_focused_row() + f.expect("code", QR_TIMEOUT_S) + encoded = f.log.latest(r"DIAG qr_encoded version=(\d+) ms=(\d+)") + if encoded is not None: + print(f"[{f.sim.device_dir.name}] QR version {encoded.group(1)} encoded in {encoded.group(2)} ms") + f.shot("code_qr", expect_code=MEMBER_QR) def run_flow(f: Flow) -> None: -- cgit v1.2.3