#!/usr/bin/env bash
set -euo pipefail
# On a leased Pixel 9, Android API 36, disable Chrome in Settings > Apps > All apps.
# Confirm Enable is shown. Load the tested checkout through its Metro server.
# Run this same interaction on base and head, starting on the Chats tab.
: "${SESSION:?Set the leased agent-device session}"
: "${OUTPUT:?Set a new capture directory}"
agent-device press text=Settings --session "$SESSION" --settle
agent-device scroll down 650 --session "$SESSION" --settle
agent-device press text=About --session "$SESSION" --settle
agent-device press 'text="Open source licenses"' --session "$SESSION" --settle
agent-device press 'text="@babel/core"' --session "$SESSION" --settle
agent-device record start "$OUTPUT/url-open.mp4" --session "$SESSION"
agent-device press 'text="Project source"' --session "$SESSION" --settle
agent-device snapshot -i --session "$SESSION"
# The snapshot exposes the LogBox toast as a group. Tap its current ref to expand.
# Base: Uncaught (in promise, id: 0), rejectionTrackingOptions.onUnhandled.
# Head: ExternalUrlOpenError, external-link, https, babel.dev, tryOpenExternalUrl.
agent-device record stop --session "$SESSION"
