-
Notifications
You must be signed in to change notification settings - Fork 1
✨ Add Storybook Client SDK with Puppeteer (VIZ-59) #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements @vizzly-testing/storybook - a Vizzly CLI plugin that auto-discovers and captures screenshots of Storybook stories using Puppeteer. Core Features: - Auto-discovery from Storybook index.json (v6/v7/v8 support) - Multi-viewport screenshot capture - Functional architecture with pure functions - Global and per-story configuration - Interaction hooks (beforeScreenshot) - Pattern-based story filtering (include/exclude) - Parallel processing with configurable concurrency - Vizzly SDK integration for screenshot upload Package Structure: - Plugin registration via vizzly.plugin field in package.json - Functional modules: config, crawler, browser, screenshot, hooks - 52 passing tests with full coverage - CI/CD workflows for testing and releases - Comprehensive documentation with examples CI Improvements: - Added path-based conditional execution for client tests - Ruby and Storybook clients only test when their files change - Optimized workflow saves GitHub Actions minutes - Smart ci-check handles conditional job results
PR Review: Storybook Plugin ImplementationOverviewThis PR implements the first official Vizzly plugin for Storybook screenshot testing. The implementation is well-structured, follows functional programming principles, and includes comprehensive test coverage. Overall, this is high-quality work that's ready to merge with a few minor recommendations. ✅ StrengthsArchitecture & Code Quality
Configuration System
Testing
CI/CD Enhancements
|
| Category | Rating | Notes |
|---|---|---|
| Code Quality | ⭐⭐⭐⭐⭐ | Excellent functional design, clean architecture |
| Security | ⭐⭐⭐⭐ | Minor path validation improvements recommended |
| Performance | ⭐⭐⭐⭐ | Good concurrency control, efficient resource usage |
| Test Coverage | ⭐⭐⭐⭐ | Strong unit tests, needs E2E test before release |
| Documentation | ⭐⭐⭐⭐⭐ | Comprehensive and well-written |
🚀 Recommendation: Approve with Minor Changes
Before Merge (Optional but Recommended):
- Fix missing
cosmiconfigdependency (critical) - Add Puppeteer system dependencies to CI workflow
- Fix comparison URL in release workflow
Before First Release:
- Add integration test with real Storybook
- Manual testing with various Storybook versions
- Consider error handling improvements (continue on failure)
🎉 Closing Thoughts
This is a solid first plugin for Vizzly. The functional architecture is a pleasure to review, test coverage is strong, and the documentation is thorough. The issues identified are minor and don't block merging. Great work! 🚀
Congratulations on shipping the first official Vizzly plugin! 🎊
Fixes from PR #44 review comments: 1. ✅ Add cosmiconfig dependency (was missing from package.json) 2. ✅ Replace p-map with custom concurrency control - p-map@8 doesn't exist, implemented mapWithConcurrency 3. ✅ Add input validation to generateStoryUrl - Validates baseUrl and storyId are non-empty strings 4. ✅ Add 30s timeout to navigateToUrl - Prevents hanging on slow/broken stories 5. ✅ Fix error handling to continue on failure - Stories/viewports collect errors and report summary - No longer throws and stops all processing 7. ✅ Fix comparison URL in release workflow - Changed from vizzly-cli to cli repo name All tests still passing (52/52)
- Add HTTP server using serve-handler for proper asset loading - Remove all arbitrary timeouts, rely on networkidle2 - Fix config option merging to pass global options to commands - Update pattern matching to support both object and array formats - Sanitize screenshot names by replacing slashes with hyphens - Add comprehensive example Storybook with Button and Card components - Update README troubleshooting to use proper DOM waiting - Simplify examples to show best practices without complexity All features verified working: - CLI viewport options - Config file loading - Pattern-based hooks - Per-story configuration - Screenshot rendering - 52 plugin tests + 558 CLI tests passing
Summary
Implements
@vizzly-testing/storybook- the first official Vizzly CLI plugin that auto-discovers and captures screenshots of Storybook stories using Puppeteer.Closes #79 (VIZ-59)
What's New
Storybook Plugin (
clients/storybook/)Core Features:
index.json(v6/v7/v8 support)beforeScreenshot)Package Structure:
vizzly.pluginfieldCI/CD Enhancements
Optimized Workflows:
ci-checkhandles conditional job resultsUsage
CLI
Programmatic
Per-Story Config
Testing
Next Steps
Test Plan