#!/usr/bin/env bash
# Run on both commits, using that checkout's fresh server and Metro.
# Required: SESSION, ENVIRONMENT_ID, PROJECT_ID. Pair through the project's
# .agents/skills/test-t3-mobile/scripts/pair-client.sh first.
set -euo pipefail
: "${SESSION:?}" "${ENVIRONMENT_ID:?}" "${PROJECT_ID:?}"
language=${1:-English}
guide_label=Guide
case "$language" in
  日本語) guide_label=ガイド ;;
  한국어) guide_label=가이드 ;;
esac
agent-device open com.t3tools.t3code.dev t3code-dev://settings/language --session "$SESSION"
agent-device press "label=\"$language\"" --settle --session "$SESSION"
agent-device open com.t3tools.t3code.dev "t3code-dev://pull-requests/$ENVIRONMENT_ID/$PROJECT_ID/pingdotgg%2Ft3code/43473" --session "$SESSION"
agent-device wait "label=\"$guide_label\"" --session "$SESSION"
agent-device press "label=\"$guide_label\"" --settle --session "$SESSION"
agent-device snapshot -i --session "$SESSION"
# Capture with capture.py after verifying the guide header. It requires two
# identical full-screen pixel captures separated by at least 500 ms.
