#!/usr/bin/env bash
# Pixel 9, Android API 36, 1080x2424, light theme, French.
# Start on the seeded Review demo thread after selecting French in Settings.
set -euo pipefail
session="$1"
out="$2"
mkdir -p "$out"
ad() { agent-device "$@" --session "$session"; }
still() {
  ad screenshot "$out/$1-a.png"
  sleep 0.5
  ad screenshot "$out/$1-b.png"
  if ! compare -metric AE "$out/$1-a.png" "$out/$1-b.png" null:; then
    ad screenshot "$out/$1-c.png"
    sleep 0.5
    ad screenshot "$out/$1-d.png"
    compare -metric AE "$out/$1-c.png" "$out/$1-d.png" null:
  fi
}
ad record start "$out/flow.mp4"
ad click 'label="Contrôles git"'
ad find text 'Vérifier les modifications' click
ad wait stable 500 10000
ad longpress 300 574 800
ad click 300 688
ad snapshot -i
still selection
ad click 472 2258
ad fill 'label="Laissez un commentaire..."' 'Renommer ceci.'
ad click 'label=Commenter'
ad wait stable 500 10000
still draft
ad click 'label=Remonter'
ad snapshot -i
ad click 'label=Envoyer'
ad wait text 'second fixture turn complete' 30000
still sent
ad record stop
ad click 831 1777
ad wait stable 500 10000
still detail
