#!/bin/bash # اختبار شامل وإصلاح مشكلة الشاشة السوداء set -e # الألوان GREEN='\033[0;32m' BLUE='\033[0;34m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' echo -e "${BLUE}" echo "==========================================" echo " 🔍 اختبار شامل وإصلاح Frontend" echo " 🧪 Comprehensive Frontend Testing & Fix" echo "==========================================" echo -e "${NC}" # 1. اختبار الواجهة الأمامية echo -e "${YELLOW}1. اختبار الواجهة الأمامية...${NC}" FRONTEND_RESPONSE=$(curl -s -w "%{http_code}" https://cursor-ide.pages.dev -o /dev/null) echo "Frontend Status Code: $FRONTEND_RESPONSE" if [ "$FRONTEND_RESPONSE" = "200" ]; then echo -e "${GREEN}✅ الواجهة الأمامية تعمل${NC}" else echo -e "${RED}❌ مشكلة في الواجهة الأمامية${NC}" fi # 2. اختبار الباكيند echo -e "${YELLOW}2. اختبار الباكيند...${NC}" BACKEND_RESPONSE=$(curl -s -w "%{http_code}" https://cursor-backend.workers.dev/health -o /dev/null) echo "Backend Status Code: $BACKEND_RESPONSE" if [ "$BACKEND_RESPONSE" = "200" ]; then echo -e "${GREEN}✅ الباكيند يعمل${NC}" else echo -e "${RED}❌ مشكلة في الباكيند${NC}" fi # 3. اختبار APIs echo -e "${YELLOW}3. اختبار APIs...${NC}" API_RESPONSE=$(curl -s -w "%{http_code}" https://cursor-backend.workers.dev/api/providers -o /dev/null) echo "API Status Code: $API_RESPONSE" if [ "$API_RESPONSE" = "200" ]; then echo -e "${GREEN}✅ APIs تعمل${NC}" else echo -e "${RED}❌ مشكلة في APIs${NC}" fi # 4. فحص محتوى الواجهة echo -e "${YELLOW}4. فحص محتوى الواجهة...${NC}" FRONTEND_CONTENT=$(curl -s https://cursor-ide.pages.dev | head -20) echo "Frontend Content Preview:" echo "$FRONTEND_CONTENT" # 5. فحص JavaScript errors echo -e "${YELLOW}5. فحص JavaScript errors...${NC}" cd frontend # بناء التطبيق echo -e "${YELLOW}بناء التطبيق...${NC}" npm run build # فحص ملفات البناء echo -e "${YELLOW}فحص ملفات البناء...${NC}" ls -la dist/ # فحص index.html echo -e "${YELLOW}فحص index.html...${NC}" if [ -f "dist/index.html" ]; then echo -e "${GREEN}✅ index.html موجود${NC}" head -10 dist/index.html else echo -e "${RED}❌ index.html غير موجود${NC}" fi # فحص JavaScript files echo -e "${YELLOW}فحص JavaScript files...${NC}" JS_FILES=$(find dist -name "*.js" | head -5) if [ -n "$JS_FILES" ]; then echo -e "${GREEN}✅ JavaScript files موجودة${NC}" echo "$JS_FILES" else echo -e "${RED}❌ JavaScript files غير موجودة${NC}" fi # فحص CSS files echo -e "${YELLOW}فحص CSS files...${NC}" CSS_FILES=$(find dist -name "*.css" | head -5) if [ -n "$CSS_FILES" ]; then echo -e "${GREEN}✅ CSS files موجودة${NC}" echo "$CSS_FILES" else echo -e "${RED}❌ CSS files غير موجودة${NC}" fi # 6. إنشاء ملف اختبار بسيط echo -e "${YELLOW}6. إنشاء ملف اختبار بسيط...${NC}" cat > dist/test.html << 'EOF'
AI-Powered Development Environment
This is a test page to verify the frontend is working
Backend: https://cursor-backend.workers.dev
Frontend: https://cursor-ide.pages.dev
Test Page: https://cursor-ide.pages.dev/test.html