veza/scripts/setup-mvp-test-env.sh
senke fbf0fe5b9f [TEST] MVP integration tests executed - 2/28 API passed, 0/20 E2E passed, 3 bugs found
- API Tests: 2 passed, 1 failed, 25 skipped (blocked by auth issues)
- E2E Tests: 0 passed, 1 failed (global setup timeout), 19 skipped
- Bugs found: 3 (2 critical, 1 high)
  - BUG-001: Auth register endpoint format issue (CRITICAL)
  - BUG-002: E2E global setup timeout (CRITICAL)
  - BUG-003: Token extraction in test script (HIGH)

Files added:
- MVP_TEST_REPORT.md: Complete test report with bug analysis
- MVP_BUGS_TODOLIST.json: Detailed bug tracking
- scripts/test-mvp-api.sh: API test suite
- scripts/setup-mvp-test-env.sh: Environment setup
- apps/web/e2e/mvp-integration.spec.ts: E2E test suite
- TESTS_MVP_README.md: Complete documentation
2026-01-04 01:44:13 +01:00

143 lines
4 KiB
Bash
Executable file

#!/bin/bash
# ============================================================================
# Script de Setup Environnement pour Tests MVP
# ============================================================================
# Ce script vérifie et configure l'environnement pour les tests MVP
# ============================================================================
set -euo pipefail
# Couleurs
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[✓]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[!]${NC} $1"
}
log_error() {
echo -e "${RED}[✗]${NC} $1"
}
# ============================================================================
# Vérifications
# ============================================================================
check_command() {
if command -v "$1" &> /dev/null; then
log_success "$1 is installed"
return 0
else
log_error "$1 is not installed"
return 1
fi
}
check_service() {
local service=$1
local port=$2
if curl -s "http://localhost:$port" > /dev/null 2>&1; then
log_success "$service is running on port $port"
return 0
else
log_warning "$service is not running on port $port"
return 1
fi
}
# ============================================================================
# Main
# ============================================================================
main() {
echo "============================================================================"
echo "SETUP ENVIRONNEMENT TESTS MVP"
echo "============================================================================"
echo ""
# Vérifier les commandes nécessaires
log_info "Checking required commands..."
check_command "curl" || exit 1
check_command "jq" || log_warning "jq not installed (JSON parsing may fail)"
check_command "node" || log_warning "node not installed (frontend tests may fail)"
check_command "npm" || log_warning "npm not installed (frontend tests may fail)"
check_command "go" || log_warning "go not installed (backend tests may fail)"
echo ""
# Vérifier les services
log_info "Checking services..."
BACKEND_RUNNING=false
FRONTEND_RUNNING=false
if check_service "Backend" 8080; then
BACKEND_RUNNING=true
fi
if check_service "Frontend" 5173; then
FRONTEND_RUNNING=true
elif check_service "Frontend" 3000; then
FRONTEND_RUNNING=true
fi
echo ""
# Instructions
if [ "$BACKEND_RUNNING" = false ]; then
log_warning "Backend is not running. Start it with:"
echo " cd veza-backend-api"
echo " go run cmd/api/main.go"
echo " # OR"
echo " go run cmd/server/main.go"
echo ""
fi
if [ "$FRONTEND_RUNNING" = false ]; then
log_warning "Frontend is not running. Start it with:"
echo " cd apps/web"
echo " npm install"
echo " npm run dev"
echo ""
fi
# Variables d'environnement
log_info "Setting up environment variables..."
export API_URL="${API_URL:-http://localhost:8080/api/v1}"
export FRONTEND_URL="${FRONTEND_URL:-http://localhost:5173}"
export TEST_EMAIL="test-$(date +%s)@example.com"
export TEST_PASSWORD="TestPassword123!"
export TEST_USERNAME="testuser_$(date +%s)"
log_success "Environment variables set:"
echo " API_URL=$API_URL"
echo " FRONTEND_URL=$FRONTEND_URL"
echo " TEST_EMAIL=$TEST_EMAIL"
echo " TEST_USERNAME=$TEST_USERNAME"
echo ""
if [ "$BACKEND_RUNNING" = true ] && [ "$FRONTEND_RUNNING" = true ]; then
log_success "Environment is ready for testing!"
echo ""
echo "Run tests with:"
echo " ./scripts/test-mvp-api.sh"
echo " cd apps/web && npm run test:e2e -- e2e/mvp-integration.spec.ts"
else
log_warning "Some services are not running. Please start them before running tests."
fi
}
main