summaryrefslogtreecommitdiff
path: root/tools/ui_flow.py
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-20 11:24:58 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-20 11:24:58 +0200
commit1251aab9f8f9f38aa5bdefd4fed1f58236166cf8 (patch)
treed9824a2430cff9f6659a5b14b6e437d6b1568b87 /tools/ui_flow.py
parentd94eb32c80d2dbf00a45d7e69804f8247240a769 (diff)
test(codes): compare Data Matrix and PDF417 with references and decode them, also from screenshots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/ui_flow.py')
-rw-r--r--tools/ui_flow.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/ui_flow.py b/tools/ui_flow.py
index 5428509..eea3e17 100644
--- a/tools/ui_flow.py
+++ b/tools/ui_flow.py
@@ -63,6 +63,8 @@ GYM_CARD = "5901234123457" # source/app/Fixtures.mc: EAN-13 with its check digi
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"
)
+PARCEL_DM = "PARCEL-FAKE-0042-7731" # source/app/Fixtures.mc: Data Matrix
+TICKET_PDF417 = "Boarding pass FAKE 0042 seat 12A" # source/app/Fixtures.mc: PDF417
QR_TIMEOUT_S = 30.0 # the QR is encoded in timer steps the first time
@@ -430,7 +432,8 @@ def flow_lockout(f: Flow) -> None:
def flow_code(f: Flow) -> None:
- """The EAN-13 gym card (index 6) and the QR card (7): their screenshots must decode."""
+ """The EAN-13 gym card (index 6), the QR (7), Data Matrix (8) and PDF417 (9)
+ cards: their screenshots must decode."""
f.act()
f.back() # leave the waiting PIN screen
f.expect("list")
@@ -448,10 +451,20 @@ def flow_code(f: Flow) -> None:
f.act()
f.open_focused_row()
f.expect("code", QR_TIMEOUT_S)
- encoded = f.log.latest(r"DIAG qr_encoded version=(\d+) ms=(\d+)")
+ encoded = f.log.latest(r"DIAG matrix_encoded type=\d+ size=(\S+) 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")
+ print(f"[{f.sim.device_dir.name}] QR {encoded.group(1)} encoded in {encoded.group(2)} ms")
f.shot("code_qr", expect_code=MEMBER_QR)
+ # Data Matrix (8) and PDF417 (9), also encoded as jobs the first time.
+ for name, expected in (("code_datamatrix", PARCEL_DM), ("code_pdf417", TICKET_PDF417)):
+ f.act()
+ f.back()
+ f.expect("list")
+ f.next()
+ f.act()
+ f.open_focused_row()
+ f.expect("code", QR_TIMEOUT_S)
+ f.shot(name, expect_code=expected)
def run_flow(f: Flow) -> None: