#!/bin/bash # Black Canyon Tickets - Ticket Purchasing Test Runner # This script helps run the comprehensive ticket purchasing tests echo "🎟️ Black Canyon Tickets - Ticket Purchasing Test Suite" echo "=======================================================" # Check if development server is running echo "🔍 Checking if development server is running..." if curl -s http://localhost:4321 > /dev/null; then echo "✅ Development server is running at localhost:4321" else echo "❌ Development server is not running!" echo "Please start the server with: npm run dev" echo "Then run this script again." exit 1 fi # Create screenshots directory echo "📁 Creating screenshots directory..." mkdir -p screenshots # Check Playwright installation echo "🔍 Checking Playwright installation..." if npx playwright --version > /dev/null 2>&1; then echo "✅ Playwright is installed" else echo "❌ Playwright is not installed!" echo "Installing Playwright..." npm install -D @playwright/test npx playwright install fi echo "" echo "🚀 Running Ticket Purchasing Tests..." echo "======================================" # Test execution options case "$1" in "integration") echo "Running integration tests only..." npx playwright test test-ticket-purchasing-integration.cjs --reporter=html ;; "comprehensive") echo "Running comprehensive test suite..." npx playwright test test-ticket-purchasing-comprehensive.cjs --reporter=html ;; "data-setup") echo "Running test data setup..." npx playwright test test-data-setup.cjs --reporter=html ;; "ui") echo "Running tests in UI mode..." npx playwright test test-ticket-purchasing-integration.cjs --ui ;; "debug") echo "Running tests in debug mode..." npx playwright test test-ticket-purchasing-integration.cjs --debug ;; "mobile") echo "Running mobile-specific tests..." npx playwright test test-ticket-purchasing-integration.cjs --grep "mobile" --reporter=html ;; "accessibility") echo "Running accessibility tests..." npx playwright test test-ticket-purchasing-integration.cjs --grep "accessibility" --reporter=html ;; *) echo "Running all ticket purchasing tests..." echo "" echo "Available test suites:" echo " ./run-ticket-tests.sh integration - Real app integration tests" echo " ./run-ticket-tests.sh comprehensive - Full test suite with mocks" echo " ./run-ticket-tests.sh data-setup - Test data creation" echo " ./run-ticket-tests.sh ui - Interactive UI mode" echo " ./run-ticket-tests.sh debug - Debug mode" echo " ./run-ticket-tests.sh mobile - Mobile-specific tests" echo " ./run-ticket-tests.sh accessibility - Accessibility tests" echo "" echo "Running integration tests by default..." npx playwright test test-ticket-purchasing-integration.cjs --reporter=html ;; esac # Check test results if [ $? -eq 0 ]; then echo "" echo "✅ Tests completed successfully!" echo "📊 Test report: ./playwright-report/index.html" echo "📸 Screenshots: ./screenshots/" echo "" echo "To view the report:" echo " npx playwright show-report" else echo "" echo "❌ Some tests failed!" echo "📊 Check the report for details: ./playwright-report/index.html" echo "📸 Screenshots captured: ./screenshots/" fi echo "" echo "🔍 Test Summary" echo "===============" echo "Test files created:" echo " • test-ticket-purchasing-comprehensive.cjs - Full test suite with mocks" echo " • test-ticket-purchasing-integration.cjs - Real application tests" echo " • test-data-setup.cjs - Test data management" echo "" echo "Key features tested:" echo " ✓ End-to-end ticket purchasing flow" echo " ✓ Multiple ticket types and quantities" echo " ✓ Mobile responsive design" echo " ✓ Form validation and error handling" echo " ✓ Presale code functionality" echo " ✓ Inventory management and reservations" echo " ✓ Accessibility compliance" echo " ✓ Visual regression testing" echo " ✓ API integration and error handling" echo "" echo "Happy testing! 🎯"