#!/bin/bash

# Comprehensive Lektrik Application Test Launcher
echo "🍓 COMPREHENSIVE LEKTRIK APPLICATION TEST"
echo "=========================================="
echo ""
echo "This will test your complete Laravel application workflow:"
echo "✅ Login Process"
echo "✅ Navigation Between Pages" 
echo "✅ Client Creation"
echo "✅ Quote Creation"
echo "✅ Dark Mode Toggle"
echo "✅ Responsive Design"
echo ""

# Check if Laravel server is running
if ! curl -s http://localhost:8000/login > /dev/null; then
    echo "❌ Laravel server not running!"
    echo ""
    echo "Please start it in another terminal:"
    echo "   php artisan serve --host=0.0.0.0 --port=8000"
    echo ""
    exit 1
fi

echo "✅ Laravel server is running"
echo ""

# Check Python environment
if [ ! -d "selenium_env" ]; then
    echo "❌ Selenium environment not found!"
    echo "Please run the setup first."
    exit 1
fi

echo "✅ Python environment ready"
echo ""

echo "🚀 STARTING COMPREHENSIVE TEST..."
echo "You'll see Chrome open and automatically:"
echo "• Login to your application"
echo "• Navigate through all pages"
echo "• Create test clients and quotes"
echo "• Test dark mode and responsive design"
echo "• Show visual progress banners"
echo ""

read -p "Ready to start? (Press Enter to continue or Ctrl+C to cancel)"

# Activate environment and run test
source selenium_env/bin/activate
python3 comprehensive-app-test.py

echo ""
echo "🏁 Comprehensive test completed!"
