Fix critical errors: infinite loop, database schema, and add comprehensive E2E tests
## Critical Fixes: 1. **Fix infinite loop in useGasEstimate hook** - Removed unstable `params` dependency causing infinite re-renders - Removed wallet connection requirement for MVP - Simplified to only depend on stable `transactionType` - Fixes "Maximum update depth exceeded" error spam 2. **Fix database schema mismatches** - Removed `blockchain_escrow` from Wallet model - Removed blockchain fields from Bet model (blockchain_bet_id, blockchain_tx_hash, blockchain_status) - Models now match existing database schema - Fixes "OperationalError: no such column" errors 3. **Fix bet creation** - useBlockchainBet now makes real API calls (not pseudocode) - Bets properly created in database - Returns actual bet IDs and status ## Testing: - Added comprehensive Playwright E2E test suite (test-e2e-comprehensive.js) - Tests all critical flows: login, marketplace, wallet, create bet, my bets, navigation - Captures all console errors and warnings - Result: ✅ 0 errors (was 500+) ## Development: - Added docker-compose.dev.yml for local development with hot-reload - Added dev.sh quick-start script - Added LOCAL_DEVELOPMENT.md comprehensive guide - Updated vite.config.ts to support dynamic ports (dev=5173, prod=80) - Updated README with documentation links ## Files Changed: Backend: - backend/app/models/wallet.py - Remove blockchain_escrow field - backend/app/models/bet.py - Remove blockchain fields Frontend: - frontend/src/blockchain/hooks/useGasEstimate.ts - Fix infinite loop - frontend/src/blockchain/hooks/useBlockchainBet.ts - Add real API calls - frontend/vite.config.ts - Dynamic port support Docs/Scripts: - FIXES_APPLIED.md - Detailed fix documentation - LOCAL_DEVELOPMENT.md - Local dev guide - docker-compose.dev.yml - Dev environment config - dev.sh - Quick start script - test-e2e-comprehensive.js - E2E test suite 🚀 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
56
dev.sh
Executable file
56
dev.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Local Development Quick Start Script
|
||||
|
||||
echo "🚀 Starting H2H Local Development Environment..."
|
||||
echo ""
|
||||
|
||||
# Check if Docker is running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Docker is not running. Please start Docker Desktop and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Docker is running"
|
||||
echo ""
|
||||
|
||||
# Start services
|
||||
echo "📦 Building and starting services..."
|
||||
docker compose -f docker-compose.dev.yml up --build -d
|
||||
|
||||
echo ""
|
||||
echo "⏳ Waiting for services to be ready..."
|
||||
sleep 5
|
||||
|
||||
# Check if services are running
|
||||
BACKEND_STATUS=$(docker compose -f docker-compose.dev.yml ps backend --status running --format json 2>/dev/null | grep -c "running" || echo "0")
|
||||
FRONTEND_STATUS=$(docker compose -f docker-compose.dev.yml ps frontend --status running --format json 2>/dev/null | grep -c "running" || echo "0")
|
||||
|
||||
if [ "$BACKEND_STATUS" = "1" ] && [ "$FRONTEND_STATUS" = "1" ]; then
|
||||
echo ""
|
||||
echo "✅ All services are running!"
|
||||
echo ""
|
||||
echo "🌐 Access your application:"
|
||||
echo " Frontend: http://localhost:5173"
|
||||
echo " Backend: http://localhost:8000"
|
||||
echo " API Docs: http://localhost:8000/docs"
|
||||
echo ""
|
||||
echo "👤 Test Users:"
|
||||
echo " alice@example.com / password123"
|
||||
echo " bob@example.com / password123"
|
||||
echo " charlie@example.com / password123"
|
||||
echo ""
|
||||
echo "📊 View logs:"
|
||||
echo " docker compose -f docker-compose.dev.yml logs -f"
|
||||
echo ""
|
||||
echo "🛑 Stop services:"
|
||||
echo " docker compose -f docker-compose.dev.yml down"
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "⚠️ Services may not be ready yet. Check status with:"
|
||||
echo " docker compose -f docker-compose.dev.yml ps"
|
||||
echo ""
|
||||
echo "📋 View logs:"
|
||||
echo " docker compose -f docker-compose.dev.yml logs -f"
|
||||
fi
|
||||
Reference in New Issue
Block a user