|
| 1 | +# Relentless Testing Strategy for Vibe Commit Visualizer |
| 2 | + |
| 3 | +To ensure `vibecommit-visualizer` is production-ready, we need a multi-layered testing approach that goes beyond simple unit tests. We must test the UI, the Electron integration, performance with large repositories, and edge cases. |
| 4 | + |
| 5 | +## 1. Foundation: Unit & Integration Tests (Backend Logic) |
| 6 | +**Current Status:** Partially implemented (`tests/unit`, `tests/integration`). |
| 7 | +**Goal:** 100% coverage of business logic and IPC handlers. |
| 8 | + |
| 9 | +- **Action Items:** |
| 10 | + - **IPC Handlers**: Ensure every `ipcMain.handle` is tested with various inputs (valid, invalid, missing params). |
| 11 | + - **Git Parsing**: Test the regex/parsing logic for `git log` output against weird commit messages (emojis, multi-line, special characters). |
| 12 | + - **Security**: Verify `child_process` arguments are always sanitized (already seemingly covered, but double-check). |
| 13 | + |
| 14 | +## 2. Component Testing (Frontend UI) |
| 15 | +**Current Status:** Missing. |
| 16 | +**Goal:** Verify individual React components render and behave correctly in isolation. |
| 17 | +**Tools:** `React Testing Library` + `Jest`. |
| 18 | + |
| 19 | +- **Action Items:** |
| 20 | + - **GitVisualizer**: |
| 21 | + - Test rendering with 0 commits (empty state). |
| 22 | + - Test rendering with 10 commits. |
| 23 | + - Test clicking a node triggers `onCommitSelect`. |
| 24 | + - Test loading state (spinner). |
| 25 | + - **ApiKeyManager**: |
| 26 | + - Test input validation (empty key, invalid format). |
| 27 | + - Test saving/loading from `sessionStorage`. |
| 28 | + |
| 29 | +## 3. End-to-End (E2E) Testing with Playwright |
| 30 | +**Current Status:** Missing. |
| 31 | +**Goal:** Test the actual packaged Electron app running on the OS. |
| 32 | +**Tools:** `Playwright` (supports Electron). |
| 33 | + |
| 34 | +- **Action Items:** |
| 35 | + - **Setup**: Configure Playwright to launch the Electron executable. |
| 36 | + - **Smoke Test**: Launch app -> Verify window opens -> Verify "Loading" -> Verify Graph appears. |
| 37 | + - **Interaction**: |
| 38 | + - Click a commit node -> Verify details panel opens. |
| 39 | + - Click "Generate" -> Verify Vibe CLI is called (mocked or real). |
| 40 | + - **Visual Regression**: Take screenshots of the graph and compare against baselines to catch layout breakages. |
| 41 | + |
| 42 | +## 4. "Relentless" Stress & Performance Testing |
| 43 | +**Current Status:** Missing. |
| 44 | +**Goal:** Ensure the app doesn't freeze or crash under heavy load (User reported freezing). |
| 45 | + |
| 46 | +- **Action Items:** |
| 47 | + - **Large Repo Test**: |
| 48 | + - Create a script to generate a dummy git repo with 1,000, 5,000, and 10,000 commits. |
| 49 | + - Point the visualizer to this repo. |
| 50 | + - Measure time to render. |
| 51 | + - **Pass Criteria**: UI remains responsive (60fps), graph renders within X seconds. |
| 52 | + - **Complex Graph Test**: |
| 53 | + - Generate a repo with many merges/branches (complex topology) to stress the `dagre` layout engine. |
| 54 | + - **Memory Leak Test**: |
| 55 | + - Open/close the app 10 times. |
| 56 | + - Switch branches 50 times rapidly. |
| 57 | + - Monitor RAM usage. |
| 58 | + |
| 59 | +## 5. Chaos & Edge Case Testing |
| 60 | +**Goal:** Break the app intentionally. |
| 61 | + |
| 62 | +- **Action Items:** |
| 63 | + - **Missing Dependencies**: Run app where `git` is uninstalled or `vibe` CLI is missing. Verify error messages. |
| 64 | + - **Corrupt Repo**: Point app to a `.git` folder with missing HEAD or corrupt objects. |
| 65 | + - **Network Failures**: Disconnect internet while using AI features. |
| 66 | + - **Concurrent Operations**: Spam the "Refresh" button while a command is running. |
| 67 | + |
| 68 | +## 6. Packaging & Distribution Testing |
| 69 | +**Goal:** Ensure the built artifact works on fresh machines. |
| 70 | + |
| 71 | +- **Action Items:** |
| 72 | + - **Clean VM Test**: Run the `.exe` (Windows) or `.dmg` (Mac) on a fresh VM with no Node/Python installed. |
| 73 | + - **Path Spaces**: Test with project paths containing spaces and special characters (e.g., `C:\Users\Name\My Projects\Vibe Commit`). |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +# Implementation Plan |
| 78 | + |
| 79 | +## Phase 1: Setup E2E Framework |
| 80 | +1. Install Playwright: `pnpm add -D @playwright/test playwright`. |
| 81 | +2. Create `playwright.config.ts` configured for Electron. |
| 82 | +3. Write a basic "App Launches" test. |
| 83 | + |
| 84 | +## Phase 2: Stress Test Script |
| 85 | +1. Create `scripts/generate-large-repo.js`. |
| 86 | +2. Run the visualizer against it and profile performance. |
| 87 | + |
| 88 | +## Phase 3: Component Tests |
| 89 | +1. Add `testing-library` dependencies. |
| 90 | +2. Write `GitVisualizer.test.tsx`. |
0 commit comments