# Comprehensive End-to-End Testing Script for SkyArtShop echo "================================================" echo "SkyArtShop End-to-End Functionality Test" echo "================================================" echo "" # 1. Test service status echo "[1] Testing Service Status..." systemctl is-active --quiet skyartshop && echo "✓ Service is running" || echo "✗ Service is NOT running" echo "" # 2. Test database connection echo "[2] Testing Database Connection..." PGPASSWORD='SkyArt2025Pass!' psql -h localhost -U skyartapp -d skyartshop -c "SELECT COUNT(*) as tables FROM information_schema.tables WHERE table_schema='public';" 2>&1 | grep -E "tables|rows" echo "" # 3. Test web server response echo "[3] Testing Web Server..." HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000) if [ "$HTTP_CODE" = "200" ]; then echo "✓ Homepage responding (HTTP $HTTP_CODE)" else echo "✗ Homepage not responding properly (HTTP $HTTP_CODE)" fi echo "" # 4. Test individual pages echo "[4] Testing Page Endpoints..." for endpoint in "/" "/Shop" "/Portfolio" "/Blog" "/Contact" "/About"; do CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000$endpoint) if [ "$CODE" = "200" ] || [ "$CODE" = "302" ]; then echo " ✓ $endpoint - HTTP $CODE" else echo " ✗ $endpoint - HTTP $CODE" fi done echo "" # 5. Test admin login page echo "[5] Testing Admin Portal..." ADMIN_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/Admin/Login) if [ "$ADMIN_CODE" = "200" ] || [ "$ADMIN_CODE" = "302" ]; then echo "✓ Admin login page accessible (HTTP $ADMIN_CODE)" else echo "✗ Admin login not accessible (HTTP $ADMIN_CODE)" fi echo "" # 6. Test database tables and data echo "[6] Testing Database Tables..." PGPASSWORD='SkyArt2025Pass!' psql -h localhost -U skyartapp -d skyartshop << 'EOF' SELECT tablename as "Table", pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) as "Size" FROM pg_tables WHERE schemaname='public' ORDER BY tablename; EOF echo "" # 7. Check for MongoDB references echo "[7] Checking for MongoDB References..." MONGO_COUNT=$(grep -r "MongoDB" /var/www/SkyArtShop/bin/Release/net8.0/appsettings*.json 2>/dev/null | wc -l) if [ "$MONGO_COUNT" -eq 0 ]; then echo "✓ No MongoDB references found in config files" else echo "✗ Found $MONGO_COUNT MongoDB references" fi echo "" echo "================================================" echo "Test Summary Complete" echo "================================================"