-
-
Notifications
You must be signed in to change notification settings - Fork 403
Open
Labels
Description
Problem
Sabaki's test suite only covers file format parsing and game sorting — all pure JS unit tests. There is no testing of:
- App startup and rendering — a broken import silently produces a black screen with all unit tests passing
- IPC communication between main and renderer processes
- GTP engine integration — attaching engines, sending commands, receiving analysis
- File loading through the UI — opening SGF files end-to-end
Proposed testing additions
1. End-to-end tests with Playwright (Electron support)
Playwright supports launching Electron apps directly via electron.launch(). This enables:
- Smoke test: App launches, renderer loads, Goban component renders
- File loading: Open an SGF file via IPC, verify the board state renders correctly
- Black-screen detection: Assert that the renderer's root component mounts and is visible
- Window lifecycle: Maximize, minimize, close without crash
- Multi-window: Open multiple windows, verify independence
2. GTP engine integration tests
The codebase already has test/engines/resignEngine.js (a minimal GTP engine using @sabaki/gtp's Engine class). We can use this to test:
- EngineSyncer lifecycle: Start, sync board state, stop, and restart
- Command queuing: Send GTP commands and verify responses
- Board state sync: Load a game tree, sync it to the engine, verify the engine received the correct moves
- Analysis parsing: Feed mock
infolines and verify analysis state updates - Error handling: Engine crash, timeout, malformed responses
3. Renderer integration tests
Using Playwright's Electron support to test renderer-side behavior:
- File drag-and-drop: Simulate dropping an SGF file onto the window
- Navigation: Move forward/backward through game moves, verify board updates
- Game tree interaction: Switch between variations
Technical approach
- Framework: Playwright (
@playwright/test) with its built-in_electronmodule for Electron app testing - GTP tests: Can run as standard Mocha tests by importing
EngineSyncerdirectly and spawning the resign engine - Test data: Use existing fixtures in
test/sgf/, etc. - CI: Playwright Electron tests require a display server on Linux (
xvfb-run) but work natively on macOS/Windows
Non-goals
- Testing pure utility functions (already possible, low value relative to above)
- Visual regression testing (future work)
- Performance benchmarks
Reactions are currently unavailable