diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-10-20 06:56:58 +0200 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-10-20 06:56:58 +0200 |
| commit | f455246fde086dda0cb61b92c84a5146a831a2bf (patch) | |
| tree | 09b5e97ee5f84e495bbd0646e1ad0e3e2fbfb9af /tools/ui_flow.py | |
| parent | 2df98d1ba129f95a10c6b81665671d3b12560c79 (diff) | |
test(codes): compare QR with segno, decode QR dumps and the QR screenshot
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/ui_flow.py')
| -rw-r--r-- | tools/ui_flow.py | 18 |
1 files changed, 17 insertions, 1 deletions
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: |
