Quellcode durchsuchen

docs(03-01): complete integration tests phase

Tasks completed: 5/5
- Integration test infrastructure (apiCallLog, renderApp)
- Pattern flow tests (6 tests)
- Playlist flow tests (8 tests)
- Playback flow tests (8 tests)

SUMMARY: .planning/phases/03-integration-tests/03-01-SUMMARY.md
tuanchris vor 1 Woche
Ursprung
Commit
868ec596d3
2 geänderte Dateien mit 119 neuen und 6 gelöschten Zeilen
  1. 16 6
      .planning/STATE.md
  2. 103 0
      .planning/phases/03-integration-tests/03-01-SUMMARY.md

+ 16 - 6
.planning/STATE.md

@@ -3,12 +3,12 @@
 ## Current Position
 
 Milestone: v2-frontend-testing
-Phase: 02-component-tests (2 of 4)
+Phase: 03-integration-tests (3 of 4)
 Plan: 01 of 1 - COMPLETE
 Status: Phase complete
-Last activity: 2026-01-25 - Completed 02-01-PLAN.md
+Last activity: 2026-01-25 - Completed 03-01-PLAN.md (22 integration tests)
 
-Progress: [#####-----] 50%
+Progress: [#######---] 75%
 
 ## Phase Overview
 
@@ -16,7 +16,7 @@ Progress: [#####-----] 50%
 |-------|------|--------|
 | 01 | Test Infrastructure | **Complete** |
 | 02 | Component Tests | **Complete** |
-| 03 | Integration Tests | Pending |
+| 03 | Integration Tests | **Complete** |
 | 04 | E2E & CI | Pending |
 
 ## Completed Milestones
@@ -41,6 +41,8 @@ Progress: [#####-----] 50%
 | MSW onUnhandledRequest: warn | Changed from error due to WebSocket conflicts | 2026-01-25 |
 | Chromium only (initial) | Faster CI, can add browsers later | 2026-01-24 |
 | Observable behavior testing | Focus on what renders, clicks, API calls not implementation | 2026-01-25 |
+| apiCallLog for API verification | Track API calls in MSW handlers for integration test assertions | 2026-01-25 |
+| Button finding via textContent | More reliable than getByRole for buttons with similar names | 2026-01-25 |
 
 ## Blockers/Concerns
 
@@ -49,5 +51,13 @@ None currently.
 ## Session Continuity
 
 Last session: 2026-01-25
-Stopped at: Completed 02-01-PLAN.md (Component Tests)
-Resume file: None
+Stopped at: Completed 03-01-PLAN.md (Integration Tests)
+Resume file: .planning/phases/04-e2e-ci/04-01-PLAN.md (when created)
+
+## Test Summary
+
+| Category | Tests |
+|----------|-------|
+| Component tests | 42 |
+| Integration tests | 22 |
+| **Total frontend tests** | **64** |

+ 103 - 0
.planning/phases/03-integration-tests/03-01-SUMMARY.md

@@ -0,0 +1,103 @@
+# Phase 03 Plan 01: Multi-Component User Flow Tests Summary
+
+**One-liner:** Integration tests validating pattern browsing, playlist management, and playback control flows with API call verification via MSW apiCallLog tracking.
+
+## Completed Work
+
+### Tasks Completed
+
+| Task | Description | Commit | Files |
+|------|-------------|--------|-------|
+| 1.1-1.3 | Integration test infrastructure | beec9a9 | utils.tsx, handlers.ts, setup.ts |
+| 2.1 | Pattern flow integration tests | 286e40d | patternFlow.test.tsx |
+| 3.1 | Playlist flow integration tests | 313e479 | playlistFlow.test.tsx, handlers.ts |
+| 4.1 | Playback flow integration tests | bdf0f47 | playbackFlow.test.tsx |
+| 5.1-5.2 | Test verification and coverage | (this summary) | - |
+
+### Test Counts
+
+| Category | Tests |
+|----------|-------|
+| Pattern flow (INT-1) | 6 |
+| Playlist flow (INT-2) | 8 |
+| Playback flow (INT-3) | 8 |
+| **Total integration tests** | **22** |
+| Component tests (Phase 02) | 42 |
+| **Total tests** | **64** |
+
+### Key Files Created/Modified
+
+**Created:**
+- `frontend/src/__tests__/integration/patternFlow.test.tsx` - Browse -> select -> run flow tests
+- `frontend/src/__tests__/integration/playlistFlow.test.tsx` - Create -> view -> run playlist tests
+- `frontend/src/__tests__/integration/playbackFlow.test.tsx` - Playback lifecycle tests
+
+**Modified:**
+- `frontend/src/test/utils.tsx` - Added renderApp() helper for integration tests
+- `frontend/src/test/mocks/handlers.ts` - Added apiCallLog tracking and logApiCall helper
+- `frontend/src/test/setup.ts` - Added resetApiCallLog to beforeEach
+
+## Technical Decisions
+
+| Decision | Rationale |
+|----------|-----------|
+| apiCallLog array for tracking | Simple mutable array enables verification of API call sequences without complex mocking |
+| logApiCall() on key handlers | Selective logging on important endpoints (run, playlist, playback control) keeps logs focused |
+| Button finding via textContent | More reliable than getByRole name matching due to multiple buttons with similar names |
+| localStorage.clear() in beforeEach | Ensures test isolation for components that persist state |
+
+## Deviations from Plan
+
+### Auto-fixed Issues
+
+**1. [Rule 3 - Blocking] Fixed preview_thr_batch handler**
+- **Found during:** Task 3.1
+- **Issue:** Handler expected `files` but app sends `file_names`
+- **Fix:** Updated handler to accept both: `body.files || body.file_names || []`
+- **Files modified:** handlers.ts
+- **Commit:** 313e479
+
+**2. [Rule 1 - Bug] Added playlist_name to stop_execution reset**
+- **Found during:** Task 4.1
+- **Issue:** stop_execution handler didn't reset playlist_name to null
+- **Fix:** Added `mockData.status.playlist_name = null` to stop_execution handler
+- **Files modified:** handlers.ts
+- **Commit:** beec9a9
+
+## Coverage Summary
+
+```
+Pages tested:
+- BrowsePage.tsx: 53% statements covered
+- PlaylistsPage.tsx: 84% statements covered
+- TableControlPage.tsx: 68% statements covered
+
+Overall: 64 tests passing
+```
+
+## Requirements Addressed
+
+- [x] **INT-1:** Pattern flow - browse -> select -> trigger run -> verify API call
+- [x] **INT-2:** Playlist flow - create -> add patterns -> run -> verify API calls
+- [x] **INT-3:** Playback flow - start -> pause/resume -> stop -> verify state transitions
+
+## Next Phase Readiness
+
+Phase 03 is complete. Ready for Phase 04: E2E & CI.
+
+**Dependencies for Phase 04:**
+- MSW handlers with apiCallLog tracking (available)
+- Test infrastructure with full app rendering (renderApp available)
+- All integration tests passing (verified)
+
+## Metrics
+
+| Metric | Value |
+|--------|-------|
+| Start time | 2026-01-25T01:26:11Z |
+| End time | 2026-01-25T01:31:52Z |
+| Duration | ~6 minutes |
+| Tasks completed | 5/5 |
+| Tests added | 22 |
+| Files created | 3 |
+| Files modified | 3 |