Migrate Storybook & add CI validation — prep for theming#438
Migrate Storybook & add CI validation — prep for theming#438bballdavis wants to merge 11 commits intodevfrom
Conversation
- Created stories for ChannelManager, ChannelPage, Configuration, DatabaseErrorOverlay, DownloadManager, ErrorBoundary, HelpDialog, InitialSetup, LocalLogin, PlexAuthDialog, PlexLibrarySelector, StorageStatus, VideosPage, AddSubfolderDialog, DeleteVideosDialog, DownloadFormatIndicator, SubfolderAutocomplete, WebSocketProvider, and videoStatus utilities. - Implemented mock API responses using MSW for testing component interactions and states. - Added play functions to validate UI behavior and interactions in the stories.
…onsDropdown components
📊 Test Coverage ReportBackend Coverage
Frontend Coverage
Coverage Requirements
Coverage report generated for commit 43f1220 |
Code Review: Storybook Migration & CI ValidationStrengths
Issues & ConcernsHigh Priority
Medium Priority
Low Priority
Security Assessment
RecommendationsBefore merge:
Follow-up:
VerdictApprove with minor changes - Solid foundation for Storybook integration. Fix trailing newlines and verify type definitions, then ready to merge. |
There was a problem hiding this comment.
Pull request overview
This PR modernizes the client Storybook setup and adds CI validation to keep Storybook builds healthy as groundwork for upcoming theming work.
Changes:
- Adds/updates Storybook tooling in the client (Storybook + MSW integration + preview/main config).
- Introduces a Jest “storybook parity coverage” test harness that runs selected stories’
playfunctions in CI. - Adds a dedicated CI job to build Storybook and run the Storybook parity Jest test.
Reviewed changes
Copilot reviewed 83 out of 86 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds a root storybook script to run the client Storybook command. |
| docs/DEVELOPMENT.md | Documents how to run Storybook locally and references the Jest parity test. |
| client/src/utils/tests/videoStatus.story.tsx | Adds a Storybook story for videoStatus utilities. |
| client/src/types/storybook-shims.d.ts | Adds TS shims for Storybook modules used in stories/tests. |
| client/src/tests/storybook_coverage.test.js | Adds a Jest suite that runs selected stories’ play functions for parity validation. |
| client/src/providers/tests/WebSocketProvider.story.tsx | Adds a Storybook story validating WebSocket context provisioning. |
| client/src/components/shared/tests/VideoActionsDropdown.story.tsx | Adds interactive stories for VideoActionsDropdown. |
| client/src/components/shared/tests/SubfolderAutocomplete.story.tsx | Adds stories covering selection behavior for SubfolderAutocomplete. |
| client/src/components/shared/tests/RatingBadge.story.tsx | Adds stories for RatingBadge variants and states. |
| client/src/components/shared/tests/DownloadFormatIndicator.story.tsx | Adds stories for different download format indicator states. |
| client/src/components/shared/tests/DeleteVideosDialog.story.tsx | Adds a story validating delete confirmation flow. |
| client/src/components/shared/tests/ChangeRatingDialog.story.tsx | Adds stories covering dialog open/close, selection, loading, and actions. |
| client/src/components/shared/tests/AddSubfolderDialog.story.tsx | Adds stories for validation and submission behavior. |
| client/src/components/tests/storybookPlayAdapter.tsx | Adds a helper to render stories and execute their play functions inside Jest. |
| client/src/components/tests/VideosPage.story.tsx | Adds Stories for VideosPage with MSW-backed states (default/empty/error). |
| client/src/components/tests/StorageStatus.story.tsx | Adds a story for StorageStatus with MSW handlers and hover tooltip check. |
| client/src/components/tests/PlexLibrarySelector.story.tsx | Adds a story for selecting/saving a Plex library using MSW handlers. |
| client/src/components/tests/PlexAuthDialog.story.tsx | Adds stories for Plex auth dialog and cancel behavior. |
| client/src/components/tests/LocalLogin.story.tsx | Adds a story validating invalid-credentials UI via MSW. |
| client/src/components/tests/InitialSetup.story.tsx | Adds stories for setup success and password mismatch flows using MSW. |
| client/src/components/tests/HelpDialog.story.tsx | Adds a story validating help dialog close behavior. |
| client/src/components/tests/ErrorBoundary.story.tsx | Adds a story validating error boundary reset flow. |
| client/src/components/tests/DownloadManager.story.tsx | Adds stories for DownloadManager empty and populated job states. |
| client/src/components/tests/DatabaseErrorOverlay.story.tsx | Adds stories for database overlay + retry action. |
| client/src/components/tests/Configuration.story.tsx | Adds a story that exercises Configuration page loading and key UI elements via MSW. |
| client/src/components/tests/ChannelPage.story.tsx | Adds a story validating ChannelPage loads and key interactions with MSW responses. |
| client/src/components/tests/ChannelManager.story.tsx | Adds a story validating channel manager UI presence and interactions with MSW. |
| client/src/components/tests/ChangelogPage.story.tsx | Adds stories for changelog load/refresh/loading/error states with MSW. |
| client/src/components/VideosPage/tests/FilterMenu.story.tsx | Adds a story exercising FilterMenu selection behavior. |
| client/src/components/DownloadManager/tests/TerminateJobDialog.story.tsx | Adds a story validating terminate confirmation flow. |
| client/src/components/DownloadManager/tests/DownloadProgress.story.tsx | Adds a story validating queued jobs UI for download progress. |
| client/src/components/DownloadManager/tests/DownloadNew.story.tsx | Adds extensive stories for manual/channel download flows with MSW. |
| client/src/components/DownloadManager/tests/DownloadHistory.story.tsx | Adds a story validating “show jobs without videos” toggle behavior. |
| client/src/components/DownloadManager/ManualDownload/tests/VideoChip.story.tsx | Adds a story validating “previously downloaded” popover flow. |
| client/src/components/DownloadManager/ManualDownload/tests/UrlInput.story.tsx | Adds a story validating Enter-submit behavior. |
| client/src/components/DownloadManager/ManualDownload/tests/ManualDownload.story.tsx | Adds a story validating adding a URL to the download queue using MSW. |
| client/src/components/DownloadManager/ManualDownload/tests/DownloadSettingsDialog.story.tsx | Adds a story validating confirm defaults callback behavior. |
| client/src/components/Configuration/sections/tests/SponsorBlockSection.story.tsx | Adds a story exercising sponsor category toggle behavior. |
| client/src/components/Configuration/sections/tests/SaveBar.story.tsx | Adds stories for SaveBar click and validation error state. |
| client/src/components/Configuration/sections/tests/PlexIntegrationSection.story.tsx | Adds a story validating Plex auth dialog launch action. |
| client/src/components/Configuration/sections/tests/NotificationsSection.story.tsx | Adds a story validating adding a notification service. |
| client/src/components/Configuration/sections/tests/KodiCompatibilitySection.story.tsx | Adds a story validating toggling metadata settings. |
| client/src/components/Configuration/sections/tests/DownloadPerformanceSection.story.tsx | Adds a story validating stall detection toggle behavior. |
| client/src/components/Configuration/sections/tests/CoreSettingsSection.story.tsx | Adds stories for auto-download toggle behavior and theme switcher placeholder. |
| client/src/components/Configuration/sections/tests/CookieConfigSection.story.tsx | Adds a story validating enabling cookies surfaces upload UI. |
| client/src/components/Configuration/sections/tests/AutoRemovalSection.story.tsx | Adds a story validating expand + enable flow for auto-removal. |
| client/src/components/Configuration/sections/tests/ApiKeysSection.story.tsx | Adds a story validating opening the create API key dialog. |
| client/src/components/Configuration/sections/tests/AdvancedSettingsSection.story.tsx | Adds a story validating proxy URL validation messaging. |
| client/src/components/Configuration/sections/tests/AccountSecuritySection.story.tsx | Adds a story validating password mismatch helper text wiring. |
| client/src/components/Configuration/common/tests/InfoTooltip.story.tsx | Adds a story validating tooltip shows on hover. |
| client/src/components/Configuration/common/tests/ConfigurationSkeleton.story.tsx | Adds a story validating skeleton loading message. |
| client/src/components/Configuration/common/tests/ConfigurationCard.story.tsx | Adds a story validating card renders title/subtitle/body. |
| client/src/components/Configuration/common/tests/ConfigurationAccordion.story.tsx | Adds a story validating expanded accordion renders content. |
| client/src/components/Configuration/tests/SubtitleLanguageSelector.story.tsx | Adds a story validating multi-select change callback behavior. |
| client/src/components/ChannelPage/components/tests/MobileFilterDrawer.story.tsx | Adds stories validating filter drawer interactions and hide-date message. |
| client/src/components/ChannelPage/components/tests/FilterChips.story.tsx | Adds stories validating clearing duration/date chips and empty state. |
| client/src/components/ChannelPage/components/tests/DurationFilterInput.story.tsx | Adds stories validating duration input changes and compact mode. |
| client/src/components/ChannelPage/components/tests/DateRangeFilterInput.story.tsx | Adds stories validating date input changes and compact mode. |
| client/src/components/ChannelPage/components/tests/ChannelVideosFilters.story.tsx | Adds stories validating clear-all interactions for desktop/mobile. |
| client/src/components/ChannelPage/tests/VideoTableView.story.tsx | Adds a story validating row selection callback behavior. |
| client/src/components/ChannelPage/tests/VideoListItem.story.tsx | Adds a story validating selectable click triggers callback. |
| client/src/components/ChannelPage/tests/VideoCard.story.tsx | Adds multiple stories covering different VideoCard states and interactions. |
| client/src/components/ChannelPage/tests/StillLiveDot.story.tsx | Adds a story validating tooltip content appears on interaction. |
| client/src/components/ChannelPage/tests/ChannelVideosHeader.story.tsx | Adds stories validating header action interactions and danger intent styling. |
| client/src/components/ChannelPage/tests/ChannelVideosDialogs.story.tsx | Adds a story validating “Start Download” confirm callback. |
| client/src/components/ChannelPage/tests/ChannelVideos.story.tsx | Adds a story validating empty state and search input interaction. |
| client/src/components/ChannelPage/tests/ChannelSettingsDialog.story.tsx | Adds a story validating loaded dialog interactions with MSW. |
| client/src/components/ChannelManager/components/chips/tests/TitleFilterChip.story.tsx | Adds stories validating regex chip click callback shape. |
| client/src/components/ChannelManager/components/chips/tests/SubFolderChip.story.tsx | Adds stories validating root/global-default/specific rendering behavior. |
| client/src/components/ChannelManager/components/chips/tests/QualityChip.story.tsx | Adds stories validating override vs global default display attributes. |
| client/src/components/ChannelManager/components/chips/tests/DurationFilterChip.story.tsx | Adds stories for min/max/range label rendering. |
| client/src/components/ChannelManager/components/chips/tests/DownloadFormatConfigIndicator.story.tsx | Adds stories for video/audio icon combinations. |
| client/src/components/ChannelManager/components/chips/tests/AutoDownloadChips.story.tsx | Adds a story validating tab chip state attributes. |
| client/src/components/ChannelManager/components/tests/PendingSaveBanner.story.tsx | Adds a story validating banner visibility text. |
| client/src/components/ChannelManager/components/tests/ChannelListRow.story.tsx | Adds a story validating row actions (remove/regex/navigate). |
| client/src/components/ChannelManager/components/tests/ChannelCard.story.tsx | Adds stories validating card interactions and pending-addition disabled behavior. |
| client/src/tests/App.story.tsx | Adds stories for App logged-in, db error overlay, and requires-setup routing. |
| client/public/mockServiceWorker.js | Adds generated MSW service worker for Storybook/MSW integration. |
| client/package.json | Adds Storybook scripts and dependencies (Storybook + MSW tooling). |
| client/jest.config.cjs | Adjusts Jest test matching/ignores to avoid treating stories as tests. |
| client/.storybook/test-runner.js | Adds optional debug logging hooks for Storybook test-runner runs. |
| client/.storybook/preview.js | Initializes MSW, applies global decorators/providers, and merges default MSW handlers. |
| client/.storybook/main.js | Configures Storybook (Vite + tsconfig paths, story globs, addons, env defines). |
| .gitignore | Ignores Storybook build outputs/caches and Storybook test artifacts. |
| .github/workflows/ci.yml | Adds a CI job to build Storybook and run Jest parity validation; wires into check-all. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
client/src/components/ChannelPage/__tests__/VideoCard.story.tsx
Outdated
Show resolved
Hide resolved
client/src/components/DownloadManager/ManualDownload/__tests__/VideoChip.story.tsx
Outdated
Show resolved
Hide resolved
client/src/components/Configuration/sections/__tests__/CoreSettingsSection.story.tsx
Show resolved
Hide resolved
client/src/components/Configuration/sections/__tests__/AccountSecuritySection.story.tsx
Show resolved
Hide resolved
client/src/components/DownloadManager/ManualDownload/__tests__/ManualDownload.story.tsx
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nd improve test accessibility
PR Review: Migrate Storybook & add CI validationOverall this is a well-structured addition — the MSW integration is clean, the global providers in High Priority1. Trivial tests provide false confidence in Two of the five tests in the // Always passes — tests nothing
test('stories should not nest MemoryRouter...', () => {
expect(true).toBe(true);
});
// Always passes — array length > 0 is trivially true
test('Key router-dependent components have story wrappers', () => {
const routerDependentComponents = ['ChannelManager', ...];
expect(routerDependentComponents.length).toBeGreaterThan(0);
});The third test also has an inverted assertion that always passes because // story.parameters?.skipRouter is undefined by default, and undefined \!== false, so this never fails
expect(story.parameters?.skipRouter).not.toBe(false);Since 2. Changing - testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
+ testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],Removing the Medium Priority3. In async json() {
return JSON.parse(this.body); // throws if body is already a plain object
}MSW constructs async json() {
return typeof this.body === 'string' ? JSON.parse(this.body) : this.body;
}4. // storybookPlayAdapter.tsx
await story.play({
// ...
mount: undefined,
userEvent: undefined,
within: undefined,
expect: undefined,
} as any);Play functions that destructure these from the context argument (e.g. 5. GitHub Actions pinned to uses: actions/checkout@v3
uses: actions/setup-node@v3
uses: actions/cache@v3
Low Priority6. Version spec in
7. Missing newline at end of The diff shows Positive Notes
|
Short migration of Storybook setup, plus CI that builds/validates Storybook and a few script cleanups.
Updated Storybook config/deps and cleaned up related scripts
Added CI job to build/validate Storybook snapshots
No UI or theming changes in this PR — this is the preparatory step before the theming work
The Storybook is currently its own CI test, but we could always incorporate it into the frontend test.