#!/usr/bin/env bash
# Run after seed.py, installing the dev client, loading Metro, and pairing the isolated server.
set -euo pipefail
session="$1"
repo="$2"
out="$3"
agent-device press 'label="commit repro, Done"' --session "$session" --settle
agent-device press 'label="Git controls"' --session "$session" --settle
agent-device press 'label="More"' --session "$session" --settle
agent-device press 'label="Commit, 2 files changed"' --session "$session" --settle
agent-device record start "$out.mp4" --session "$session"
agent-device press 'label="beta.ts"' --session "$session" --settle
git -C "$repo" checkout -- beta.ts
agent-device wait text '1 of 1 selected' 60000 --session "$session"
agent-device snapshot -i --session "$session"
agent-device screenshot "$out-check.png" --session "$session"
sleep 0.5
agent-device screenshot "$out.png" --session "$session"
compare -metric AE "$out-check.png" "$out.png" null:
agent-device record stop --session "$session"
# On the fixed side, also press Deselect all, append // changed to beta.ts again,
# and verify 0 of 2 selected with both file rows unchecked while the sheet stays open.
