@vizzly-testing/cli 0.10.3 → 0.11.1
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.
- package/README.md +168 -8
- package/claude-plugin/.claude-plugin/.mcp.json +8 -0
- package/claude-plugin/.claude-plugin/README.md +114 -0
- package/claude-plugin/.claude-plugin/marketplace.json +28 -0
- package/claude-plugin/.claude-plugin/plugin.json +14 -0
- package/claude-plugin/commands/debug-diff.md +153 -0
- package/claude-plugin/commands/setup.md +137 -0
- package/claude-plugin/commands/suggest-screenshots.md +111 -0
- package/claude-plugin/commands/tdd-status.md +43 -0
- package/claude-plugin/mcp/vizzly-server/cloud-api-provider.js +354 -0
- package/claude-plugin/mcp/vizzly-server/index.js +861 -0
- package/claude-plugin/mcp/vizzly-server/local-tdd-provider.js +422 -0
- package/claude-plugin/mcp/vizzly-server/token-resolver.js +185 -0
- package/dist/cli.js +64 -0
- package/dist/client/index.js +13 -3
- package/dist/commands/login.js +195 -0
- package/dist/commands/logout.js +71 -0
- package/dist/commands/project.js +351 -0
- package/dist/commands/run.js +30 -0
- package/dist/commands/whoami.js +162 -0
- package/dist/plugin-loader.js +9 -15
- package/dist/sdk/index.js +16 -4
- package/dist/services/api-service.js +50 -7
- package/dist/services/auth-service.js +226 -0
- package/dist/types/client/index.d.ts +9 -3
- package/dist/types/commands/login.d.ts +11 -0
- package/dist/types/commands/logout.d.ts +11 -0
- package/dist/types/commands/project.d.ts +28 -0
- package/dist/types/commands/whoami.d.ts +11 -0
- package/dist/types/sdk/index.d.ts +9 -4
- package/dist/types/services/api-service.d.ts +2 -1
- package/dist/types/services/auth-service.d.ts +59 -0
- package/dist/types/utils/browser.d.ts +6 -0
- package/dist/types/utils/config-loader.d.ts +1 -1
- package/dist/types/utils/config-schema.d.ts +8 -174
- package/dist/types/utils/file-helpers.d.ts +18 -0
- package/dist/types/utils/global-config.d.ts +84 -0
- package/dist/utils/browser.js +44 -0
- package/dist/utils/config-loader.js +69 -3
- package/dist/utils/file-helpers.js +64 -0
- package/dist/utils/global-config.js +259 -0
- package/docs/api-reference.md +177 -6
- package/docs/authentication.md +334 -0
- package/docs/getting-started.md +21 -2
- package/docs/plugins.md +27 -0
- package/docs/test-integration.md +60 -10
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -36,16 +36,44 @@ npm install -g @vizzly-testing/cli
|
|
|
36
36
|
vizzly init
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### Authentication
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Vizzly supports two authentication methods:
|
|
42
42
|
|
|
43
|
+
**Option 1: User Authentication (Recommended for local development)**
|
|
44
|
+
```bash
|
|
45
|
+
# Authenticate with your Vizzly account
|
|
46
|
+
vizzly login
|
|
47
|
+
|
|
48
|
+
# Optional: Configure project-specific token
|
|
49
|
+
vizzly project:select
|
|
50
|
+
|
|
51
|
+
# Run tests
|
|
52
|
+
vizzly run "npm test"
|
|
43
53
|
```
|
|
44
|
-
|
|
54
|
+
|
|
55
|
+
**Option 2: API Token (Recommended for CI/CD)**
|
|
56
|
+
```bash
|
|
57
|
+
# Set via environment variable
|
|
58
|
+
export VIZZLY_TOKEN=your-project-token
|
|
59
|
+
|
|
60
|
+
# Run tests
|
|
61
|
+
vizzly run "npm test"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For local development with `.env` files:
|
|
65
|
+
```
|
|
66
|
+
VIZZLY_TOKEN=your-project-token
|
|
45
67
|
```
|
|
46
68
|
|
|
47
69
|
Then add `.env` to your `.gitignore` file. For CI/CD, use your provider's secret management system.
|
|
48
70
|
|
|
71
|
+
**Token Priority:**
|
|
72
|
+
1. CLI flag (`--token`)
|
|
73
|
+
2. Environment variable (`VIZZLY_TOKEN`)
|
|
74
|
+
3. Project mapping (configured via `vizzly project:select`)
|
|
75
|
+
4. User access token (from `vizzly login`)
|
|
76
|
+
|
|
49
77
|
### Upload existing screenshots
|
|
50
78
|
|
|
51
79
|
```bash
|
|
@@ -67,14 +95,19 @@ vizzly tdd run "npm test"
|
|
|
67
95
|
```javascript
|
|
68
96
|
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
69
97
|
|
|
70
|
-
//
|
|
98
|
+
// Option 1: Using a Buffer
|
|
71
99
|
const screenshot = await page.screenshot();
|
|
72
|
-
|
|
73
|
-
// Send to Vizzly for review
|
|
74
100
|
await vizzlyScreenshot('homepage', screenshot, {
|
|
75
101
|
browser: 'chrome',
|
|
76
102
|
viewport: '1920x1080'
|
|
77
103
|
});
|
|
104
|
+
|
|
105
|
+
// Option 2: Using a file path
|
|
106
|
+
await page.screenshot({ path: './screenshots/homepage.png' });
|
|
107
|
+
await vizzlyScreenshot('homepage', './screenshots/homepage.png', {
|
|
108
|
+
browser: 'chrome',
|
|
109
|
+
viewport: '1920x1080'
|
|
110
|
+
});
|
|
78
111
|
```
|
|
79
112
|
|
|
80
113
|
> **Multi-Language Support**: Currently available as a JavaScript/Node.js SDK with Python, Ruby, and
|
|
@@ -83,6 +116,84 @@ await vizzlyScreenshot('homepage', screenshot, {
|
|
|
83
116
|
|
|
84
117
|
## Commands
|
|
85
118
|
|
|
119
|
+
### Authentication Commands
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
vizzly login # Authenticate with your Vizzly account
|
|
123
|
+
vizzly logout # Clear stored authentication tokens
|
|
124
|
+
vizzly whoami # Show current user and authentication status
|
|
125
|
+
vizzly project:select # Configure project-specific token
|
|
126
|
+
vizzly project:list # Show all configured projects
|
|
127
|
+
vizzly project:token # Display project token for current directory
|
|
128
|
+
vizzly project:remove # Remove project configuration
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Login Command
|
|
132
|
+
Authenticate using OAuth 2.0 device flow. Opens your browser to authorize the CLI with your Vizzly account.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Interactive browser-based login
|
|
136
|
+
vizzly login
|
|
137
|
+
|
|
138
|
+
# JSON output for scripting
|
|
139
|
+
vizzly login --json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Features:**
|
|
143
|
+
- Browser auto-opens with pre-filled device code
|
|
144
|
+
- Secure OAuth 2.0 device authorization flow
|
|
145
|
+
- 30-day token expiry with automatic refresh
|
|
146
|
+
- Tokens stored securely in `~/.vizzly/config.json` with 0600 permissions
|
|
147
|
+
|
|
148
|
+
#### Logout Command
|
|
149
|
+
Clear all stored authentication tokens from your machine.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Clear all tokens
|
|
153
|
+
vizzly logout
|
|
154
|
+
|
|
155
|
+
# JSON output
|
|
156
|
+
vizzly logout --json
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Revokes tokens on the server and removes them from local storage.
|
|
160
|
+
|
|
161
|
+
#### Whoami Command
|
|
162
|
+
Display current authentication status, user information, and organizations.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Show user and authentication info
|
|
166
|
+
vizzly whoami
|
|
167
|
+
|
|
168
|
+
# JSON output for scripting
|
|
169
|
+
vizzly whoami --json
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Shows:
|
|
173
|
+
- Current user email and name
|
|
174
|
+
- Organizations you belong to
|
|
175
|
+
- Token status and expiry
|
|
176
|
+
- Project mappings (if any)
|
|
177
|
+
|
|
178
|
+
#### Project Commands
|
|
179
|
+
Configure directory-specific project tokens for multi-project workflows.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Select a project for current directory
|
|
183
|
+
vizzly project:select
|
|
184
|
+
|
|
185
|
+
# List all configured projects
|
|
186
|
+
vizzly project:list
|
|
187
|
+
|
|
188
|
+
# Show token for current directory
|
|
189
|
+
vizzly project:token
|
|
190
|
+
|
|
191
|
+
# Remove project configuration
|
|
192
|
+
vizzly project:remove
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Use case:** Working on multiple Vizzly projects? Configure each project directory with its specific token. The CLI automatically uses the right token based on your current directory.
|
|
196
|
+
|
|
86
197
|
### Upload Screenshots
|
|
87
198
|
```bash
|
|
88
199
|
vizzly upload <directory> # Upload screenshots from directory
|
|
@@ -360,12 +471,52 @@ The `--wait` flag ensures the process:
|
|
|
360
471
|
### `vizzlyScreenshot(name, imageBuffer, properties)`
|
|
361
472
|
Send a screenshot to Vizzly.
|
|
362
473
|
- `name` (string): Screenshot identifier
|
|
363
|
-
- `imageBuffer` (Buffer): Image data
|
|
474
|
+
- `imageBuffer` (Buffer | string): Image data as Buffer, or file path to an image
|
|
364
475
|
- `properties` (object): Metadata for organization
|
|
365
476
|
|
|
477
|
+
**File Path Support:**
|
|
478
|
+
- Accepts both absolute and relative paths
|
|
479
|
+
- Automatically reads the file and converts to Buffer internally
|
|
480
|
+
- Works with any PNG image file
|
|
481
|
+
|
|
366
482
|
### `isVizzlyEnabled()`
|
|
367
483
|
Check if Vizzly is enabled in the current environment.
|
|
368
484
|
|
|
485
|
+
## AI & Editor Integrations
|
|
486
|
+
|
|
487
|
+
### Claude Code Plugin
|
|
488
|
+
|
|
489
|
+
Vizzly includes built-in support for [Claude Code](https://claude.com/code), Anthropic's official CLI tool. The integration brings AI-powered visual testing workflows directly into your development environment.
|
|
490
|
+
|
|
491
|
+
**Features:**
|
|
492
|
+
- 🤖 **AI-assisted debugging** - Get intelligent analysis of visual regressions
|
|
493
|
+
- 📊 **TDD status insights** - Check dashboard status with contextual suggestions
|
|
494
|
+
- 🔍 **Smart diff analysis** - AI helps determine if changes should be accepted or fixed
|
|
495
|
+
- ✨ **Test coverage suggestions** - Get framework-specific screenshot recommendations
|
|
496
|
+
- 🛠️ **Interactive setup** - Guided configuration and CI/CD integration help
|
|
497
|
+
|
|
498
|
+
**Getting Started with Claude Code:**
|
|
499
|
+
|
|
500
|
+
1. **Install Claude Code** (if you haven't already):
|
|
501
|
+
```bash
|
|
502
|
+
npm install -g @anthropic-ai/claude-code
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
2. **Install the Vizzly plugin** via Claude Code marketplace:
|
|
506
|
+
```
|
|
507
|
+
/plugin marketplace add vizzly-testing/cli
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
3. **Use AI-powered workflows** with slash commands:
|
|
511
|
+
```
|
|
512
|
+
/vizzly:tdd-status # Check TDD dashboard with AI insights
|
|
513
|
+
/vizzly:debug-diff homepage # Analyze visual failures with AI
|
|
514
|
+
/vizzly:suggest-screenshots # Find test coverage gaps
|
|
515
|
+
/vizzly:setup # Interactive setup wizard
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
The plugin works seamlessly with both local TDD mode and cloud builds, providing contextual help based on your current workflow.
|
|
519
|
+
|
|
369
520
|
## Plugin Ecosystem
|
|
370
521
|
|
|
371
522
|
Vizzly supports a powerful plugin system that allows you to extend the CLI with custom
|
|
@@ -374,6 +525,7 @@ explicitly configured.
|
|
|
374
525
|
|
|
375
526
|
### Official Plugins
|
|
376
527
|
|
|
528
|
+
- **Claude Code Integration** *(built-in)* - AI-powered visual testing workflows for Claude Code
|
|
377
529
|
- **[@vizzly-testing/storybook](https://npmjs.com/package/@vizzly-testing/storybook)** *(coming
|
|
378
530
|
soon)* - Capture screenshots from Storybook builds
|
|
379
531
|
|
|
@@ -425,6 +577,7 @@ See the [Plugin Development Guide](./docs/plugins.md) for complete documentation
|
|
|
425
577
|
## Documentation
|
|
426
578
|
|
|
427
579
|
- [Getting Started](./docs/getting-started.md)
|
|
580
|
+
- [Authentication Guide](./docs/authentication.md)
|
|
428
581
|
- [Upload Command Guide](./docs/upload-command.md)
|
|
429
582
|
- [Test Integration Guide](./docs/test-integration.md)
|
|
430
583
|
- [TDD Mode Guide](./docs/tdd-mode.md)
|
|
@@ -432,10 +585,17 @@ See the [Plugin Development Guide](./docs/plugins.md) for complete documentation
|
|
|
432
585
|
- [API Reference](./docs/api-reference.md)
|
|
433
586
|
- [Doctor Command](./docs/doctor-command.md)
|
|
434
587
|
|
|
588
|
+
**AI & Editor Integrations:**
|
|
589
|
+
- Claude Code Plugin - Built-in support (see [AI & Editor Integrations](#ai--editor-integrations) above)
|
|
590
|
+
|
|
435
591
|
## Environment Variables
|
|
436
592
|
|
|
593
|
+
### Authentication
|
|
594
|
+
- `VIZZLY_TOKEN`: API authentication token (project token or access token). Example: `export VIZZLY_TOKEN=your-token`.
|
|
595
|
+
- For local development: Use `vizzly login` instead of manually managing tokens
|
|
596
|
+
- For CI/CD: Use project tokens from environment variables
|
|
597
|
+
|
|
437
598
|
### Core Configuration
|
|
438
|
-
- `VIZZLY_TOKEN`: API authentication token. Example: `export VIZZLY_TOKEN=your-token`.
|
|
439
599
|
- `VIZZLY_API_URL`: Override API base URL. Default: `https://app.vizzly.dev`.
|
|
440
600
|
- `VIZZLY_LOG_LEVEL`: Logger level. One of `debug`, `info`, `warn`, `error`. Example: `export VIZZLY_LOG_LEVEL=debug`.
|
|
441
601
|
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
## Features
|
|
34
|
+
|
|
35
|
+
### 🔍 **TDD Status Checking**
|
|
36
|
+
- `/vizzly:tdd-status` - Check current TDD status and comparison results
|
|
37
|
+
- See failed/new/passed screenshot counts
|
|
38
|
+
- Direct links to diff images and dashboard
|
|
39
|
+
|
|
40
|
+
### 🐛 **Smart Diff Analysis**
|
|
41
|
+
- `/vizzly:debug-diff <screenshot-name>` - Analyze visual regression failures
|
|
42
|
+
- AI-powered analysis with contextual suggestions
|
|
43
|
+
- Guidance on whether to accept or fix changes
|
|
44
|
+
|
|
45
|
+
### 💡 **Screenshot Suggestions**
|
|
46
|
+
- `/vizzly:suggest-screenshots` - Analyze test files for screenshot opportunities
|
|
47
|
+
- Framework-specific code examples
|
|
48
|
+
- Respect your test structure and patterns
|
|
49
|
+
|
|
50
|
+
### ⚡ **Quick Setup**
|
|
51
|
+
- `/vizzly:setup` - Initialize Vizzly configuration
|
|
52
|
+
- Environment variable guidance
|
|
53
|
+
- CI/CD integration help
|
|
54
|
+
|
|
55
|
+
## MCP Server Tools
|
|
56
|
+
|
|
57
|
+
The plugin provides an MCP server with direct access to Vizzly data:
|
|
58
|
+
|
|
59
|
+
### Local TDD Tools
|
|
60
|
+
- `detect_context` - Detect if using local TDD or cloud mode
|
|
61
|
+
- `get_tdd_status` - Get current TDD comparison results
|
|
62
|
+
- `read_comparison_details` - Detailed info for specific screenshot
|
|
63
|
+
- `accept_baseline` - Accept a screenshot as new baseline
|
|
64
|
+
- `reject_baseline` - Reject a baseline with reason
|
|
65
|
+
|
|
66
|
+
### Cloud API Tools
|
|
67
|
+
- `list_recent_builds` - List recent builds with filtering
|
|
68
|
+
- `get_build_status` - Get build status with commit context
|
|
69
|
+
- `get_comparison` - Get comparison details with screenshots
|
|
70
|
+
- `approve_comparison` - Approve a comparison with comment
|
|
71
|
+
- `reject_comparison` - Reject a comparison with reason
|
|
72
|
+
- `create_build_comment` - Add comment to build
|
|
73
|
+
|
|
74
|
+
## Authentication
|
|
75
|
+
|
|
76
|
+
The plugin automatically uses your Vizzly authentication with the following priority:
|
|
77
|
+
|
|
78
|
+
1. **Explicitly provided token** (via tool parameters)
|
|
79
|
+
2. **Environment variable** (`VIZZLY_TOKEN`)
|
|
80
|
+
3. **Project mapping** (configured via `vizzly project:select`)
|
|
81
|
+
4. **User access token** (from `vizzly login`)
|
|
82
|
+
|
|
83
|
+
### Getting Started
|
|
84
|
+
|
|
85
|
+
**For local development:**
|
|
86
|
+
```bash
|
|
87
|
+
vizzly login # Authenticate with your Vizzly account
|
|
88
|
+
vizzly project:select # Optional: set project-specific token
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**For CI/CD:**
|
|
92
|
+
```bash
|
|
93
|
+
export VIZZLY_TOKEN=vzt_your_project_token
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The plugin will automatically use the appropriate token based on your context.
|
|
97
|
+
|
|
98
|
+
## Requirements
|
|
99
|
+
|
|
100
|
+
- Claude Code
|
|
101
|
+
- Node.js 20+
|
|
102
|
+
- Vizzly CLI (`@vizzly-testing/cli`) installed in your project
|
|
103
|
+
- TDD mode running for local features
|
|
104
|
+
- Authentication configured (see above) for cloud features
|
|
105
|
+
|
|
106
|
+
## Documentation
|
|
107
|
+
|
|
108
|
+
- [Vizzly CLI](https://github.com/vizzly-testing/vizzly-cli) - Official CLI documentation
|
|
109
|
+
- [Vizzly Platform](https://vizzly.dev) - Web dashboard and cloud features
|
|
110
|
+
- [Claude Code](https://claude.com/claude-code) - Claude Code documentation
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT © Vizzly Team
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze a specific visual regression failure and suggest fixes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Debug Vizzly Visual Regression
|
|
6
|
+
|
|
7
|
+
Analyze a specific failing visual comparison in detail. Supports both local TDD mode and cloud API mode.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Call the unified MCP tool**: Use `read_comparison_details` with the identifier (screenshot name or comparison ID)
|
|
12
|
+
- The tool automatically detects whether to use local TDD mode or cloud mode
|
|
13
|
+
- Pass screenshot name (e.g., "homepage_desktop") for local mode
|
|
14
|
+
- Pass comparison ID (e.g., "cmp_abc123") for cloud mode
|
|
15
|
+
- Returns a response with `mode` field indicating which mode was used
|
|
16
|
+
|
|
17
|
+
2. **Check the mode in the response**:
|
|
18
|
+
- **Local mode** (`mode: "local"`): Returns filesystem paths (`baselinePath`, `currentPath`, `diffPath`)
|
|
19
|
+
- **Cloud mode** (`mode: "cloud"`): Returns URLs (`baselineUrl`, `currentUrl`, `diffUrl`)
|
|
20
|
+
|
|
21
|
+
3. **Analyze the comparison data**:
|
|
22
|
+
- Diff percentage and threshold
|
|
23
|
+
- Status (failed/new/passed)
|
|
24
|
+
- Image references (paths or URLs depending on mode)
|
|
25
|
+
|
|
26
|
+
4. **View the actual images** (critical for visual analysis):
|
|
27
|
+
|
|
28
|
+
Check the `mode` field in the response to determine which tool to use:
|
|
29
|
+
|
|
30
|
+
**If mode is "local":**
|
|
31
|
+
- Response contains filesystem paths (`baselinePath`, `currentPath`, `diffPath`)
|
|
32
|
+
- **Use the Read tool to view ONLY baselinePath and currentPath**
|
|
33
|
+
- **DO NOT read diffPath** - it causes API errors
|
|
34
|
+
|
|
35
|
+
**If mode is "cloud":**
|
|
36
|
+
- Response contains public URLs (`baselineUrl`, `currentUrl`, `diffUrl`)
|
|
37
|
+
- **Use the WebFetch tool to view ONLY baselineUrl and currentUrl**
|
|
38
|
+
- **DO NOT fetch diffUrl** - it causes API errors
|
|
39
|
+
|
|
40
|
+
**IMPORTANT:** You MUST view the baseline and current images to provide accurate analysis
|
|
41
|
+
|
|
42
|
+
5. **Provide detailed visual insights** based on what you see:
|
|
43
|
+
- What type of change was detected (small/moderate/large diff)
|
|
44
|
+
- Describe the specific visual differences you observe in the images
|
|
45
|
+
- Identify which UI components, elements, or layouts changed
|
|
46
|
+
- Possible causes based on diff percentage and visual inspection:
|
|
47
|
+
- <1%: Anti-aliasing, font rendering, subpixel differences
|
|
48
|
+
- 1-5%: Layout shifts, padding/margin changes, color variations
|
|
49
|
+
- > 5%: Significant layout changes, missing content, major visual updates
|
|
50
|
+
|
|
51
|
+
6. **Suggest next steps** based on the mode:
|
|
52
|
+
- **If local mode**: Whether to accept using `accept_baseline` tool
|
|
53
|
+
- **If cloud mode**: Whether to approve/reject using `approve_comparison` or `reject_comparison` tools
|
|
54
|
+
- Areas to investigate if unintentional
|
|
55
|
+
- How to fix common issues
|
|
56
|
+
- Specific code changes if you can identify them from the visual diff
|
|
57
|
+
|
|
58
|
+
## Example Analysis (Local TDD Mode)
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Step 1: Call read_comparison_details with screenshot name
|
|
62
|
+
Tool: read_comparison_details({ identifier: "homepage" })
|
|
63
|
+
|
|
64
|
+
Response:
|
|
65
|
+
{
|
|
66
|
+
"name": "homepage",
|
|
67
|
+
"status": "failed",
|
|
68
|
+
"diffPercentage": 2.3,
|
|
69
|
+
"threshold": 0.1,
|
|
70
|
+
"mode": "local",
|
|
71
|
+
"baselinePath": "/Users/you/project/.vizzly/baselines/homepage.png",
|
|
72
|
+
"currentPath": "/Users/you/project/.vizzly/screenshots/homepage.png",
|
|
73
|
+
"diffPath": "/Users/you/project/.vizzly/diffs/homepage.png"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Step 2: Detected mode is "local", so use Read tool for images
|
|
77
|
+
Read(baselinePath) and Read(currentPath)
|
|
78
|
+
|
|
79
|
+
Visual Analysis:
|
|
80
|
+
[After reading the baseline and current image files...]
|
|
81
|
+
|
|
82
|
+
Comparing the two images, the navigation header has shifted down by approximately 10-15 pixels.
|
|
83
|
+
Specific changes observed:
|
|
84
|
+
- The logo position moved from y:20px to y:35px
|
|
85
|
+
- Navigation menu items are now overlapping with the hero section
|
|
86
|
+
- The "Sign Up" button background changed from blue (#2563eb) to a darker blue (#1e40af)
|
|
87
|
+
|
|
88
|
+
Root Cause:
|
|
89
|
+
Based on the visual comparison, this appears to be a margin or padding change on the
|
|
90
|
+
header element. The button color change is likely a hover state being captured.
|
|
91
|
+
|
|
92
|
+
Recommendations:
|
|
93
|
+
1. Check for recent CSS changes to:
|
|
94
|
+
- `.header` or `nav` margin-top/padding-top
|
|
95
|
+
- Any global layout shifts affecting the header
|
|
96
|
+
2. The button color change suggests a hover state - ensure consistent state during screenshot capture
|
|
97
|
+
3. If the header position change is intentional:
|
|
98
|
+
- Accept as new baseline using `accept_baseline` tool
|
|
99
|
+
4. If unintentional:
|
|
100
|
+
- Revert CSS changes to header positioning
|
|
101
|
+
- Verify with: `git diff src/styles/header.css`
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Example Analysis (Cloud Mode)
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Step 1: Call read_comparison_details with comparison ID
|
|
108
|
+
Tool: read_comparison_details({
|
|
109
|
+
identifier: "cmp_xyz789",
|
|
110
|
+
apiToken: "vzt_..."
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
Response:
|
|
114
|
+
{
|
|
115
|
+
"name": "homepage",
|
|
116
|
+
"status": "failed",
|
|
117
|
+
"diffPercentage": 2.3,
|
|
118
|
+
"threshold": 0.1,
|
|
119
|
+
"mode": "cloud",
|
|
120
|
+
"baselineUrl": "https://app.vizzly.dev/screenshots/abc123/baseline.png",
|
|
121
|
+
"currentUrl": "https://app.vizzly.dev/screenshots/abc123/current.png",
|
|
122
|
+
"diffUrl": "https://app.vizzly.dev/screenshots/abc123/diff.png",
|
|
123
|
+
"comparisonId": "cmp_xyz789",
|
|
124
|
+
"buildId": "bld_abc123"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
Step 2: Detected mode is "cloud", so use WebFetch tool for images
|
|
128
|
+
WebFetch(baselineUrl) and WebFetch(currentUrl)
|
|
129
|
+
|
|
130
|
+
Visual Analysis:
|
|
131
|
+
[After fetching the baseline and current image URLs...]
|
|
132
|
+
|
|
133
|
+
[Same analysis as local mode example...]
|
|
134
|
+
|
|
135
|
+
Recommendations:
|
|
136
|
+
1. [Same technical recommendations as local mode...]
|
|
137
|
+
2. If the header position change is intentional:
|
|
138
|
+
- Approve this comparison using `approve_comparison` tool
|
|
139
|
+
3. If unintentional:
|
|
140
|
+
- Reject using `reject_comparison` tool with detailed reason
|
|
141
|
+
- Have the team fix the CSS changes
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Important Notes
|
|
145
|
+
|
|
146
|
+
- **Unified Tool**: Always use `read_comparison_details` with the identifier - it automatically detects the mode
|
|
147
|
+
- **Mode Detection**: Check the `mode` field in the response to know which viewing tool to use
|
|
148
|
+
- **Image Viewing**:
|
|
149
|
+
- Local mode → Use Read tool with filesystem paths
|
|
150
|
+
- Cloud mode → Use WebFetch tool with URLs
|
|
151
|
+
- **Diff Images**: NEVER attempt to view/read/fetch the diff image - it causes API errors
|
|
152
|
+
- **Visual Analysis**: Always view the baseline and current images before providing analysis
|
|
153
|
+
- Visual inspection reveals details that diff percentages alone cannot convey
|
|
@@ -0,0 +1,137 @@
|
|
|
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.
|