chore: run frontend tests against dev-mode ui

This commit is contained in:
zhi
2026-03-16 16:32:26 +00:00
parent c76c25fb5b
commit 4707f0614c
4 changed files with 31 additions and 9 deletions

View File

@@ -74,6 +74,9 @@ services:
restart: "no" restart: "no"
environment: environment:
VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000} VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000}
VITE_WIZARD_PORT: ${WIZARD_PORT:-8080}
FRONTEND_DEV_MODE: ${FRONTEND_DEV_MODE:-1}
NODE_ENV: development
ports: ports:
- "127.0.0.1:${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}" - "127.0.0.1:${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}"
depends_on: depends_on:

View File

@@ -72,6 +72,9 @@ services:
environment: environment:
# Use internal service name # Use internal service name
VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000} VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000}
VITE_WIZARD_PORT: ${WIZARD_PORT:-8080}
FRONTEND_DEV_MODE: ${FRONTEND_DEV_MODE:-1}
NODE_ENV: development
networks: networks:
- test-network - test-network

View File

@@ -54,28 +54,44 @@ fi
echo "📦 Using compose file: $COMPOSE_FILE" echo "📦 Using compose file: $COMPOSE_FILE"
run_quiet() {
local label="$1"
shift
local log_file
log_file=$(mktemp)
if "$@" >"$log_file" 2>&1; then
rm -f "$log_file"
return 0
fi
echo "${label} failed"
echo "--- ${label} log ---"
tail -n 200 "$log_file"
rm -f "$log_file"
return 1
}
# Clean any previous containers first # Clean any previous containers first
echo "🧹 Cleaning up previous containers..." echo "🧹 Cleaning up previous containers..."
docker compose -f "$COMPOSE_FILE" down -v 2>/dev/null || true docker compose -f "$COMPOSE_FILE" down -v >/dev/null 2>&1 || true
# Build frontend with correct API base URL (force no cache, remove image first) # Build frontend with correct API base URL (force no cache, remove image first)
echo "🔨 Building frontend..." echo "🔨 Building frontend..."
docker rmi harborforge-test-frontend:dev 2>/dev/null || true docker rmi harborforge-test-frontend:dev >/dev/null 2>&1 || true
docker compose -f "$COMPOSE_FILE" build --no-cache --build-arg VITE_API_BASE=http://backend:8000 frontend run_quiet "frontend build" docker compose -f "$COMPOSE_FILE" build --no-cache --build-arg VITE_API_BASE=http://backend:8000 frontend
# Build backend (force no cache, remove image first) # Build backend (force no cache, remove image first)
echo "🔨 Building backend..." echo "🔨 Building backend..."
docker rmi harborforge-test-backend:dev 2>/dev/null || true docker rmi harborforge-test-backend:dev >/dev/null 2>&1 || true
docker compose -f "$COMPOSE_FILE" build --no-cache backend run_quiet "backend build" docker compose -f "$COMPOSE_FILE" build --no-cache backend
# Build test runner (force no cache, remove image first) # Build test runner (force no cache, remove image first)
echo "🔨 Building test runner..." echo "🔨 Building test runner..."
docker rmi harborforge-test-runner:dev 2>/dev/null || true docker rmi harborforge-test-runner:dev >/dev/null 2>&1 || true
docker compose -f "$COMPOSE_FILE" build --no-cache test run_quiet "test runner build" docker compose -f "$COMPOSE_FILE" build --no-cache test
# Start services # Start services
echo "📦 Starting services..." echo "📦 Starting services..."
docker compose -f "$COMPOSE_FILE" up -d run_quiet "service startup" docker compose -f "$COMPOSE_FILE" up -d
# Wait for frontend to be ready # Wait for frontend to be ready
echo "⏳ Waiting for services..." echo "⏳ Waiting for services..."