diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-10-19 22:28:09 +0200 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-10-19 22:28:09 +0200 |
| commit | 2373b6f02ef027a423762d5d6349cd9e0f36090e (patch) | |
| tree | 7509b0b1905d7c593074bba8ed4c94e30e437604 /docker/scripts/screenshots.sh | |
| parent | 35042ff04ffc50e55ff59a385849442be4429d6b (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'docker/scripts/screenshots.sh')
| -rwxr-xr-x | docker/scripts/screenshots.sh | 31 |
1 files changed, 16 insertions, 15 deletions
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/<DEVICE>.png (the watch screen only), plus a -# <DEVICE>-diff.png when it differs from test/golden/<DEVICE>.png. +# Output: build/screenshots/<DEVICE>/<screen>.png (the watch screen only), +# plus <screen>-diff.png where a screen differs from +# test/golden/<DEVICE>/<screen>.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/" |
