Add comprehensive testing infrastructure#15
Merged
Conversation
Migrate from Jest to Vitest with Istanbul coverage (65% threshold). Add CRAP score analysis (threshold 15), Playwright + playwright-bdd for Gherkin acceptance tests, GitHub Actions CI pipeline, and pre-commit hooks enforcing lint/test/build gates. Write 966 unit tests across 66 files covering all services, hooks, components, API routes, and utility functions.
…coverage - Extract all component logic into custom hooks (useSearchInterface, useTVDisplay, useAudioPlayer, useLyricsSync, usePWAInstall, useCacheManager, useWebSocket/) - Split large components into focused sub-components (<100 lines each) - Extract pure utility functions for CRAP score reduction - Add 1372 unit tests across 82 test files (91% coverage) - Add 7 Gherkin e2e feature files (63 scenarios) including multi-user tests - CRAP score: 0 violations (784 functions analyzed, all <= 15) - Coverage: 91% statements, 82% branches, 91% functions, 91% lines
…or e2e - next lint was removed in Next.js 16; use eslint src/ --quiet instead - Pass JELLYFIN_SERVER_URL/API_KEY/USERNAME secrets to acceptance tests - Ignore test-results/ and playwright-report/ from git and prettier - Remove stale eslint-disable directive - Regenerate .features-gen from bddgen
…server Rewrote all Gherkin scenarios and step definitions to work against a real Jellyfin instance via .env.local credentials. Removed flaky scenarios that depended on mocked state, fixed WebSocket wait strategies (domcontentloaded instead of networkidle), and handled the auto-play behavior where songs become now-playing rather than pending queue items. Also removed Docker build-and-push from PR triggers (main only).
Next.js reads config from .env.local, not environment variables directly.
In CI, use npm start (production server from prior build step) instead of npm run dev which was getting killed before compiling. Increased webServer timeout to 60s.
Multi-user tests need additional work for modal handling in CI. Single-user project (29 scenarios) covers all core functionality. Removed dead Cypress npm scripts since the workflow was already deleted.
Includes 5 multi-user scenarios testing shared queue interactions, real-time WebSocket sync between users, TV display transitions, and song skip via API. Fixed confirmation dialog blocking by dismissing it explicitly, and handled auto-play behavior (now-playing vs queue-item). All 33 acceptance tests pass against real Jellyfin server.
New 'full-playback' Playwright project runs headed (via xvfb in CI) with real Jellyfin audio streaming. Tests complete song lifecycle: lyrics display, progress bar advancement, rating animation, next-song splash, and back-to-back song transitions. Uses Weird Al (index 0) and 3 Doors Down (index 4) for distinct songs. Added data-testid attributes to PlaybackFooter for progress bar assertions.
- Add queue cleanup at start of each multi-user scenario to prevent state pollution between test runs (verified stable 5/5 runs) - Show next song title, artist, and singer on the rating/grade screen - Update RatingAnimation unit tests to match new "Up Next" display
Remote Jellyfin API can be slow from CI runners. Increase assertion timeouts from default 5s to 15s for search results, artist songs, and playlist operations.
The default 30s Playwright timeout is too tight when hitting a remote Jellyfin server from CI. Multi-user tests need extra headroom because they open 3 browser contexts (Alice, Bob, TV) that each independently load data from the API.
Root cause of flakiness: clearQueue was passing `queueItemId` but the API expects `itemId`, so deletions silently failed (400). Also, the API rejects deletion of currently-playing songs, so we must skip those first. Added project-level timeouts (60s/90s) as additional headroom.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan