8.1 KiB
🧪 Game Testing Checklist
Current Status
All major backend and frontend issues have been resolved:
- ✅ Redis key consistency (gameCode everywhere)
- ✅ Turn system working for authenticated and guest players
- ✅ Gamemaster status preserved through approval workflow
- ✅ All WebSocket event handlers implemented
- ✅ TypeScript compilation successful (0 errors)
- ✅ Auto-navigation from Lobby to GameScreen wired up
🎯 Priority 1: Core Gameplay Flow
Test 1: Game Creation & Joining
-
Create a game (as authenticated user)
- Verify gameCode is generated
- Check that creator becomes gamemaster
- Check console logs for WebSocket connection
-
Join as second player (guest or authenticated)
- Use the gameCode to join
- For private games: Verify pending approval appears
- For public games: Should join immediately
- Check that both players appear in Lobby
-
Gamemaster approval (private games only)
- Gamemaster should see pending players list
- Click "Approve" on pending player
- Verify approved player appears in main players list
- CRITICAL: Check gamemaster still has start button visible
- Check console for
game:player-approvedandgame:stateevents
Test 2: Game Start & Navigation
-
Gamemaster starts game
- Click "Start Game" button in Lobby
- Watch console logs for:
- Backend:
game:startemission - Frontend context: "Setting gameStarted to true"
- Lobby: "gameStarted changed to: true"
- Lobby: "navigating to /game"
- Backend:
- Verify: All players automatically navigate to GameScreen
- Verify: Board renders with all fields
-
Check initial state
- First player in turn order should see "Your turn" indicator
- Other players should see waiting message
- Dice roll button enabled only for current player
Test 3: Turn System
-
First player rolls dice
- Click "Roll Dice" button
- Verify dice animation shows
- Verify player position updates on board
- Check console:
game:dice-rolledevent received
-
Draw card (if enabled after dice roll)
- Card modal should appear with question
- Submit answer
- Check console:
game:card-answeremitted - Verify feedback (correct/incorrect)
-
Position guessing (after correct answer)
- Position guess modal should appear
- Submit position guess
- Check console:
game:position-guessemitted - Verify position update if correct
-
Turn advancement
- After turn completes, verify:
game:turn-changedevent received- Next player gets
game:your-turnevent - Turn indicator updates to show new current player
- Previous player's dice button disabled
- After turn completes, verify:
Test 4: Joker Cards (Gamemaster)
-
Player uses joker card
- When player answers with joker, check gamemaster sees approval request
- Gamemaster should see modal with joker details
-
Gamemaster approves joker
- Click "Approve" button
- Check console:
game:gamemaster-decisionwith decision:'approve' - Verify player receives
game:joker-completeevent - Verify player position updates
- Verify requesting player sees success message
-
Gamemaster rejects joker
- Use joker again, click "Reject" with reason
- Check console:
game:gamemaster-decisionwith decision:'reject' - Verify player receives rejection with reason
- Verify no position update
Test 5: Special Cards
-
Luck card (if drawn)
- Verify
game:luck-consequenceevent - Check position changes (forward/backward)
- Verify extra turn if applicable
- Verify
-
Game end
- Play until a player reaches final position
- Verify
game:endedevent received - Verify winner modal displays
- Check final scores are correct
🎯 Priority 2: Edge Cases
Test 6: Guest vs Authenticated Players
- Create game as authenticated user
- Join as guest (no login, just gameCode + playerName)
- Join as another authenticated user
- Start game and verify all 3 player types can:
- Roll dice
- Draw cards
- Submit answers
- Take turns correctly
- See position updates
Test 7: Reconnection
- Start game with 2+ players
- Refresh browser for one player
- Verify reconnection works:
- GameToken from localStorage is used
- Player rejoins same game room
- Game state syncs correctly
- Player can continue playing
Test 8: Error Handling
-
Invalid gameCode
- Try to join with non-existent code
- Verify error message displays
-
Game already started
- Try to join game that's already in progress
- Verify rejection message
-
Out of turn action
- Player tries to roll dice when it's not their turn
- Verify "It is not your turn" error
🎯 Priority 3: UI/UX Enhancements (Future)
Polish Items
- Add countdown timer for card answers (60s)
- Add countdown timer for joker decisions (120s)
- Smooth animations for player movement
- Sound effects for dice roll, card draw, etc.
- Better winner screen with confetti animation
- Leaderboard/scores display
- Chat messages between players
- Spectator mode for finished games
📊 Console Log Checklist
When testing, watch for these logs to confirm everything works:
Backend Logs (if accessible)
[GameWebSocketService] Broadcasting game:start to game_${gameCode}[StartGamePlayCommandHandler] Game ${gameCode} started successfully[GameWebSocketService] Player ${playerId} rolled dice: ${roll}[GameWebSocketService] Turn changed to player ${nextPlayerId}
Frontend Context Logs
🎮 [GameWebSocketContext] Socket connected to /game namespace🎮 [GameWebSocketContext] Setting gameStarted to true🎮 Game started:(with full data object)🎲 Dice rolled:(when dice roll event received)🎯 Your turn!(when game:your-turn received)🏁 Game ended:(when game:ended received)
Frontend Component Logs
🎮 Lobby: gameStarted changed to: true🎮 Game started, navigating to /game[GameScreen] Mounted and initializing
🐛 Known Issues to Watch For
-
Navigation not happening
- If Lobby doesn't navigate to GameScreen after start
- Check: Is
gameStartedin context actually changing? - Check: Is
goGame()function being called? - Check: React Router navigation working?
-
Gamemaster loses privileges
- After approving/rejecting players
- Check: Is
isGamemasterflag still true in context? - Check: Does gamemaster still see "Start Game" button?
-
Turn validation fails
- "It is not your turn" for everyone
- Check: Is
currentPlayerset in backend game state? - Check: Is
playerIdentifiercorrectly matching turn sequence?
-
Guest players can't play
- Guest player actions ignored
- Check: Is
playerIdentifier = socket.userId || socket.playerNameworking? - Check: Is turn sequence using player names for guests?
🚀 How to Run Tests
-
Start backend:
cd SerpentRace_Backend npm run dev -
Start frontend:
cd SerpentRace_Frontend npm run dev -
Open multiple browser windows/tabs:
- Window 1: Authenticated user (login first)
- Window 2: Guest player (join directly with gameCode)
- Window 3: Another authenticated user or guest
-
Open browser console in all windows (F12)
- Filter for: 🎮, 🎲, 🎯, 🏁 emojis to see game logs
-
Follow test scenarios above and verify each step
✅ Success Criteria
The game is fully functional when:
- ✅ All players can create and join games
- ✅ Gamemaster can approve/reject players (private games)
- ✅ Game start triggers automatic navigation for all players
- ✅ Turn system works correctly (right player can act)
- ✅ All player types (auth + guest) can play
- ✅ Cards system works (draw, answer, validate)
- ✅ Position updates happen smoothly
- ✅ Joker approval workflow works
- ✅ Game ends with correct winner
- ✅ No console errors during gameplay
Last Updated: After fixing all compilation errors and implementing auto-navigation Next Step: Run end-to-end test with 2-3 players to validate everything works