@vizzly-testing/cli 0.23.1 → 0.24.0
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 +54 -586
- package/dist/api/client.js +3 -1
- package/dist/api/endpoints.js +6 -7
- package/dist/cli.js +15 -2
- package/dist/commands/finalize.js +12 -0
- package/dist/commands/preview.js +210 -28
- package/dist/commands/run.js +15 -0
- package/dist/commands/status.js +34 -8
- package/dist/commands/upload.js +13 -0
- package/dist/reporter/reporter-bundle.css +1 -1
- package/dist/reporter/reporter-bundle.iife.js +71 -63
- package/dist/server/handlers/tdd-handler.js +4 -9
- package/dist/tdd/core/region-coverage.js +115 -0
- package/dist/tdd/core/signature.js +3 -1
- package/dist/tdd/metadata/region-metadata.js +93 -0
- package/dist/tdd/services/comparison-service.js +40 -8
- package/dist/tdd/services/region-service.js +75 -0
- package/dist/tdd/tdd-service.js +70 -8
- package/package.json +3 -4
- package/claude-plugin/.claude-plugin/README.md +0 -270
- package/claude-plugin/.claude-plugin/marketplace.json +0 -28
- package/claude-plugin/.claude-plugin/plugin.json +0 -14
- package/claude-plugin/.mcp.json +0 -12
- package/claude-plugin/CHANGELOG.md +0 -85
- package/claude-plugin/commands/setup.md +0 -137
- package/claude-plugin/commands/suggest-screenshots.md +0 -111
- package/claude-plugin/mcp/vizzly-docs-server/README.md +0 -95
- package/claude-plugin/mcp/vizzly-docs-server/docs-fetcher.js +0 -110
- package/claude-plugin/mcp/vizzly-docs-server/index.js +0 -283
- package/claude-plugin/mcp/vizzly-server/cloud-api-provider.js +0 -399
- package/claude-plugin/mcp/vizzly-server/index.js +0 -927
- package/claude-plugin/mcp/vizzly-server/local-tdd-provider.js +0 -455
- package/claude-plugin/mcp/vizzly-server/token-resolver.js +0 -185
- package/claude-plugin/skills/check-visual-tests/SKILL.md +0 -158
- package/claude-plugin/skills/debug-visual-regression/SKILL.md +0 -269
- package/docs/api-reference.md +0 -1003
- package/docs/authentication.md +0 -334
- package/docs/doctor-command.md +0 -44
- package/docs/getting-started.md +0 -131
- package/docs/internal/SDK-API.md +0 -1018
- package/docs/plugins.md +0 -557
- package/docs/tdd-mode.md +0 -594
- package/docs/test-integration.md +0 -523
- package/docs/tui-elements.md +0 -560
- package/docs/upload-command.md +0 -196
package/docs/tdd-mode.md
DELETED
|
@@ -1,594 +0,0 @@
|
|
|
1
|
-
# TDD Mode Guide
|
|
2
|
-
|
|
3
|
-
TDD Mode enables test-driven visual development with an interactive dashboard for rapid iteration.
|
|
4
|
-
|
|
5
|
-
## What is TDD Mode?
|
|
6
|
-
|
|
7
|
-
TDD Mode transforms your visual testing workflow with:
|
|
8
|
-
|
|
9
|
-
- **Interactive Dashboard** - Real-time visual feedback as tests run
|
|
10
|
-
- **Local Comparison** - Compares screenshots on your machine using `honeydiff`
|
|
11
|
-
- **Live Updates** - See comparisons instantly in the browser
|
|
12
|
-
- **Baseline Management** - Accept/reject changes directly from the UI
|
|
13
|
-
- **Settings Editor** - Adjust comparison threshold, ports, and more without touching config files
|
|
14
|
-
- **Project Tools** - Login and link directories to cloud projects from the dashboard
|
|
15
|
-
- **Fast Feedback** - No network uploads during development
|
|
16
|
-
- **No Token Required** - Visual testing works entirely offline for local development
|
|
17
|
-
|
|
18
|
-
## Quick Start
|
|
19
|
-
|
|
20
|
-
### 1. Start the TDD Server
|
|
21
|
-
|
|
22
|
-
Start the interactive TDD server:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npx vizzly tdd start
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
🐻 **TDD server starts:**
|
|
29
|
-
- Opens at `http://localhost:47392` (or custom `--port`)
|
|
30
|
-
- Dashboard shows empty state ready for comparisons
|
|
31
|
-
- Runs in the background and returns your terminal immediately
|
|
32
|
-
- Settings and Projects tabs available for convenient configuration
|
|
33
|
-
|
|
34
|
-
### 2. Run Your Tests in Watch Mode
|
|
35
|
-
|
|
36
|
-
In the same terminal or a new one, run your tests in watch mode:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm test -- --watch
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
🐻 **As tests run:**
|
|
43
|
-
- Screenshots sent to dashboard in real-time
|
|
44
|
-
- Comparisons appear instantly
|
|
45
|
-
- Live pass/fail statistics update
|
|
46
|
-
- Filter by status (all/changed/identical/new)
|
|
47
|
-
|
|
48
|
-
### 3. Review Changes in the Dashboard
|
|
49
|
-
|
|
50
|
-
Open your browser to `http://localhost:47392`:
|
|
51
|
-
|
|
52
|
-
- **Visual Diff Modes** - Overlay, side-by-side, onion skin, toggle
|
|
53
|
-
- **Accept Baselines** - Click to accept individual or all changes
|
|
54
|
-
- **Test Statistics** - Total tests, pass rate, change detection
|
|
55
|
-
- **Dark Theme** - Easy on the eyes during development
|
|
56
|
-
|
|
57
|
-
### 4. Accept Changes (Update Baseline)
|
|
58
|
-
|
|
59
|
-
Accept changes directly in the dashboard UI, or via CLI:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npx vizzly tdd run "npm test" --set-baseline
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
🐻 **Baseline update behavior:**
|
|
66
|
-
- Skips all comparisons
|
|
67
|
-
- Sets current screenshots as new baselines
|
|
68
|
-
- All tests pass (baseline accepted)
|
|
69
|
-
- Future runs use updated baselines
|
|
70
|
-
|
|
71
|
-
### 5. Manage Settings & Projects (Optional)
|
|
72
|
-
|
|
73
|
-
Use the dashboard tabs for convenient configuration:
|
|
74
|
-
|
|
75
|
-
- **Settings** - Edit comparison thresholds, ports, and build settings without touching files
|
|
76
|
-
- **Projects** - Login to Vizzly cloud and link directories to projects
|
|
77
|
-
- **Comparisons** - View visual diffs (main view)
|
|
78
|
-
- **Stats** - See test metrics and trends
|
|
79
|
-
|
|
80
|
-
These tools are conveniences - you can always edit `vizzly.config.js` directly or use `vizzly login`/`vizzly project:select` CLI commands instead.
|
|
81
|
-
|
|
82
|
-
### 6. Stop the TDD Server
|
|
83
|
-
|
|
84
|
-
When done developing:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npx vizzly tdd stop
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Or press `Ctrl+C` if running in foreground.
|
|
91
|
-
|
|
92
|
-
## How It Works
|
|
93
|
-
|
|
94
|
-
TDD Mode provides two workflows:
|
|
95
|
-
|
|
96
|
-
### Interactive TDD Workflow
|
|
97
|
-
|
|
98
|
-
1. **Start TDD server** - `vizzly tdd start` launches persistent server with dashboard
|
|
99
|
-
2. **Run tests in watch** - Tests run continuously as you code
|
|
100
|
-
3. **Live updates** - Screenshots compared and displayed in real-time
|
|
101
|
-
4. **Review in browser** - Visual diff modes help analyze changes
|
|
102
|
-
5. **Manage settings (optional)** - Use Settings/Projects tabs for quick config changes
|
|
103
|
-
6. **Accept baselines** - Click to update baselines from UI
|
|
104
|
-
|
|
105
|
-
### Single-Shot Workflow
|
|
106
|
-
|
|
107
|
-
1. **Run tests** - `vizzly tdd run "npm test"` executes once
|
|
108
|
-
2. **Compares locally** - Uses `honeydiff` for high-performance comparison
|
|
109
|
-
3. **Generates report** - Creates self-contained HTML report with React UI
|
|
110
|
-
4. **Exit with status** - Fails if differences exceed threshold
|
|
111
|
-
5. **Server auto-stops** - Ephemeral server cleans up automatically
|
|
112
|
-
|
|
113
|
-
## Directory Structure
|
|
114
|
-
|
|
115
|
-
TDD Mode creates a `.vizzly/` directory:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
.vizzly/
|
|
119
|
-
├── baselines/ # Baseline images (local or downloaded)
|
|
120
|
-
│ ├── homepage.png
|
|
121
|
-
│ ├── dashboard.png
|
|
122
|
-
│ └── metadata.json # Baseline build information
|
|
123
|
-
├── current/ # Current test screenshots
|
|
124
|
-
│ ├── homepage.png
|
|
125
|
-
│ └── dashboard.png
|
|
126
|
-
├── report/ # Interactive HTML report
|
|
127
|
-
│ └── index.html # Visual comparison interface
|
|
128
|
-
└── diffs/ # Visual diff images (when differences found)
|
|
129
|
-
├── homepage.png # Red overlay showing differences
|
|
130
|
-
└── dashboard.png
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**Important**: Add `.vizzly/` to your `.gitignore` file as it contains local development artifacts.
|
|
134
|
-
|
|
135
|
-
## Interactive Dashboard
|
|
136
|
-
|
|
137
|
-
The TDD dashboard provides real-time visual comparison feedback as you develop.
|
|
138
|
-
|
|
139
|
-
### 🐻 **Dashboard Features**
|
|
140
|
-
|
|
141
|
-
**Two-View Navigation**
|
|
142
|
-
- **Comparisons View** - Main view showing all screenshot comparisons with visual diffs
|
|
143
|
-
- **Statistics View** - Overview of test runs, pass/fail metrics, and baseline management
|
|
144
|
-
- Switch between views using the navigation tabs at the top
|
|
145
|
-
|
|
146
|
-
**Live Updates**
|
|
147
|
-
- Screenshots appear as tests run
|
|
148
|
-
- Comparisons processed in real-time
|
|
149
|
-
- No page refresh needed
|
|
150
|
-
- Auto-refreshes every 2 seconds to show latest results
|
|
151
|
-
|
|
152
|
-
**Visual Diff Modes** (in Comparisons view)
|
|
153
|
-
- **Overlay** - Toggle diff overlay on/off
|
|
154
|
-
- **Side-by-Side** - Compare baseline and current horizontally
|
|
155
|
-
- **Onion Skin** - Drag to reveal baseline underneath
|
|
156
|
-
- **Toggle** - Click to switch between baseline and current
|
|
157
|
-
|
|
158
|
-
**Baseline Management**
|
|
159
|
-
- **Accept Individual** - Click accept on any comparison to update that baseline
|
|
160
|
-
- **Accept All Changes** - Bulk accept all failed/new screenshots at once (shown when changes detected)
|
|
161
|
-
- Shows count of failed and new baselines
|
|
162
|
-
- Prominent button appears in Comparisons view when changes exist
|
|
163
|
-
- **Reset Baselines** - Delete all baselines and comparison history (in Statistics view)
|
|
164
|
-
- Useful for starting fresh or fixing corrupted state
|
|
165
|
-
- Requires confirmation before executing
|
|
166
|
-
|
|
167
|
-
**Filtering & Search** (in Comparisons view)
|
|
168
|
-
- Filter by status: All, Failed, Passed, New
|
|
169
|
-
- Search by screenshot name
|
|
170
|
-
- Filter by browser type
|
|
171
|
-
- Filter by viewport size
|
|
172
|
-
- Sort by name, status, or diff percentage
|
|
173
|
-
|
|
174
|
-
### 🐻 **Dashboard UI**
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
# Start the dashboard
|
|
178
|
-
npx vizzly tdd start
|
|
179
|
-
|
|
180
|
-
# Opens at http://localhost:47392
|
|
181
|
-
# Shows real-time comparisons as tests run
|
|
182
|
-
# Dark theme optimized for development
|
|
183
|
-
# Navigate between Comparisons and Statistics views
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
**Dashboard Views:**
|
|
187
|
-
|
|
188
|
-
1. **Comparisons View** (`/`)
|
|
189
|
-
- Lists all screenshot comparisons with visual diffs
|
|
190
|
-
- Filter, search, and sort capabilities
|
|
191
|
-
- "Accept All" button appears when changes are detected
|
|
192
|
-
- Individual accept/reject actions per comparison
|
|
193
|
-
- Multiple visual diff modes for detailed inspection
|
|
194
|
-
|
|
195
|
-
2. **Statistics View** (`/stats`)
|
|
196
|
-
- Overview of test runs and baseline status
|
|
197
|
-
- Total pass/fail/new screenshot counts
|
|
198
|
-
- Current baseline information (build name, creation date)
|
|
199
|
-
- "Accept All Changes" button for bulk baseline updates
|
|
200
|
-
- "Reset Baselines" button to clear all baselines and start fresh
|
|
201
|
-
|
|
202
|
-
### 🐻 **Static HTML Report**
|
|
203
|
-
|
|
204
|
-
When using `vizzly tdd run`, a static HTML report is generated at `.vizzly/report/index.html`:
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
# Report path shown after each run
|
|
208
|
-
🐻 View detailed report: file:///path/to/.vizzly/report/index.html
|
|
209
|
-
|
|
210
|
-
# Click the link in your terminal, or open manually
|
|
211
|
-
open .vizzly/report/index.html # macOS
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Command Options
|
|
215
|
-
|
|
216
|
-
### TDD Subcommands
|
|
217
|
-
|
|
218
|
-
**Start Dashboard Server**
|
|
219
|
-
```bash
|
|
220
|
-
vizzly tdd start [options]
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
Starts the dashboard server in the background as a detached process and returns your terminal immediately.
|
|
224
|
-
|
|
225
|
-
Options:
|
|
226
|
-
- `--port <port>` - Server port (default: 47392)
|
|
227
|
-
- `--threshold <number>` - Comparison threshold in CIEDE2000 Delta E (default: 2.0)
|
|
228
|
-
- `--baseline-build <id>` - Use specific build as baseline
|
|
229
|
-
- `--open` - Auto-open dashboard in browser
|
|
230
|
-
|
|
231
|
-
**Run Tests (Single-Shot)**
|
|
232
|
-
```bash
|
|
233
|
-
vizzly tdd run "npm test" [options]
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
Options:
|
|
237
|
-
- `--set-baseline` - Accept screenshots as new baseline
|
|
238
|
-
- `--port <port>` - Server port (default: 47392)
|
|
239
|
-
- `--threshold <number>` - Comparison threshold in CIEDE2000 Delta E (default: 2.0)
|
|
240
|
-
- `--baseline-build <id>` - Use specific build as baseline
|
|
241
|
-
- `--timeout <ms>` - Server timeout (default: 30000)
|
|
242
|
-
|
|
243
|
-
**Stop Dashboard Server**
|
|
244
|
-
```bash
|
|
245
|
-
vizzly tdd stop
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Legacy Command
|
|
249
|
-
|
|
250
|
-
The legacy command format is still supported:
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
vizzly tdd "npm test" # Equivalent to: vizzly tdd run "npm test"
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## TDD Workflow
|
|
257
|
-
|
|
258
|
-
### Interactive TDD (Recommended)
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
# Start dashboard (runs in background)
|
|
262
|
-
npx vizzly tdd start
|
|
263
|
-
|
|
264
|
-
# Run tests in watch mode (same terminal or new one)
|
|
265
|
-
npm test -- --watch
|
|
266
|
-
|
|
267
|
-
# Browser: Open http://localhost:47392
|
|
268
|
-
# See live comparisons as you code
|
|
269
|
-
|
|
270
|
-
# Accept changes from dashboard UI when ready
|
|
271
|
-
# Stop when done: npx vizzly tdd stop
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Single-Shot Testing
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
# Run tests once with comparison
|
|
278
|
-
npx vizzly tdd run "npm test"
|
|
279
|
-
|
|
280
|
-
# Accept changes as new baseline
|
|
281
|
-
npx vizzly tdd run "npm test" --set-baseline
|
|
282
|
-
|
|
283
|
-
# Upload to Vizzly when satisfied
|
|
284
|
-
npx vizzly run "npm test" --wait
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Feature TDD Workflow
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
# Start interactive dashboard (runs in background)
|
|
291
|
-
npx vizzly tdd start
|
|
292
|
-
|
|
293
|
-
# Run tests in watch mode (same terminal or new one)
|
|
294
|
-
npm test -- --watch
|
|
295
|
-
|
|
296
|
-
# Make changes and see live feedback in browser
|
|
297
|
-
# Accept baselines directly from dashboard UI
|
|
298
|
-
|
|
299
|
-
# When feature complete, upload to Vizzly
|
|
300
|
-
npx vizzly run "npm test" --build-name "Feature: New Dashboard"
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Bug Fixing
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
# Quick verification with single-shot mode
|
|
307
|
-
npx vizzly tdd run "npm test"
|
|
308
|
-
|
|
309
|
-
# Tests should pass when bug is fixed
|
|
310
|
-
# Then upload the fix
|
|
311
|
-
npx vizzly run "npm test" --build-name "Fix: Header alignment issue"
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Hotspot Filtering
|
|
315
|
-
|
|
316
|
-
When connected to Vizzly cloud, TDD mode automatically filters out "noise" from known hotspot areas - regions that frequently change across builds (like timestamps, animations, or dynamic content).
|
|
317
|
-
|
|
318
|
-
### How It Works
|
|
319
|
-
|
|
320
|
-
1. **Download baselines** - Use the TDD dashboard's Builds page to download baselines from the cloud (hotspot data is included automatically)
|
|
321
|
-
2. **Automatic filtering** - During comparisons, if a diff falls within a known hotspot region, it's automatically marked as passed
|
|
322
|
-
3. **Visual feedback** - You'll see output like:
|
|
323
|
-
```
|
|
324
|
-
✅ PASSED Dashboard - differences in known hotspots (0.15% different, 42 pixels, 1 region, 95% in hotspots)
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Requirements
|
|
328
|
-
|
|
329
|
-
Hotspot filtering activates automatically when:
|
|
330
|
-
- You have an API token configured (`vizzly login` or `VIZZLY_TOKEN`)
|
|
331
|
-
- You've downloaded baselines from the cloud (via the TDD dashboard's Builds page)
|
|
332
|
-
- The cloud has enough historical build data to calculate hotspot regions
|
|
333
|
-
|
|
334
|
-
### Filtering Criteria
|
|
335
|
-
|
|
336
|
-
A diff is filtered (auto-passed) when:
|
|
337
|
-
- **80%+ of the diff** falls within known hotspot regions
|
|
338
|
-
- **High confidence** hotspot data (confidence score ≥ 70)
|
|
339
|
-
|
|
340
|
-
If the diff falls outside hotspots or confidence is low, the comparison fails normally so you can review it.
|
|
341
|
-
|
|
342
|
-
### Benefits
|
|
343
|
-
|
|
344
|
-
- **Reduced noise** - Stop seeing the same timestamp/animation diffs over and over
|
|
345
|
-
- **Faster reviews** - Focus on real visual changes, not known dynamic areas
|
|
346
|
-
- **Smart detection** - Hotspots are calculated from your actual build history, not manual configuration
|
|
347
|
-
|
|
348
|
-
## Comparison Settings
|
|
349
|
-
|
|
350
|
-
TDD Mode uses the same comparison settings as production:
|
|
351
|
-
|
|
352
|
-
- **Threshold matching** - Uses your configured threshold
|
|
353
|
-
- **Anti-aliasing detection** - Handles font rendering differences
|
|
354
|
-
- **Color tolerance** - Accounts for minor color variations
|
|
355
|
-
|
|
356
|
-
Configure in `vizzly.config.js`:
|
|
357
|
-
|
|
358
|
-
```javascript
|
|
359
|
-
export default {
|
|
360
|
-
comparison: {
|
|
361
|
-
threshold: 2.0 // CIEDE2000 Delta E (0=exact, 1=JND, 2=recommended)
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
## Managing Baselines
|
|
367
|
-
|
|
368
|
-
### Check Current Baseline Status
|
|
369
|
-
|
|
370
|
-
```bash
|
|
371
|
-
npx vizzly status # Shows latest build info
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### Update Baselines
|
|
375
|
-
|
|
376
|
-
Download new baselines from a different build:
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
npx vizzly tdd run "npm test" --baseline-build build-xyz789
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
### Force Baseline Refresh
|
|
383
|
-
|
|
384
|
-
Delete local baselines to force re-download:
|
|
385
|
-
|
|
386
|
-
```bash
|
|
387
|
-
rm -rf .vizzly/baselines/
|
|
388
|
-
npx vizzly tdd run "npm test"
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
## Baseline Signature Properties
|
|
392
|
-
|
|
393
|
-
Vizzly matches screenshots to baselines using a **signature**:
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
name | viewport_width | browser
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
For example: `homepage|1920|chromium`
|
|
400
|
-
|
|
401
|
-
### Custom Properties vs Baseline Signature Properties
|
|
402
|
-
|
|
403
|
-
You can pass custom properties when capturing screenshots:
|
|
404
|
-
|
|
405
|
-
```javascript
|
|
406
|
-
await vizzlyScreenshot('dashboard', screenshot, {
|
|
407
|
-
theme: 'dark',
|
|
408
|
-
locale: 'en-US',
|
|
409
|
-
mobile: true
|
|
410
|
-
});
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
By default, these properties help you organize and filter in the dashboard—they don't affect baseline matching. Two screenshots with the same name but different `theme` values would match the same baseline.
|
|
414
|
-
|
|
415
|
-
### Making Properties Affect Matching
|
|
416
|
-
|
|
417
|
-
To create separate baselines for different variants, configure **Baseline Signature Properties** in your project settings:
|
|
418
|
-
|
|
419
|
-
1. Go to your project on [app.vizzly.dev](https://app.vizzly.dev)
|
|
420
|
-
2. Navigate to **Settings** → **Baseline Signature Properties**
|
|
421
|
-
3. Add the property names (e.g., `theme`, `mobile`)
|
|
422
|
-
|
|
423
|
-
With `theme` configured:
|
|
424
|
-
|
|
425
|
-
```
|
|
426
|
-
dashboard|1920|chromium|dark → separate baseline
|
|
427
|
-
dashboard|1920|chromium|light → separate baseline
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
### TDD Mode Support
|
|
431
|
-
|
|
432
|
-
When you download cloud baselines, the CLI automatically:
|
|
433
|
-
|
|
434
|
-
1. Fetches your project's baseline signature properties
|
|
435
|
-
2. Downloads baselines with variant-aware filenames
|
|
436
|
-
3. Uses matching signatures during comparison
|
|
437
|
-
|
|
438
|
-
This keeps TDD mode behavior consistent with cloud comparisons.
|
|
439
|
-
|
|
440
|
-
### Quick Reference
|
|
441
|
-
|
|
442
|
-
| Type | Purpose | Affects Matching? |
|
|
443
|
-
|------|---------|-------------------|
|
|
444
|
-
| Custom Properties | Organize and filter in dashboard | No |
|
|
445
|
-
| Baseline Signature Properties | Create separate baselines per variant | Yes |
|
|
446
|
-
|
|
447
|
-
## Advanced Usage
|
|
448
|
-
|
|
449
|
-
### Conditional TDD Mode
|
|
450
|
-
|
|
451
|
-
Check if TDD mode is active in your tests:
|
|
452
|
-
|
|
453
|
-
```javascript
|
|
454
|
-
import { getVizzlyInfo } from '@vizzly-testing/cli/client';
|
|
455
|
-
|
|
456
|
-
const info = getVizzlyInfo();
|
|
457
|
-
if (info.tddMode) {
|
|
458
|
-
console.log('Running in TDD mode - fast local comparison');
|
|
459
|
-
} else {
|
|
460
|
-
console.log('Running in upload mode - results going to Vizzly');
|
|
461
|
-
}
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
### Custom Comparison Logic
|
|
465
|
-
|
|
466
|
-
TDD mode respects your screenshot properties:
|
|
467
|
-
|
|
468
|
-
```javascript
|
|
469
|
-
await vizzlyScreenshot('homepage', screenshot, {
|
|
470
|
-
threshold: 0.05, // More tolerant for this specific screenshot
|
|
471
|
-
browser: 'chrome',
|
|
472
|
-
viewport: '1920x1080'
|
|
473
|
-
});
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
## CI/CD Integration
|
|
477
|
-
|
|
478
|
-
Use TDD mode for faster PR builds:
|
|
479
|
-
|
|
480
|
-
```yaml
|
|
481
|
-
name: Visual Tests
|
|
482
|
-
on: [push, pull_request]
|
|
483
|
-
|
|
484
|
-
jobs:
|
|
485
|
-
visual-tests:
|
|
486
|
-
runs-on: ubuntu-latest
|
|
487
|
-
steps:
|
|
488
|
-
- uses: actions/checkout@v4
|
|
489
|
-
- uses: actions/setup-node@v4
|
|
490
|
-
- run: npm ci
|
|
491
|
-
|
|
492
|
-
# Use TDD mode for PR builds (faster, no uploads)
|
|
493
|
-
- name: TDD Visual Tests (PR)
|
|
494
|
-
if: github.event_name == 'pull_request'
|
|
495
|
-
run: npx vizzly tdd run "npm test"
|
|
496
|
-
env:
|
|
497
|
-
VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }}
|
|
498
|
-
|
|
499
|
-
# Upload full build for main branch
|
|
500
|
-
- name: Full Visual Tests (main)
|
|
501
|
-
if: github.ref == 'refs/heads/main'
|
|
502
|
-
run: npx vizzly run "npm test" --wait
|
|
503
|
-
env:
|
|
504
|
-
VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }}
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
## Benefits
|
|
508
|
-
|
|
509
|
-
### Speed
|
|
510
|
-
- **No network uploads** - Everything happens locally
|
|
511
|
-
- **Immediate feedback** - See results in seconds
|
|
512
|
-
- **No API rate limits** - Test as often as needed
|
|
513
|
-
|
|
514
|
-
### TDD Experience
|
|
515
|
-
- **Fast iteration** - Make changes and test immediately
|
|
516
|
-
- **Visual debugging** - See exact pixel differences
|
|
517
|
-
- **Offline capable** - Works without internet (after initial baseline download)
|
|
518
|
-
- **Clean console output** - Reduced logging noise, only shows important information
|
|
519
|
-
- **Silent mode** - Vizzly client auto-disables after first warning if not initialized
|
|
520
|
-
|
|
521
|
-
### Cost Efficiency
|
|
522
|
-
- **Reduced API usage** - Only upload final results
|
|
523
|
-
- **Faster CI builds** - Use TDD mode for PR validation
|
|
524
|
-
- **Local development** - No cloud resources consumed
|
|
525
|
-
|
|
526
|
-
## Troubleshooting
|
|
527
|
-
|
|
528
|
-
### No Baseline Found
|
|
529
|
-
```
|
|
530
|
-
Error: No baseline found for screenshot 'homepage'
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
**Solution**: Run a successful build first to create baselines:
|
|
534
|
-
```bash
|
|
535
|
-
npx vizzly run "npm test" --wait
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
### Visual Difference Detected
|
|
539
|
-
```
|
|
540
|
-
Error: Visual difference detected in 'homepage' (threshold: 1.5%)
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
This is expected behavior! Check the comparison image:
|
|
544
|
-
```bash
|
|
545
|
-
open .vizzly/comparisons/homepage.png
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
Fix the visual issue or update your baseline if the change is intentional.
|
|
549
|
-
|
|
550
|
-
### Comparison Failed
|
|
551
|
-
```
|
|
552
|
-
Error: Failed to compare 'homepage': baseline image not found
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
**Solution**: Refresh baselines:
|
|
556
|
-
```bash
|
|
557
|
-
rm -rf .vizzly/baselines/
|
|
558
|
-
npx vizzly tdd run "npm test"
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
### Honeydiff Not Found
|
|
562
|
-
```
|
|
563
|
-
Error: Cannot find module '@vizzly-testing/honeydiff'
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
**Solution**: The `@vizzly-testing/honeydiff` package should be installed automatically. Try:
|
|
567
|
-
```bash
|
|
568
|
-
npm install @vizzly-testing/honeydiff
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
## Best Practices
|
|
572
|
-
|
|
573
|
-
### Use TDD Mode For
|
|
574
|
-
- **Local development** - Fast iteration on UI changes
|
|
575
|
-
- **Bug fixing** - Verify visual fixes immediately
|
|
576
|
-
- **PR validation** - Quick checks without uploading
|
|
577
|
-
- **Debugging** - Understand exactly what changed visually
|
|
578
|
-
|
|
579
|
-
### Use Upload Mode For
|
|
580
|
-
- **Final results** - When changes are ready for review
|
|
581
|
-
- **Baseline creation** - Initial setup and approved changes
|
|
582
|
-
- **Production releases** - Official visual regression testing
|
|
583
|
-
- **Team collaboration** - Sharing results with designers/stakeholders
|
|
584
|
-
|
|
585
|
-
### Directory Management
|
|
586
|
-
- **Add to .gitignore** - Never commit `.vizzly/` directory
|
|
587
|
-
- **Regular cleanup** - Delete old comparison images periodically
|
|
588
|
-
- **Baseline updates** - Refresh baselines when UI intentionally changes
|
|
589
|
-
|
|
590
|
-
## Next Steps
|
|
591
|
-
|
|
592
|
-
- Learn about [Test Integration](./test-integration.md) for screenshot capture
|
|
593
|
-
- Explore [Upload Command](./upload-command.md) for direct uploads
|
|
594
|
-
- Check the [API Reference](./api-reference.md) for programmatic usage
|