@vizzly-testing/cli 0.23.1 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +54 -586
  2. package/dist/api/client.js +3 -1
  3. package/dist/api/endpoints.js +6 -7
  4. package/dist/cli.js +15 -2
  5. package/dist/commands/finalize.js +12 -0
  6. package/dist/commands/preview.js +210 -28
  7. package/dist/commands/run.js +15 -0
  8. package/dist/commands/status.js +34 -8
  9. package/dist/commands/upload.js +13 -0
  10. package/package.json +1 -2
  11. package/claude-plugin/.claude-plugin/README.md +0 -270
  12. package/claude-plugin/.claude-plugin/marketplace.json +0 -28
  13. package/claude-plugin/.claude-plugin/plugin.json +0 -14
  14. package/claude-plugin/.mcp.json +0 -12
  15. package/claude-plugin/CHANGELOG.md +0 -85
  16. package/claude-plugin/commands/setup.md +0 -137
  17. package/claude-plugin/commands/suggest-screenshots.md +0 -111
  18. package/claude-plugin/mcp/vizzly-docs-server/README.md +0 -95
  19. package/claude-plugin/mcp/vizzly-docs-server/docs-fetcher.js +0 -110
  20. package/claude-plugin/mcp/vizzly-docs-server/index.js +0 -283
  21. package/claude-plugin/mcp/vizzly-server/cloud-api-provider.js +0 -399
  22. package/claude-plugin/mcp/vizzly-server/index.js +0 -927
  23. package/claude-plugin/mcp/vizzly-server/local-tdd-provider.js +0 -455
  24. package/claude-plugin/mcp/vizzly-server/token-resolver.js +0 -185
  25. package/claude-plugin/skills/check-visual-tests/SKILL.md +0 -158
  26. package/claude-plugin/skills/debug-visual-regression/SKILL.md +0 -269
  27. package/docs/api-reference.md +0 -1003
  28. package/docs/authentication.md +0 -334
  29. package/docs/doctor-command.md +0 -44
  30. package/docs/getting-started.md +0 -131
  31. package/docs/internal/SDK-API.md +0 -1018
  32. package/docs/plugins.md +0 -557
  33. package/docs/tdd-mode.md +0 -594
  34. package/docs/test-integration.md +0 -523
  35. package/docs/tui-elements.md +0 -560
  36. package/docs/upload-command.md +0 -196
