#!/bin/bash # VoxBlog Quick Test Script # This script helps you quickly test the application set -e echo "🚀 VoxBlog Quick Test Script" echo "==============================" echo "" # Colors GREEN='\033[0;32m' BLUE='\033[0;34m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color # Function to print colored output print_step() { echo -e "${BLUE}➜${NC} $1" } print_success() { echo -e "${GREEN}✓${NC} $1" } print_warning() { echo -e "${YELLOW}⚠${NC} $1" } print_error() { echo -e "${RED}✗${NC} $1" } # Check if Docker is running print_step "Checking Docker..." if ! docker info > /dev/null 2>&1; then print_error "Docker is not running. Please start Docker Desktop." exit 1 fi print_success "Docker is running" # Check if docker-compose is available print_step "Checking docker-compose..." if ! command -v docker-compose &> /dev/null; then print_error "docker-compose not found. Please install docker-compose." exit 1 fi print_success "docker-compose is available" # Stop existing containers print_step "Stopping existing containers..." docker-compose down > /dev/null 2>&1 || true print_success "Containers stopped" # Build and start containers print_step "Building and starting containers (this may take a few minutes)..." if docker-compose up -d --build; then print_success "Containers started successfully" else print_error "Failed to start containers" exit 1 fi # Wait for services to be ready print_step "Waiting for services to be ready..." sleep 5 # Check container status print_step "Checking container status..." if docker-compose ps | grep -q "Up"; then print_success "All containers are running" else print_error "Some containers failed to start" docker-compose ps exit 1 fi # Get local IP address print_step "Finding your local IP address..." if [[ "$OSTYPE" == "darwin"* ]]; then # macOS LOCAL_IP=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1) elif [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux LOCAL_IP=$(hostname -I | awk '{print $1}') else # Windows (Git Bash) LOCAL_IP=$(ipconfig | grep "IPv4" | awk '{print $NF}' | head -n 1) fi echo "" echo "==============================" echo -e "${GREEN}✓ Application is ready!${NC}" echo "==============================" echo "" echo "📱 Access URLs:" echo " Desktop: http://localhost:3300" echo " Mobile: http://${LOCAL_IP}:3300" echo "" echo "🔑 Login Password: P!JfChRiaA2Gdnm6iIo8" echo "" echo "📋 Quick Test Checklist:" echo " 1. Open http://localhost:3300 in your browser" echo " 2. Login with the password above" echo " 3. Create a new post" echo " 4. Upload some images (test mobile upload feature)" echo " 5. Generate content with AI (watch live statistics)" echo " 6. Test mobile view (resize browser or use phone)" echo "" echo "📱 Mobile Testing:" echo " 1. Connect your phone to the same WiFi" echo " 2. Open http://${LOCAL_IP}:3300 on your phone" echo " 3. Test image upload from camera/gallery" echo "" echo "🔍 View Logs:" echo " docker-compose logs -f" echo "" echo "🛑 Stop Application:" echo " docker-compose down" echo "" echo "📖 Full Test Guide:" echo " See QUICK_TEST_GUIDE.md" echo "" # Offer to open browser read -p "Open browser now? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then open http://localhost:3300 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then xdg-open http://localhost:3300 2>/dev/null || echo "Please open http://localhost:3300 manually" else start http://localhost:3300 2>/dev/null || echo "Please open http://localhost:3300 manually" fi fi echo "" print_success "Happy testing! 🚀"