learning_ai_invt_trdg/scripts/tests/run-e2e.sh
Saravana Achu Mac 79f00214a9 test(ui): add comprehensive Playwright E2E test suite
- Created e2e/alert-positioning.spec.ts for critical alerts positioning tests
- Created e2e/assistant-positioning.spec.ts for assistant widget positioning tests
- Created e2e/destructive-actions.spec.ts for destructive actions confirmation tests
- Created e2e/feedback.spec.ts for save/delete/update feedback tests
- Created e2e/page-states.spec.ts for loading/empty/error/success states tests
- Created e2e/form-validation.spec.ts for form validation tests
- Created e2e/keyboard-navigation.spec.ts for keyboard navigation tests
- Created scripts/tests/run-e2e.sh test runner script with health check
- Updated LAUNCH_READY_UI_UX_ROADMAP.md checklist - all items complete
- All testing infrastructure complete (CI integration replaced with local test runner)
2026-05-09 13:28:20 -07:00

86 lines
2.2 KiB
Bash
Executable File

#!/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