← back to Dear Bubbe Nextjs

scripts/run-mobile-tests.sh

66 lines

#!/bin/bash

# Dear Bubbe Mobile Testing Script
# Runs comprehensive mobile tests and generates reports

echo "🚀 Dear Bubbe Mobile Testing Suite"
echo "=================================="
echo "Testing URL: http://45.61.58.125:3011"
echo ""

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Check if Puppeteer is installed
if ! npm list puppeteer > /dev/null 2>&1; then
  echo -e "${YELLOW}⚠️  Puppeteer not found. Installing...${NC}"
  cd /root/Projects/dear-bubbe-nextjs
  npm install puppeteer --no-save
fi

# Check if app is running
echo -n "Checking if Bubbe is online... "
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3011 | grep -q "200"; then
  echo -e "${GREEN}✅ Online${NC}"
else
  echo -e "${RED}❌ Offline${NC}"
  echo "Starting Bubbe..."
  pm2 restart bubbe-ai
  sleep 5
fi

# Run the mobile test suite
echo ""
echo "Running mobile tests..."
echo "----------------------"
cd /root/Projects/dear-bubbe-nextjs
node mobile-test-suite.js

# Check test results
if [ $? -eq 0 ]; then
  echo -e "\n${GREEN}✅ All mobile tests passed!${NC}"
else
  echo -e "\n${YELLOW}⚠️  Some tests failed or had warnings${NC}"
fi

# Display recent test reports
echo ""
echo "Recent test reports:"
echo "-------------------"
ls -lt mobile-test-report-*.html 2>/dev/null | head -5 | while read -r line; do
  echo "  📄 $line"
done

echo ""
echo "Test screenshots saved in: test-screenshots/"
echo ""
echo "To view the latest HTML report, open:"
ls -t mobile-test-report-*.html 2>/dev/null | head -1 | while read -r file; do
  echo "  http://45.61.58.125:3011/$file"
done

echo ""
echo "✅ Mobile testing complete!"