@@ -1,270 +0,0 @@
1
- # Vizzly Claude Code Plugin
2
-
3
- > Integrate Vizzly visual regression testing seamlessly into your Claude Code workflow
4
-
5
- This plugin brings Vizzly's powerful visual testing capabilities directly into Claude Code, helping you debug visual regressions, manage baselines, and integrate visual testing into your development workflow—all with AI assistance.
6
-
7
- ## Installation
8
-
9
- ### From GitHub (Recommended)
10
-
11
- ```bash
12
- # Add the marketplace
13
- /plugin marketplace add vizzly-testing/vizzly-cli
14
-
15
- # Install the plugin
16
- /plugin install vizzly@vizzly-marketplace
17
- ```
18
-
19
- ### From Local Source
20
-
21
- ```bash
22
- # Clone the repository
23
- git clone https://github.com/vizzly-testing/vizzly-cli.git
24
- cd vizzly-cli
25
-
26
- # Add the marketplace
27
- /plugin marketplace add ./.claude-plugin
28
-
29
- # Install the plugin
30
- /plugin install vizzly@vizzly-marketplace
31
- ```
32
-
33
- ## Migration Guide (v0.0.x → v0.1.0)
34
-
35
- **⚠️ Breaking Changes:** Slash commands for status checking and debugging have been replaced with Agent Skills.
36
-
37
- ### What Changed
38
-
39
- **Before (v0.0.x):**
40
- ```bash
41
- # Manually invoke slash commands
42
- /vizzly:tdd-status
43
- /vizzly:debug-diff homepage
44
- ```
45
-
46
- **After (v0.1.0):**
47
- ```bash
48
- # Just ask naturally - Skills activate automatically
49
- "How are my visual tests?"
50
- "The homepage screenshot is failing"
51
- ```
52
-
53
- ### Command Migration
54
-
55
- | Old Slash Command | New Approach | How It Works |
56
- |-------------------|--------------|--------------|
57
- | `/vizzly:tdd-status` | Ask: "How are my tests?" | `check-visual-tests` Skill activates automatically |
58
- | `/vizzly:debug-diff <name>` | Say: "Debug the homepage screenshot" | `debug-visual-regression` Skill activates automatically |
59
- | `/vizzly:setup` | Still `/vizzly:setup` | ✅ No change - explicit setup workflow |
60
- | `/vizzly:suggest-screenshots` | Still `/vizzly:suggest-screenshots` | ✅ No change - explicit suggestions workflow |
61
-
62
- ### Why This Change?
63
-
64
- **Better UX:**
65
- - No need to memorize command syntax
66
- - Just describe what you need in natural language
67
- - Claude understands your intent and activates the right Skill
68
- - More intuitive and conversational workflow
69
-
70
- **What Are Agent Skills?**
71
-
72
- Agent Skills are model-invoked capabilities that Claude uses autonomously based on your request. Instead of explicitly typing `/command`, you simply ask questions or describe problems, and Claude will automatically use the appropriate Skill.
73
-
74
- **Still Prefer Explicit Commands?**
75
-
76
- You can still be explicit in your requests:
77
- - "Check my Vizzly test status" → Activates `check-visual-tests` Skill
78
- - "Debug the login screenshot failure" → Activates `debug-visual-regression` Skill
79
-
80
- The Skills will activate based on your intent, not rigid command syntax.
81
-
82
- ## Features
83
-
84
- ### ✨ **Agent Skills** (Model-Invoked)
85
-
86
- Claude automatically uses these Skills when you mention visual testing:
87
-
88
- **🐛 Debug Visual Regression**
89
- - Activated when you mention failing visual tests or screenshot differences
90
- - Automatically analyzes visual changes, identifies root causes
91
- - Compares baseline vs current screenshots
92
- - Suggests whether to accept or fix changes
93
- - Works with both local TDD and cloud modes
94
-
95
- **🔍 Check Visual Test Status**
96
- - Activated when you ask about test status or results
97
- - Provides quick summary of passed/failed/new screenshots
98
- - Shows diff percentages and threshold information
99
- - Links to dashboard for detailed review
100
-
101
- **Example usage:**
102
- - Just say: *"The homepage screenshot is failing"* → Claude debugs it
103
- - Just ask: *"How are my visual tests?"* → Claude checks status
104
- - No slash commands needed—Claude activates Skills automatically!
105
-
106
- ### 📋 **Slash Commands** (User-Invoked)
107
-
108
- Explicit workflows you trigger manually:
109
-
110
- **⚡ Quick Setup**
111
- - `/vizzly:setup` - Initialize Vizzly configuration
112
- - Environment variable guidance
113
- - CI/CD integration help
114
-
115
- **💡 Screenshot Suggestions**
116
- - `/vizzly:suggest-screenshots` - Analyze test files for screenshot opportunities
117
- - Framework-specific code examples
118
- - Respect your test structure and patterns
119
-
120
- ### Skills vs Slash Commands
121
-
122
- **Skills** are capabilities Claude uses autonomously based on your request. Just describe what you need naturally, and Claude will use the appropriate Skill.
123
-
124
- **Slash Commands** are explicit workflows you invoke manually when you want step-by-step guidance through a process.
125
-
126
- ## MCP Server Tools
127
-
128
- The plugin provides an MCP server with direct access to Vizzly data:
129
-
130
- ### Local TDD Tools
131
- - `detect_context` - Detect if using local TDD or cloud mode
132
- - `get_tdd_status` - Get current TDD comparison results
133
- - Parameters:
134
- - `statusFilter` (optional): Filter by status - `'failed'`, `'new'`, `'passed'`, `'all'`, or `'summary'` (default)
135
- - `limit` (optional): Maximum number of comparisons to return
136
- - Default behavior (summary mode): Returns counts only without full comparison details for efficiency
137
- - `read_comparison_details` - Detailed info for specific screenshot
138
- - `accept_baseline` - Accept a screenshot as new baseline
139
- - `reject_baseline` - Reject a baseline with reason
140
-
141
- ### Cloud API Tools
142
- - `list_recent_builds` - List recent builds with filtering
143
- - `get_build_status` - Get build status with commit context
144
- - `get_comparison` - Get comparison details with screenshots
145
- - `approve_comparison` - Approve a comparison with comment
146
- - `reject_comparison` - Reject a comparison with reason
147
- - `create_build_comment` - Add comment to build
148
-
149
- ## Authentication
150
-
151
- The plugin automatically uses your Vizzly authentication with the following priority:
152
-
153
- 1. **Explicitly provided token** (via tool parameters)
154
- 2. **Environment variable** (`VIZZLY_TOKEN`)
155
- 3. **Project mapping** (configured via `vizzly project:select`)
156
- 4. **User access token** (from `vizzly login`)
157
-
158
- ### Getting Started
159
-
160
- **For local development:**
161
- ```bash
162
- vizzly login # Authenticate with your Vizzly account
163
- vizzly project:select # Optional: set project-specific token
164
- ```
165
-
166
- **For CI/CD:**
167
- ```bash
168
- export VIZZLY_TOKEN=vzt_your_project_token
169
- ```
170
-
171
- The plugin will automatically use the appropriate token based on your context.
172
-
173
- ## Requirements
174
-
175
- - Claude Code
176
- - Node.js 20+
177
- - Vizzly CLI (`@vizzly-testing/cli`) installed in your project
178
- - TDD mode running for local features
179
- - Authentication configured (see above) for cloud features
180
-
181
- ## How It Works
182
-
183
- ### Agent Skills
184
-
185
- The plugin's Skills use Claude Code's `allowed-tools` feature to restrict what actions they can perform:
186
-
187
- **Check Visual Test Status Skill:**
188
- - Can use: `get_tdd_status`, `detect_context`
189
- - Purpose: Quickly check test status without modifying anything
190
-
191
- **Debug Visual Regression Skill:**
192
- - Can use: `Read`, `WebFetch`, `read_comparison_details`, `accept_baseline`, `approve_comparison`, `reject_comparison`
193
- - Purpose: Analyze failures and suggest/apply fixes
194
-
195
- ### MCP Server Integration
196
-
197
- The plugin bundles an MCP server that provides 15 tools for interacting with Vizzly:
198
-
199
- - **Automatic startup** - MCP server starts when plugin is enabled
200
- - **Token resolution** - Automatically finds your authentication token
201
- - **Dual mode** - Works with both local TDD and cloud builds
202
- - **No configuration needed** - Just install and use
203
-
204
- ## Troubleshooting
205
-
206
- ### Skills not activating
207
-
208
- If Claude isn't using the Skills automatically:
209
-
210
- 1. Verify plugin is enabled: `/plugin`
211
- 2. Check MCP server status: `/mcp` (should show `plugin:vizzly:vizzly`)
212
- 3. Try being more explicit: "Check my Vizzly test status"
213
-
214
- ### MCP server not connecting
215
-
216
- If the MCP server shows as "failed" in `/mcp`:
217
-
218
- 1. Check Node.js version: `node --version` (requires 20+)
219
- 2. View logs: `claude --debug`
220
- 3. Reinstall plugin: `/plugin uninstall vizzly@vizzly-marketplace` then `/plugin install vizzly@vizzly-marketplace`
221
-
222
- ### TDD server not found
223
-
224
- If Skills report "TDD server not running":
225
-
226
- 1. Start TDD mode: `vizzly tdd start`
227
- 2. Verify server is running: Check for `.vizzly/server.json`
228
- 3. Run tests to generate screenshots
229
-
230
- ## Example Workflows
231
-
232
- ### Local TDD Development
233
-
234
- ```bash
235
- # Start TDD server
236
- vizzly tdd start
237
-
238
- # Run your tests
239
- npm test
240
-
241
- # Ask Claude to check status
242
- # "How are my visual tests?"
243
-
244
- # If failures, ask Claude to debug
245
- # "The login page screenshot is failing"
246
- ```
247
-
248
- ### Cloud Build Review
249
-
250
- ```bash
251
- # After CI/CD runs and creates a build
252
- # "Show me recent Vizzly builds"
253
-
254
- # Review specific comparison
255
- # "Analyze comparison cmp_abc123"
256
-
257
- # Approve or reject
258
- # Claude will suggest using approve/reject tools
259
- ```
260
-
261
- ## Documentation
262
-
263
- - [Vizzly CLI](https://github.com/vizzly-testing/vizzly-cli) - Official CLI documentation
264
- - [Vizzly Platform](https://vizzly.dev) - Web dashboard and cloud features
265
- - [Claude Code](https://claude.com/claude-code) - Claude Code documentation
266
- - [Agent Skills](https://docs.claude.com/en/docs/claude-code/skills) - Learn about Claude Code Skills
267
-
268
- ## License
269
-
270
- MIT © Vizzly Team
@@ -1,28 +0,0 @@
1
- {
2
- "name": "vizzly-marketplace",
3
- "owner": {
4
- "name": "Vizzly Team",
5
- "email": "team@vizzly.dev"
6
- },
7
- "metadata": {
8
- "description": "Official Vizzly plugin for Claude Code - visual regression testing integration with TDD workflow support",
9
- "version": "0.1.0"
10
- },
11
- "plugins": [
12
- {
13
- "name": "vizzly",
14
- "source": "./",
15
- "description": "Visual regression testing integration for Vizzly - TDD workflow support and debugging tools",
16
- "version": "0.1.0",
17
- "author": {
18
- "name": "Vizzly Team",
19
- "url": "https://vizzly.dev"
20
- },
21
- "homepage": "https://vizzly.dev",
22
- "repository": "https://github.com/vizzly-testing/vizzly-cli",
23
- "license": "MIT",
24
- "keywords": ["visual-testing", "regression-testing", "tdd", "screenshot-testing", "vizzly"],
25
- "category": "testing"
26
- }
27
- ]
28
- }
@@ -1,14 +0,0 @@
1
- {
2
- "name": "vizzly",
3
- "version": "0.1.0",
4
- "description": "Visual regression testing integration for Vizzly - TDD workflow support and debugging tools",
5
- "author": {
6
- "name": "Vizzly Team",
7
- "url": "https://vizzly.dev"
8
- },
9
- "homepage": "https://vizzly.dev",
10
- "repository": "https://github.com/vizzly-testing/cli",
11
- "license": "MIT",
12
- "keywords": ["visual-testing", "regression-testing", "tdd", "screenshot-testing", "vizzly"],
13
- "mcpServers": "./.mcp.json"
14
- }
@@ -1,12 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "vizzly": {
4
- "command": "node",
5
- "args": ["${CLAUDE_PLUGIN_ROOT}/mcp/vizzly-server/index.js"]
6
- },
7
- "vizzly-docs": {
8
- "command": "node",
9
- "args": ["${CLAUDE_PLUGIN_ROOT}/mcp/vizzly-docs-server/index.js"]
10
- }
11
- }
12
- }
@@ -1,85 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to the Vizzly Claude Code plugin will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ### Added
11
- - 📚 **New MCP Server:** `vizzly-docs` - Easy access to Vizzly documentation
12
- - `list_docs` - Browse all docs with optional category filtering
13
- - `get_doc` - Retrieve full markdown content for any doc page
14
- - `search_docs` - Keyword search across titles, descriptions, and categories
15
- - `get_sidebar` - View complete documentation navigation structure
16
- - Fetches from live docs.vizzly.dev site with intelligent caching
17
- - ⚡️ **Performance:** `get_tdd_status` now supports filtering and pagination
18
- - New `statusFilter` parameter: `'failed'`, `'new'`, `'passed'`, `'all'`, or `'summary'` (default)
19
- - New `limit` parameter for capping number of comparisons returned
20
- - Default behavior (summary mode) returns only counts for better token efficiency
21
- - 🔧 **API Enhancement:** Cloud API provider now includes approval status and flaky screenshot detection
22
- - Added approval status breakdown (pending/approved/rejected/auto_approved)
23
- - Added flaky screenshot count
24
- - Added hot spot coverage metadata for quick triage
25
-
26
- ### Changed
27
- - 🔧 **Internal:** `acceptBaseline()` in TDD service now accepts both comparison ID (string) or full comparison object
28
- - Enables accepting baselines from report-data.json without in-memory lookup
29
- - Fixes issue where accepting from dashboard wasn't working properly
30
-
31
- ### Fixed
32
- - 🐛 Fixed path bug in local TDD provider: `screenshots/` → `current/` directory
33
- - 🐛 Fixed API field mapping in cloud provider: API returns `result` not `status`
34
-
35
- ## [0.1.0] - 2025-10-18
36
-
37
- ### Added
38
- - ✨ **Agent Skills** - Model-invoked capabilities that activate autonomously
39
- - `check-visual-tests` Skill - Automatically checks test status when you ask about tests
40
- - `debug-visual-regression` Skill - Automatically analyzes failures when you mention visual issues
41
- - 📦 MCP server configuration moved to plugin root (`.mcp.json`)
42
- - 📝 Comprehensive README with Skills documentation, troubleshooting, and workflows
43
- - 🔒 Tool restrictions via `allowed-tools` for better security and focused capabilities
44
-
45
- ### Changed
46
- - 🔧 MCP server name: `vizzly-server` → `vizzly` (cleaner naming)
47
- - 🔧 Skills use correct tool prefix: `mcp__plugin_vizzly_vizzly__*`
48
-
49
- ### Removed
50
- - ❌ **BREAKING:** `/vizzly:tdd-status` slash command → Replaced by `check-visual-tests` Skill
51
- - ❌ **BREAKING:** `/vizzly:debug-diff` slash command → Replaced by `debug-visual-regression` Skill
52
-
53
- ### Migration Guide
54
-
55
- **Before (v0.0.x):**
56
- ```bash
57
- # Manually invoke slash commands
58
- /vizzly:tdd-status
59
- /vizzly:debug-diff homepage
60
- ```
61
-
62
- **After (v0.1.0):**
63
- ```bash
64
- # Just ask naturally - Skills activate automatically
65
- "How are my visual tests?"
66
- "The homepage screenshot is failing"
67
- ```
68
-
69
- **What Changed:**
70
- - **Status checks** are now autonomous - just ask about your tests
71
- - **Debugging** happens automatically when you mention failures
72
- - **No need to remember slash commands** - Claude understands your intent
73
- - **Setup and suggestions** still use slash commands (`/vizzly:setup`, `/vizzly:suggest-screenshots`)
74
-
75
- **Why This Change:**
76
- Agent Skills provide a more natural, intuitive experience. Instead of memorizing command syntax, you can ask questions in plain language and Claude will automatically use the right tools.
77
-
78
- **If You Prefer Explicit Commands:**
79
- While the slash commands are removed, you can still be explicit in your requests:
80
- - "Check my Vizzly test status" → Activates `check-visual-tests` Skill
81
- - "Debug the homepage screenshot" → Activates `debug-visual-regression` Skill
82
-
83
- ### Fixed
84
- - MCP server location now follows Claude Code plugin specifications
85
- - Tool naming consistency across Skills and MCP server
@@ -1,137 +0,0 @@
1
- ---
2
- description: Initialize Vizzly visual testing in a project
3
- ---
4
-
5
- # Setup Vizzly in Project
6
-
7
- Help the user set up Vizzly visual regression testing in their project.
8
-
9
- ## Setup Steps
10
-
11
- **Execute steps 1-5 to complete the CLI setup, then proceed to step 6 for SDK recommendations.**
12
-
13
- 1. **Check if Vizzly is already configured**
14
- - Look for `vizzly.config.js` in the project root
15
- - Check if `@vizzly-testing/cli` is in package.json
16
- - If already configured, inform the user and exit
17
-
18
- 2. **Install Vizzly CLI**
19
-
20
- Run this command:
21
-
22
- ```bash
23
- npm install --save-dev @vizzly-testing/cli
24
- ```
25
-
26
- 3. **Initialize configuration**
27
-
28
- Run this command:
29
-
30
- ```bash
31
- npx vizzly init
32
- ```
33
-
34
- This creates `vizzly.config.js` with sensible defaults.
35
-
36
- 4. **Add .vizzly/ to .gitignore**
37
-
38
- Add `.vizzly/` to the project's `.gitignore` file to avoid committing local TDD artifacts.
39
-
40
- 5. **Environment Variables**
41
-
42
- Present the user with instructions to set up their API token:
43
-
44
- **For local development:**
45
- Create a `.env` file:
46
-
47
- ```
48
- VIZZLY_TOKEN=your-api-token-here
49
- ```
50
-
51
- Add `.env` to `.gitignore`
52
-
53
- **For CI/CD:**
54
- Add `VIZZLY_TOKEN` as a secret in their CI provider
55
-
56
- 6. **Next Steps**
57
-
58
- After CLI setup is complete, detect the project type and recommend the appropriate SDK:
59
-
60
- **SDK Detection Priority (check in this order):**
61
- - **Ruby**: Check for `Gemfile` → Recommend Ruby SDK
62
- - **Storybook**: Check for `@storybook/*` in package.json or `.storybook/` directory → Recommend Storybook SDK
63
- - **Static Site**: Check for static site generators (`astro`, `next`, `gatsby`, `vitepress`, `eleventy` in package.json) or build directories (`dist/`, `build/`, `.next/out/`, `_site/`) → Recommend Static Site SDK
64
- - **JavaScript/Node.js**: Check for `package.json` → Recommend JavaScript SDK
65
-
66
- **Present the detected SDK recommendation:**
67
-
68
- For Ruby:
69
-
70
- ```
71
- 📦 Next: Install the Ruby SDK
72
- gem install vizzly
73
-
74
- Documentation: https://docs.vizzly.dev/integration/sdk/ruby/overview
75
- ```
76
-
77
- For Storybook:
78
-
79
- ```
80
- 📦 Next: Install the Storybook SDK
81
- npm install --save-dev @vizzly-testing/storybook
82
-
83
- Documentation: https://docs.vizzly.dev/integration/sdk/storybook/overview
84
- ```
85
-
86
- For Static Site:
87
-
88
- ```
89
- 📦 Next: Install the Static Site SDK
90
- npm install --save-dev @vizzly-testing/static-site
91
-
92
- Documentation: https://docs.vizzly.dev/integration/sdk/static-site/overview
93
- ```
94
-
95
- For JavaScript:
96
-
97
- ```
98
- 📦 Next: Use the JavaScript SDK (already included with the CLI)
99
-
100
- Documentation: https://docs.vizzly.dev/integration/sdk/javascript/overview
101
- ```
102
-
103
- **End with this context summary:**
104
-
105
- ```
106
- ✅ Setup Complete
107
-
108
- What was accomplished:
109
- - Vizzly CLI installed
110
- - Configuration file created (vizzly.config.js)
111
- - .vizzly/ added to .gitignore
112
- - Environment variable instructions provided
113
-
114
- What's next:
115
- - Install the recommended SDK (see above)
116
- - Add screenshot capture to your tests (if needed)
117
- - Run `vizzly tdd start` to test locally
118
-
119
- [For Claude: The CLI is now installed and configured. When the user returns saying they installed the SDK, help them integrate it into their tests and start capturing screenshots. The workflow is: install SDK → add screenshot calls to tests → run vizzly tdd to verify locally.]
120
- ```
121
-
122
- ## What NOT to Do
123
-
124
- - Do not modify their test files
125
- - Do not generate example test code
126
- - Do not make assumptions about their test framework
127
- - Do not create new test files
128
-
129
- ## What to Provide
130
-
131
- - Installation commands
132
- - Configuration file creation
133
- - Environment setup guidance
134
- - Links to documentation
135
- - Next steps for integration
136
-
137
- Let the user integrate Vizzly into their existing tests themselves. Vizzly works with any test framework that can capture screenshots.
@@ -1,111 +0,0 @@
1
- ---
2
- description: Analyze test files and suggest where visual screenshots would be valuable
3
- ---
4
-
5
- # Suggest Screenshot Opportunities
6
-
7
- Analyze existing test files to identify ideal locations for visual regression testing.
8
-
9
- ## Process
10
-
11
- 1. **Detect SDK type** (same logic as setup command)
12
-
13
- **If Storybook detected** (`@storybook/*` in package.json or `.storybook/` directory):
14
- - Inform user that Storybook SDK auto-discovers all stories
15
- - No manual screenshot calls needed
16
- - Exit early
17
-
18
- **If Static Site detected** (build directories like `dist/`, `build/`, `.next/out/` or static site generators):
19
- - Inform user that Static Site SDK auto-discovers all pages
20
- - No manual screenshot calls needed
21
- - Exit early
22
-
23
- **Otherwise continue** with test file analysis below.
24
-
25
- 2. **Ask user for test directory** if not obvious (e.g., `tests/`, `e2e/`, `__tests__/`, `spec/`)
26
-
27
- 3. **Find test files** using glob patterns:
28
- - `**/*.test.{js,ts,jsx,tsx}`
29
- - `**/*.spec.{js,ts,jsx,tsx}`
30
- - `**/e2e/**/*.{js,ts}`
31
-
32
- **IMPORTANT: Exclude these directories:**
33
- - `node_modules/`
34
- - `dist/`, `build/`, `out/`
35
- - `.next/`, `.nuxt/`, `.vite/`
36
- - `coverage/`, `.nyc_output/`
37
- - `vendor/`
38
- - Any hidden directories (`.*/`)
39
-
40
- Use the Glob tool with explicit exclusion or filter results to avoid these directories.
41
-
42
- 4. **Analyze test files** looking for:
43
- - Page navigations (`.goto()`, `.visit()`, `navigate()`)
44
- - User interactions before assertions (`.click()`, `.type()`, `.fill()`)
45
- - Component rendering (React Testing Library, etc.)
46
- - Visual assertions or wait conditions
47
-
48
- 5. **Suggest screenshot points** where:
49
- - After page loads or navigations
50
- - After key user interactions
51
- - Before visual assertions
52
- - At different viewport sizes
53
- - For different user states (logged in/out, etc.)
54
-
55
- 6. **Provide code examples** specific to their test framework:
56
-
57
- **Playwright:**
58
-
59
- ```javascript
60
- import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
61
-
62
- // After page navigation
63
- await page.goto('/dashboard');
64
- await vizzlyScreenshot('dashboard-logged-in', await page.screenshot(), {
65
- browser: 'chrome',
66
- viewport: '1920x1080'
67
- });
68
- ```
69
-
70
- **Cypress:**
71
-
72
- ```javascript
73
- cy.visit('/login');
74
- cy.screenshot('login-page');
75
- // Then add vizzlyScreenshot in custom command
76
- ```
77
-
78
- ## Output Format
79
-
80
- ```
81
- Found 8 potential screenshot opportunities in your tests:
82
-
83
- tests/e2e/auth.spec.js:
84
- Line 15: After login page navigation
85
- Suggested screenshot: 'login-page'
86
- Reason: Page load after navigation
87
-
88
- Line 28: After successful login
89
- Suggested screenshot: 'dashboard-authenticated'
90
- Reason: User state change (logged in)
91
-
92
- tests/e2e/checkout.spec.js:
93
- Line 42: Shopping cart with items
94
- Suggested screenshot: 'cart-with-items'
95
- Reason: Visual state after user interaction
96
-
97
- Line 67: Checkout confirmation page
98
- Suggested screenshot: 'order-confirmation'
99
- Reason: Final state of user flow
100
-
101
- Example integration for Playwright:
102
- [Provide code example specific to their test]
103
- ```
104
-
105
- ## Important Notes
106
-
107
- - **Do NOT modify test files**
108
- - **Do NOT create new test files**
109
- - Only provide suggestions and examples
110
- - Let the user decide where to add screenshots
111
- - Respect their test framework and structure