Restructured project from nested workspace pattern to flat single-repo layout. This eliminates redundant nesting and consolidates all project files under version control. ## Migration Summary **Before:** ``` alex/ (workspace, not versioned) ├── chess-game/ (git repo) │ ├── js/, css/, tests/ │ └── index.html └── docs/ (planning, not versioned) ``` **After:** ``` alex/ (git repo, everything versioned) ├── js/, css/, tests/ ├── index.html ├── docs/ (project documentation) ├── planning/ (historical planning docs) ├── .gitea/ (CI/CD) └── CLAUDE.md (configuration) ``` ## Changes Made ### Structure Consolidation - Moved all chess-game/ contents to root level - Removed redundant chess-game/ subdirectory - Flattened directory structure (eliminated one nesting level) ### Documentation Organization - Moved chess-game/docs/ → docs/ (project documentation) - Moved alex/docs/ → planning/ (historical planning documents) - Added CLAUDE.md (workspace configuration) - Added IMPLEMENTATION_PROMPT.md (original project prompt) ### Version Control Improvements - All project files now under version control - Planning documents preserved in planning/ folder - Merged .gitignore files (workspace + project) - Added .claude/ agent configurations ### File Updates - Updated .gitignore to include both workspace and project excludes - Moved README.md to root level - All import paths remain functional (relative paths unchanged) ## Benefits ✅ **Simpler Structure** - One level of nesting removed ✅ **Complete Versioning** - All documentation now in git ✅ **Standard Layout** - Matches open-source project conventions ✅ **Easier Navigation** - Direct access to all project files ✅ **CI/CD Compatible** - All workflows still functional ## Technical Validation - ✅ Node.js environment verified - ✅ Dependencies installed successfully - ✅ Dev server starts and responds - ✅ All core files present and accessible - ✅ Git repository functional ## Files Preserved **Implementation Files:** - js/ (3,517 lines of code) - css/ (4 stylesheets) - tests/ (87 test cases) - index.html - package.json **CI/CD Pipeline:** - .gitea/workflows/ci.yml - .gitea/workflows/release.yml **Documentation:** - docs/ (12+ documentation files) - planning/ (historical planning materials) - README.md **Configuration:** - jest.config.js, babel.config.cjs, playwright.config.js - .gitignore (merged) - CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
13 KiB
Chess Game Test Specifications
Test Case Catalog
This document provides detailed test case specifications for the HTML chess game.
1. Chess Rules Testing
1.1 Pawn Movement
TC-PAWN-001: Initial Two-Square Move
Priority: Critical Type: Unit Test
Preconditions:
- Board in initial position
- No pieces blocking pawn path
Test Steps:
- Select white pawn on e2
- Attempt to move to e4
- Verify move is legal
- Verify pawn moves to e4
- Verify turn switches to black
Expected Result: Pawn moves two squares forward from initial position
Test Data:
{
from: 'e2',
to: 'e4',
piece: 'pawn',
color: 'white',
expectedValid: true
}
TC-PAWN-002: En Passant Capture
Priority: High Type: Integration Test
Preconditions:
- White pawn on e5
- Black pawn moves from d7 to d5 (two-square advance)
Test Steps:
- Move white pawn from e5 to d6 (diagonal)
- Verify move is legal (en passant)
- Verify black pawn on d5 is captured
- Verify white pawn is on d6
Expected Result: En passant capture executed correctly
Test Data:
{
setup: 'rnbqkbnr/ppp1pppp/8/3pP3/8/8/PPPP1PPP/RNBQKBNR w KQkq d6 0 1',
move: { from: 'e5', to: 'd6' },
capturedPiece: { square: 'd5', piece: 'pawn', color: 'black' }
}
TC-PAWN-003: Promotion
Priority: Critical Type: Unit Test
Preconditions:
- White pawn on a7
- Black king on h8
- White's turn
Test Steps:
- Move white pawn from a7 to a8
- Verify promotion dialog appears
- Select Queen as promotion piece
- Verify pawn is replaced with Queen
- Verify Queen is on a8
Expected Result: Pawn promotes to selected piece
Test Data:
{
from: 'a7',
to: 'a8',
promotionPiece: 'queen',
expectedPiece: 'queen',
expectedColor: 'white'
}
1.2 Knight Movement
TC-KNIGHT-001: L-Shaped Movement
Priority: Critical Type: Unit Test
Test Steps:
- Place knight on d4
- Test all 8 possible L-shaped moves
- Verify only valid squares are: c2, e2, f3, f5, e6, c6, b5, b3
Expected Result: Knight moves in L-shape pattern
Test Data:
{
position: 'd4',
validMoves: ['c2', 'e2', 'f3', 'f5', 'e6', 'c6', 'b5', 'b3'],
invalidMoves: ['d5', 'e4', 'c4', 'd3']
}
TC-KNIGHT-002: Jump Over Pieces
Priority: High Type: Unit Test
Preconditions:
- Knight on b1
- Pawn on c3, d2
Test Steps:
- Move knight from b1 to c3
- Verify knight can jump over pawn on d2
Expected Result: Knight jumps over pieces successfully
1.3 Bishop Movement
TC-BISHOP-001: Diagonal Movement
Priority: Critical Type: Unit Test
Test Steps:
- Place bishop on d4
- Verify can move to any diagonal square (a1, b2, c3, e5, f6, g7, h8, c5, b6, a7, e3, f2, g1)
- Verify cannot move to non-diagonal squares
Expected Result: Bishop moves only diagonally
TC-BISHOP-002: Blocked Path
Priority: High Type: Unit Test
Preconditions:
- Bishop on c1
- Pawn on d2
Test Steps:
- Attempt to move bishop from c1 to e3
- Verify move is illegal (blocked by d2 pawn)
Expected Result: Bishop cannot jump over pieces
1.4 Rook Movement
TC-ROOK-001: Straight Line Movement
Priority: Critical Type: Unit Test
Test Steps:
- Place rook on d4
- Verify can move to any square on rank 4 or file d
- Verify cannot move diagonally
Expected Result: Rook moves horizontally or vertically
1.5 Queen Movement
TC-QUEEN-001: Combined Movement
Priority: Critical Type: Unit Test
Test Steps:
- Place queen on d4
- Verify can move like bishop (diagonally)
- Verify can move like rook (straight lines)
Expected Result: Queen combines rook and bishop movement
1.6 King Movement
TC-KING-001: One Square Movement
Priority: Critical Type: Unit Test
Test Steps:
- Place king on e4
- Verify can move one square in any direction
- Verify cannot move two squares (except castling)
Expected Result: King moves one square at a time
TC-KING-002: Castling Kingside
Priority: Critical Type: Integration Test
Preconditions:
- King on e1, Rook on h1
- No pieces between king and rook
- King and rook haven't moved
- King not in check
Test Steps:
- Move king from e1 to g1 (castling move)
- Verify king moves to g1
- Verify rook moves from h1 to f1
Expected Result: Castling executed correctly
Test Data:
{
fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQK2R w KQkq - 0 1',
kingMove: { from: 'e1', to: 'g1' },
rookMove: { from: 'h1', to: 'f1' }
}
TC-KING-003: Cannot Castle Through Check
Priority: High Type: Integration Test
Preconditions:
- King on e1, Rook on h1
- Black rook on f8 (attacking f1)
Test Steps:
- Attempt to castle kingside
- Verify castling is illegal
Expected Result: Castling blocked by check
TC-KING-004: Cannot Move Into Check
Priority: Critical Type: Unit Test
Preconditions:
- White king on e1
- Black rook on f8
Test Steps:
- Attempt to move king from e1 to f1
- Verify move is illegal
Expected Result: King cannot move into check
2. Game State Testing
2.1 Check Detection
TC-CHECK-001: Detect Check
Priority: Critical Type: Integration Test
Preconditions:
- White king on e1
- Black queen on e8
Test Steps:
- Move black queen from e8 to e1
- Verify "check" state is detected
- Verify visual indication of check
Expected Result: Check detected and displayed
TC-CHECK-002: Must Respond to Check
Priority: Critical Type: Integration Test
Test Steps:
- Put white in check
- Attempt to make move that doesn't resolve check
- Verify move is illegal
Expected Result: Only legal moves escape check
2.2 Checkmate Detection
TC-CHECKMATE-001: Fool's Mate
Priority: Critical Type: E2E Test
Test Steps:
- f3 (white)
- e5 (black)
- g4 (white)
- Qh4# (black)
- Verify checkmate detected
- Verify game ends
- Verify "Black wins" message
Expected Result: Checkmate in 2 moves detected
Test Data:
{
moves: ['f3', 'e5', 'g4', 'Qh4'],
result: 'black_wins',
reason: 'checkmate'
}
TC-CHECKMATE-002: Back Rank Mate
Priority: High Type: Integration Test
Preconditions:
- FEN: '6k1/5ppp/8/8/8/8/5PPP/4R1K1 b - - 0 1'
Test Steps:
- Verify white king is trapped
- Move black rook to e1
- Verify checkmate
Expected Result: Back rank mate detected
2.3 Stalemate Detection
TC-STALEMATE-001: King Cannot Move
Priority: High Type: Integration Test
Preconditions:
- FEN: 'k7/8/1Q6/8/8/8/8/7K b - - 0 1'
Test Steps:
- Verify black has no legal moves
- Verify black king is not in check
- Verify game ends in stalemate
Expected Result: Stalemate detected, game drawn
2.4 Draw Conditions
TC-DRAW-001: Insufficient Material
Priority: Medium Type: Unit Test
Test Cases:
- King vs King
- King+Bishop vs King
- King+Knight vs King
- King+Bishop vs King+Bishop (same color)
Expected Result: Draw by insufficient material
TC-DRAW-002: Fifty-Move Rule
Priority: Low Type: Integration Test
Test Steps:
- Make 50 moves without pawn move or capture
- Verify draw can be claimed
Expected Result: Fifty-move rule enforced
TC-DRAW-003: Threefold Repetition
Priority: Medium Type: Integration Test
Test Steps:
- Repeat same position 3 times
- Verify draw can be claimed
Expected Result: Threefold repetition detected
3. UI Testing
3.1 Drag and Drop
TC-UI-001: Drag Valid Move
Priority: Critical Type: E2E Test
Test Steps:
- Start dragging white pawn from e2
- Hover over e4
- Verify e4 is highlighted as valid move
- Drop piece on e4
- Verify piece moves to e4
Expected Result: Smooth drag-and-drop interaction
TC-UI-002: Drag Invalid Move
Priority: High Type: E2E Test
Test Steps:
- Start dragging white pawn from e2
- Drag to e5 (invalid)
- Drop piece
- Verify piece returns to e2
- Verify error indication
Expected Result: Invalid moves rejected gracefully
3.2 Click-to-Move
TC-UI-003: Click-Select-Click-Move
Priority: Critical Type: E2E Test
Test Steps:
- Click white pawn on e2
- Verify piece is selected (highlighted)
- Verify valid moves are highlighted
- Click on e4
- Verify piece moves to e4
Expected Result: Click interface works correctly
3.3 Visual Feedback
TC-UI-004: Highlight Last Move
Priority: Medium Type: E2E Test
Test Steps:
- Make any move
- Verify "from" square is highlighted
- Verify "to" square is highlighted
Expected Result: Last move visually indicated
TC-UI-005: Show Valid Moves
Priority: High Type: E2E Test
Test Steps:
- Select any piece
- Verify all valid destination squares are highlighted
- Verify invalid squares are not highlighted
Expected Result: Valid moves clearly shown
4. Edge Cases
4.1 Invalid Operations
TC-EDGE-001: Move Opponent's Piece
Priority: Critical Type: Unit Test
Test Steps:
- White's turn
- Attempt to move black piece
- Verify move is rejected
Expected Result: Cannot move opponent's pieces
TC-EDGE-002: Move to Same Square
Priority: Medium Type: Unit Test
Test Steps:
- Attempt to move piece to its current square
- Verify move is rejected or piece deselects
Expected Result: No-op move handled gracefully
TC-EDGE-003: Multiple Rapid Clicks
Priority: High Type: E2E Test
Test Steps:
- Rapidly click on multiple squares
- Verify only valid moves are processed
- Verify no duplicate moves
Expected Result: Rapid input handled correctly
4.2 Game State Edge Cases
TC-EDGE-004: Undo at Game Start
Priority: Low Type: Unit Test
Test Steps:
- Start new game
- Click undo
- Verify no error occurs
- Verify board unchanged
Expected Result: Undo disabled at start
TC-EDGE-005: Save Empty Game
Priority: Low Type: Integration Test
Test Steps:
- Start new game (no moves)
- Save game
- Verify game saved with initial position
Expected Result: Empty game saves correctly
5. Performance Testing
5.1 Move Calculation Performance
TC-PERF-001: Complex Position
Priority: High Type: Performance Test
Preconditions:
- Mid-game position with 20+ pieces
Test Steps:
- Calculate all legal moves
- Measure calculation time
Expected Result: <100ms for move generation
TC-PERF-002: Endgame Tablebase
Priority: Low Type: Performance Test
Test Steps:
- Load 3-piece endgame position
- Calculate optimal move
- Measure calculation time
Expected Result: <50ms for simple endgame
5.2 Rendering Performance
TC-PERF-003: Animation Frame Rate
Priority: Medium Type: Performance Test
Test Steps:
- Execute piece move with animation
- Measure frame rate during animation
Expected Result: Maintain 60 FPS
6. Accessibility Testing
6.1 Keyboard Navigation
TC-A11Y-001: Keyboard Move
Priority: High Type: E2E Test
Test Steps:
- Use Tab to focus on board
- Use arrow keys to select square
- Use Enter to select piece
- Use arrow keys to select destination
- Use Enter to move
Expected Result: Full keyboard control
TC-A11Y-002: Screen Reader Announcements
Priority: High Type: Accessibility Test
Test Steps:
- Enable screen reader
- Make a move
- Verify move is announced (e.g., "White pawn e2 to e4")
Expected Result: Moves announced clearly
6.2 Visual Accessibility
TC-A11Y-003: High Contrast Mode
Priority: Medium Type: Visual Test
Test Steps:
- Enable high contrast mode
- Verify all pieces are distinguishable
- Verify board squares have sufficient contrast
Expected Result: WCAG AA contrast ratios met
7. Cross-Browser Testing
7.1 Browser Compatibility
TC-BROWSER-001: Chrome Compatibility
Priority: Critical Type: E2E Test
Test Steps:
- Run all E2E tests in Chrome
- Verify all tests pass
Expected Result: Full compatibility with Chrome
TC-BROWSER-002: Safari Compatibility
Priority: High Type: E2E Test
Test Steps:
- Run all E2E tests in Safari
- Verify drag-and-drop works
- Verify no visual glitches
Expected Result: Full compatibility with Safari
Test Data References
- FEN Strings: test-data/positions/
- PGN Games: test-data/games/
- Test Scenarios: test-data/scenarios/