From 2373b6f02ef027a423762d5d6349cd9e0f36090e Mon Sep 17 00:00:00 2001 From: cirakg Date: Mon, 19 Oct 2026 22:28:09 +0200 Subject: test(ui): drive the simulator with a scripted flow and check every screen tools/ui_flow.py clicks buttons and taps from the device files, waits for DIAG shown lines and compares 10 screens per watch with goldens on four test and three spot-check devices. Adds the fixture-wrap generator, UI logic tests and driver tests; the launcher opens apps from their glance. Co-Authored-By: Claude Opus 5.5 --- docker/scripts/screenshots.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'docker/scripts/screenshots.sh') diff --git a/docker/scripts/screenshots.sh b/docker/scripts/screenshots.sh index 3fc52f5..414af52 100755 --- a/docker/scripts/screenshots.sh +++ b/docker/scripts/screenshots.sh @@ -1,23 +1,25 @@ #!/usr/bin/env bash # Author: cirakg & claude ai -# Summary: Screenshot the app on each device in the headless simulator and compare with the approved golden images. +# Summary: Run the scripted UI flow on each device in the headless simulator and compare every screen with its golden image. # # Usage: screenshots.sh DEVICE [DEVICE ...] (APPROVE=1 saves new goldens) -# Output: build/screenshots/.png (the watch screen only), plus a -# -diff.png when it differs from test/golden/.png. +# Output: build/screenshots//.png (the watch screen only), +# plus -diff.png where a screen differs from +# test/golden//.png. +# +# Uses the UI-test build (uitest.jungle): fake entries, PIN 123456 and a +# frozen clock, so every screenshot is reproducible. tools/ui_flow.py +# drives the app and checks the screens. set -euo pipefail # shellcheck source=ciq-env.sh source "$(dirname "${BASH_SOURCE[0]}")/ciq-env.sh" -# Pause after the first frame, so animations and late redraws settle. -readonly SETTLE_S=1 - (($# > 0)) || die "usage: screenshots.sh DEVICE [DEVICE ...]" ciq_require_sdk ciq_require_key for device in "$@"; do - build-app.sh debug "${device}" + build-app.sh uitest "${device}" done ciq_start_display @@ -29,19 +31,18 @@ approve=() [[ "${APPROVE:-0}" == 1 ]] && approve=(--approve) failed=0 for device in "$@"; do - if ! ciq_launch_app "${device}" "${out}/${device}.log"; then + mkdir -p "${out}/${device}" + log_file="${out}/${device}/app.log" + if ! ciq_launch_app "${device}" "${log_file}" uitest; then ciq_stop_app - log "no first frame on ${device}; see build/screenshots/${device}.log" + log "no first frame on ${device}; see ${log_file}" failed=1 continue fi - sleep "${SETTLE_S}" - mkdir -p "${out}/raw" - import -window "$(ciq_simulator_window)" "${out}/raw/${device}-window.png" + python3 /work/tools/ui_flow.py --device-dir "${CIQ_HOME}/Devices/${device}" --log "${log_file}" \ + --window "$(ciq_simulator_window)" --out "${out}/${device}" --golden "/work/test/golden/${device}" \ + "${approve[@]}" || failed=1 ciq_stop_app - python3 /work/tools/sim_screenshot.py --raw "${out}/raw/${device}-window.png" \ - --device-dir "${CIQ_HOME}/Devices/${device}" --out "${out}/${device}.png" \ - --golden "/work/test/golden/${device}.png" "${approve[@]}" || failed=1 done ((failed == 0)) || die "screenshot checks failed; see build/screenshots/" -- cgit v1.2.3