#!/usr/bin/env bash
# Run from the checkout whose Metro bundle is loaded, after pairing and seeding.
# Arguments: agent-device session, fresh output directory. PROOF_SCRATCH is the proxy's control directory.
set -euo pipefail
session="$1"
out="$2"
mkdir -p "$out"
ad() { agent-device "$@" --session "$session"; }
# Both gallery pages must already have loaded; return to the large blue page.
touch "$PROOF_SCRATCH/slow"
ad record start "$out/interaction.mp4"
ad click 'label="Media actions"' --settle
ad click 'text="Share"' --settle
ad swipe 950 1200 120 1200
ad click 'label="Media actions"' --settle
ad screenshot "$out/menu-1.png"
ad wait 500
ad screenshot "$out/menu-2.png"
sleep 45
ad snapshot -i
ad screenshot "$out/completion-1.png"
ad wait 500
ad screenshot "$out/completion-2.png"
ad record stop
