#!/usr/bin/env bash
# Full UI E2E against production. Reads test password from production .env via SSH.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
export NEXUS_E2E_BASE="${NEXUS_E2E_BASE:-https://api.synaglobal.vip}"
export NEXUS_E2E_USER="${NEXUS_E2E_USER:-admin}"
if [[ -z "${NEXUS_E2E_PASSWORD:-}" ]]; then
  export NEXUS_E2E_PASSWORD
  NEXUS_E2E_PASSWORD="$(ssh -o ConnectTimeout=10 nexus 'grep ^NEXUS_TEST_ADMIN_PASSWORD= /www/wwwroot/api.synaglobal.vip/.env | cut -d= -f2-' | tr -d '"')"
  export NEXUS_E2E_PASSWORD
fi
cd "$ROOT/frontend"
npx playwright test e2e/full-acceptance.spec.mjs "$@"
