#!/bin/bash # Claude Code Web IDE - Implementation Testing Script # This script verifies all implemented features are working correctly echo "=========================================" echo "Claude Code Web IDE - Testing Script" echo "=========================================" echo "" # Colors for output GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Test counters PASSED=0 FAILED=0 WARNINGS=0 # Helper functions print_success() { echo -e "${GREEN}✓ $1${NC}" ((PASSED++)) } print_error() { echo -e "${RED}✗ $1${NC}" ((FAILED++)) } print_warning() { echo -e "${YELLOW}⚠ $1${NC}" ((WARNINGS++)) } print_section() { echo "" echo "=========================================" echo "$1" echo "=========================================" echo "" } # Check if server is running print_section "1. Server Status Check" if curl -s http://localhost:3010/claude/ > /dev/null; then print_success "Server is running on port 3010" else print_error "Server is not running. Start with: node server.js" exit 1 fi # Check authentication endpoint if curl -s http://localhost:3010/claude/api/auth/status | grep -q "authenticated"; then print_success "Authentication API is responding" else print_warning "Authentication API may not be working properly" fi # File structure checks print_section "2. File Structure Verification" FILES=( "public/claude-ide/index.html" "public/claude-ide/ide.js" "public/claude-ide/chat-functions.js" "public/claude-ide/components/monaco-editor.js" "public/claude-ide/components/monaco-editor.css" "public/claude-ide/components/enhanced-chat-input.js" "public/claude-ide/components/enhanced-chat-input.css" "public/claude-ide/components/session-picker.js" "public/claude-ide/components/session-picker.css" ) for file in "${FILES[@]}"; do if [ -f "$file" ]; then print_success "Found: $file" else print_error "Missing: $file" fi done # Code quality checks print_section "3. Code Quality Checks" # Check for console.log statements (should be removed in production) LOG_COUNT=$(grep -r "console.log" public/claude-ide/components/*.js | wc -l) if [ $LOG_COUNT -gt 50 ]; then print_warning "Found $LOG_COUNT console.log statements (consider reducing for production)" else print_success "Console.log statements: $LOG_COUNT (acceptable)" fi # Check for TODO comments TODO_COUNT=$(grep -r "TODO" public/claude-ide/components/*.js | wc -l) if [ $TODO_COUNT -gt 0 ]; then print_warning "Found $TODO_COUNT TODO comments (future work needed)" else print_success "No TODO comments found" fi # Check for Monaco loader in index.html if grep -q "monaco-editor@0.45.0/min/vs/loader.js" public/claude-ide/index.html; then print_success "Monaco Editor loader is properly included" else print_error "Monaco Editor loader not found in index.html" fi # Check for CodeMirror import maps (should be removed) if grep -q "codemirror" public/claude-ide/index.html; then print_error "CodeMirror references still present in index.html (should be removed)" else print_success "No CodeMirror import maps found (correct)" fi # Feature implementation checks print_section "4. Feature Implementation Checks" # Monaco Editor features if grep -q "class MonacoEditor" public/claude-ide/components/monaco-editor.js; then print_success "MonacoEditor class defined" else print_error "MonacoEditor class not found" fi if grep -q "detectMobile()" public/claude-ide/components/monaco-editor.js; then print_success "Monaco mobile detection implemented" else print_error "Monaco mobile detection missing" fi if grep -q "saveFile()" public/claude-ide/components/monaco-editor.js; then print_success "Monaco file save functionality implemented" else print_error "Monaco file save missing" fi # Enhanced Chat Input features if grep -q "class EnhancedChatInput" public/claude-ide/components/enhanced-chat-input.js; then print_success "EnhancedChatInput class defined" else print_error "EnhancedChatInput class not found" fi if grep -q "getDraftKey()" public/claude-ide/components/enhanced-chat-input.js; then print_success "Session-aware draft storage implemented" else print_error "Session-aware draft storage missing" fi if grep -q "setupKeyboardDetection()" public/claude-ide/components/enhanced-chat-input.js; then print_success "Mobile keyboard detection implemented" else print_error "Mobile keyboard detection missing" fi if grep -q "calculateMaxLines()" public/claude-ide/components/enhanced-chat-input.js; then print_success "Dynamic max-lines calculation implemented" else print_error "Dynamic max-lines calculation missing" fi # Session Picker features if grep -q "class SessionPicker" public/claude-ide/components/session-picker.js; then print_success "SessionPicker class defined" else print_error "SessionPicker class not found" fi if grep -q "URLSearchParams" public/claude-ide/components/session-picker.js; then print_success "URL parameter handling implemented" else print_error "URL parameter handling missing" fi # WebSocket state management if grep -q "window.messageQueue" public/claude-ide/ide.js; then print_success "WebSocket message queue implemented" else print_error "WebSocket message queue missing" fi if grep -q "queueMessage" public/claude-ide/chat-functions.js; then print_success "Message queue integration in chat functions" else print_error "Message queue integration missing" fi # Session forking API if grep -q "POST.*sessions/:id/fork" server.js; then print_success "Session forking API endpoint implemented" else print_error "Session forking API endpoint missing" fi # CSS checks print_section "5. CSS Styling Checks" CSS_FILES=( "public/claude-ide/components/monaco-editor.css" "public/claude-ide/components/enhanced-chat-input.css" "public/claude-ide/components/session-picker.css" ) for css_file in "${CSS_FILES[@]}"; do if [ -f "$css_file" ]; then LINE_COUNT=$(wc -l < "$css_file") print_success "$css_file ($LINE_COUNT lines)" else print_error "Missing CSS: $css_file" fi done # Check for queued message indicator if grep -q "queued-message-indicator" public/claude-ide/components/enhanced-chat-input.css; then print_success "Queued message indicator styles defined" else print_error "Queued message indicator styles missing" fi # Check for mobile responsive breakpoints if grep -q "@media.*max-width.*640px" public/claude-ide/components/enhanced-chat-input.css; then print_success "Mobile responsive breakpoints defined" else print_warning "Mobile responsive breakpoints may be missing" fi # API endpoint checks print_section "6. API Endpoint Verification" # Test sessions list endpoint if curl -s http://localhost:3010/claude/api/claude/sessions -H "Cookie: connect.sid=test" > /dev/null 2>&1; then print_success "Sessions API endpoint exists (may require auth for full test)" else print_warning "Sessions API endpoint not accessible (requires authentication)" fi # Server code quality print_section "7. Server Code Quality" if grep -q "app.post.*sessions/:id/fork" server.js; then print_success "Fork endpoint uses POST method (correct)" else print_error "Fork endpoint may not use correct HTTP method" fi if grep -q "requireAuth" server.js | grep -q "fork"; then print_success "Fork endpoint requires authentication" else print_warning "Fork endpoint authentication check may be missing" fi # Database integration if grep -q "INSERT INTO sessions" server.js | grep -q "fork"; then print_success "Forked sessions stored in database" else print_warning "Database integration for forked sessions may be missing" fi # Summary print_section "Test Summary" echo "Passed: $PASSED" echo "Failed: $FAILED" echo "Warnings: $WARNINGS" echo "" if [ $FAILED -eq 0 ]; then echo -e "${GREEN}All critical tests passed!${NC}" echo "" echo "Next steps:" echo "1. Open http://localhost:3010/claude/ in your browser" echo "2. Login with admin / !@#\$q1w2e3r4!A" echo "3. Complete the manual testing checklist in IMPLEMENTATION_SUMMARY.md" echo "4. Take screenshot proofs of all working features" exit 0 else echo -e "${RED}Some tests failed. Please review the errors above.${NC}" exit 1 fi