#!/bin/bash set -e # Test runner script for E2E tests # Runs Playwright tests, builds reports, and checks health SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" WEB_DIR="$PROJECT_ROOT/web" cd "$WEB_DIR" echo "=========================================" echo "E2E Test Runner" echo "=========================================" echo "Project root: $PROJECT_ROOT" echo "Web directory: $WEB_DIR" echo "=========================================" # Check if node_modules exists if [ ! -d "node_modules" ]; then echo "Installing dependencies..." pnpm install fi # Check if Playwright is installed if ! command -v npx playwright &> /dev/null; then echo "Playwright not found, installing browsers..." pnpm exec playwright install chromium fi # Create reports directory mkdir -p playwright-report mkdir -p test-results echo "" echo "Running E2E tests..." echo "=========================================" # Run Playwright tests with HTML report pnpm exec playwright test \ --reporter=html \ --reporter=list \ --output=playwright-report/test-results.html TEST_EXIT_CODE=$? echo "" echo "=========================================" echo "Test Results" echo "=========================================" if [ $TEST_EXIT_CODE -eq 0 ]; then echo "✅ All tests passed" else echo "❌ Some tests failed" fi echo "" echo "Report location: $WEB_DIR/playwright-report/index.html" echo "=========================================" # Check health echo "" echo "Checking application health..." echo "=========================================" # Check if the dev server is running if curl -s http://localhost:3050 > /dev/null; then echo "✅ Application is running on http://localhost:3050" else echo "⚠️ Application is not running on http://localhost:3050" echo "Start it with: cd web && pnpm dev -- -p 3050" fi echo "" echo "=========================================" echo "Summary" echo "=========================================" echo "Tests run: Complete" echo "Report: $WEB_DIR/playwright-report/index.html" echo "Health check: Complete" echo "=========================================" exit $TEST_EXIT_CODE