feat: add comprehensive testing mechanism for dashboard features
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 2m0s
Run Tests / Backend Tests (push) Failing after 4m26s
Run Tests / Frontend Tests (push) Failing after 49s
Run Tests / Test Summary (push) Failing after 15s
Run Tests / Backend Tests (pull_request) Failing after 6m9s
Run Tests / Frontend Tests (pull_request) Failing after 3m54s
Run Tests / Test Summary (pull_request) Failing after 15s

- Add smoke test script for post-deployment verification
- Add health monitoring script with Telegram alerts
- Add backend integration tests for conversation tracker API
- Add frontend tests to verify correct API paths
- Update CI/CD workflows to enforce test failures and run smoke tests
- Add comprehensive testing documentation

This testing mechanism will catch issues like the double /api/ prefix bug
before they reach users.
This commit is contained in:
Gan, Jimmy
2026-04-19 21:54:13 +08:00
parent 9b8d7cfb00
commit 01fcb53a3a
8 changed files with 801 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# Monitor dashboard health and send alerts
# Run via cron: */5 * * * * /volume1/repos/nas-tools/scripts/monitor-dashboard-health.sh
PROD_URL="http://nas.jimmygan.com:4000"
DEV_URL="http://nas.jimmygan.com:4001"
ALERT_FILE="/tmp/dashboard-health-alert-sent"
LOG_DIR="/volume1/repos/nas-tools/logs"
# Create log directory if it doesn't exist
mkdir -p "$LOG_DIR"
check_endpoint() {
local url=$1
local name=$2
response=$(curl -s -o /dev/null -w "%{http_code}" "$url/api/health" --max-time 5)
if [ "$response" != "200" ]; then
echo "$(date): ❌ $name health check failed (HTTP $response)"
return 1
fi
echo "$(date): ✅ $name health check passed"
return 0
}
# Check production
if ! check_endpoint "$PROD_URL" "Production"; then
if [ ! -f "$ALERT_FILE" ]; then
# Send alert only once until issue is resolved
/volume1/repos/nas-tools/notify.sh "⚠️ Dashboard Production Health Check Failed - HTTP endpoint not responding"
touch "$ALERT_FILE"
fi
exit 1
fi
# Check dev (non-critical, just log)
if ! check_endpoint "$DEV_URL" "Dev"; then
echo "$(date): ⚠️ Dev dashboard health check failed (non-critical)"
fi
# Clear alert file if checks pass
if [ -f "$ALERT_FILE" ]; then
rm -f "$ALERT_FILE"
/volume1/repos/nas-tools/notify.sh "✅ Dashboard Production Health Restored"
fi
echo "$(date): ✅ All health checks passed"