#!/bin/bash

echo "🧪 Testing Instant Changes on Localhost:5000"
echo "=============================================="
echo ""
echo "1. Making a test change to homepage..."

# Backup original
cp /media/pts/Website/SkyArtShop/website/public/home.html /media/pts/Website/SkyArtShop/website/public/home.html.backup 2>/dev/null

# Add a test comment
echo "<!-- Test change at $(date) -->" >> /media/pts/Website/SkyArtShop/website/public/home.html

echo "2. Waiting 1 second..."
sleep 1

echo "3. Checking if change is visible..."
if curl -s http://localhost:5000/home.html | grep "Test change" > /dev/null; then
    echo "✅ SUCCESS! Changes reflect immediately!"
    echo "   Just refresh your browser to see any changes."
else
    echo "❌ Change not detected. May need to restart PM2."
fi

echo ""
echo "4. Restoring original file..."
mv /media/pts/Website/SkyArtShop/website/public/home.html.backup /media/pts/Website/SkyArtShop/website/public/home.html 2>/dev/null

echo ""
echo "✅ Test complete!"
echo ""
echo "To make changes:"
echo "  1. Edit any file in /media/pts/Website/SkyArtShop/website/"
echo "  2. Refresh browser (F5)"
echo "  3. See changes immediately!"
