- Added a new 'E2E (docker compose + Playwright)' stage in the Jenkinsfile to run end-to-end tests using Docker Compose and Playwright. - Updated the 'Test frontend' stage to utilize the Playwright test image and improved error handling for missing files. - Modified Playwright configuration to use an environment variable for the base URL, enhancing flexibility in CI environments. - Expanded TypeScript configuration to include additional test and configuration files for better type checking.
32 lines
837 B
Bash
Executable File
32 lines
837 B
Bash
Executable File
#!/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
|