#!/usr/bin/env bash
# Run from the checkout being examined, with a paired Android dev client showing
# the seeded "Branches repro" thread. Use a different output directory per run.
set -euo pipefail
session="$1"
output="$2"
side="$3"
ad() { agent-device "$@" --session "$session"; }
ad press 'label="Git controls"' --settle
ad press 'text="More"' --settle
ad press 'text="Branches & worktrees"' --settle
ad wait 'text="Existing branches"'
ad scroll bottom --settle
ad record start "$output/$side-scroll.mp4" --hide-touches
ad scroll up 0.4 --settle
ad scroll bottom --settle
ad record stop
ad screenshot "$output/$side-bottom.png"
if [ "$side" = head ]; then
  ad record start "$output/head-pagination.mp4" --hide-touches
  ad press 'text="Load more"' --settle
  ad scroll bottom --settle
  ad record stop
  ad screenshot "$output/head-last.png"
  ad press 'text="feature/branch-104"' --settle
fi
