#!/usr/bin/env bash # Espera API y Vite levantados en el host (tras docker compose), para E2E en CI. set -euo pipefail BACKEND_MAX_SEC="${BACKEND_MAX_SEC:-600}" FRONTEND_MAX_SEC="${FRONTEND_MAX_SEC:-300}" i=0 while true; do if curl -fsS "http://localhost:8000/api/health" >/dev/null 2>&1; then echo "== stack: backend listo ==" break fi i=$((i + 2)) if [ "$i" -ge "$BACKEND_MAX_SEC" ]; then echo "ERROR: timeout esperando http://localhost:8000/api/health (${BACKEND_MAX_SEC}s)" exit 1 fi sleep 2 done i=0 while true; do if curl -fsS "http://localhost:5173/" >/dev/null 2>&1; then echo "== stack: frontend listo ==" exit 0 fi i=$((i + 2)) if [ "$i" -ge "$FRONTEND_MAX_SEC" ]; then echo "ERROR: timeout esperando http://localhost:5173/ (${FRONTEND_MAX_SEC}s)" exit 1 fi sleep 2 done