#!/usr/bin/env bash
# Run the systray suites on a build host so no GTK work touches the laptop.
set -euo pipefail

E2E_REMOTE="${E2E_REMOTE:-$HOME/.claude/bin/e2e-remote}"
[[ -x "$E2E_REMOTE" ]] || { echo "run_remote_tests: missing $E2E_REMOTE" >&2; exit 2; }

targets=("tests")
[[ $# -gt 0 ]] && targets=("$@")

exec "$E2E_REMOTE" --key systray-tests -- bash -c '
set -euo pipefail
cd modules/systray
export PYTHONPATH="/usr/lib/python3/dist-packages${PYTHONPATH:+:$PYTHONPATH}"
python3 -m pytest -q "$@"
SYSTRAY_AI_GUI_TESTS=1 ../../scripts/ci-with-test-display.sh \
  python3 -m pytest -q tests/test_gui_alert_dismissal.py
' remote-systray-tests "${targets[@]}"
