@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.
- 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/package.json +1 -2
- 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/test-integration.md
DELETED
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
# Test Integration Guide
|
|
2
|
-
|
|
3
|
-
The `vizzly run` command integrates Vizzly directly into your test suite, automatically capturing screenshots during test execution and processing them through Vizzly's visual comparison pipeline.
|
|
4
|
-
|
|
5
|
-
## Command Options
|
|
6
|
-
|
|
7
|
-
**`--build-name <name>`** - Custom build name
|
|
8
|
-
```bash
|
|
9
|
-
vizzly run "npm test" --build-name "PR-123"
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
**`--environment <env>`** - Environment name (default: "test")
|
|
13
|
-
```bash
|
|
14
|
-
vizzly run "npm test" --environment "staging"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**`--branch <branch>`** - Git branch override
|
|
18
|
-
```bash
|
|
19
|
-
vizzly run "npm test" --branch "feature/new-ui"
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**`--commit <sha>`** - Git commit SHA override
|
|
23
|
-
```bash
|
|
24
|
-
vizzly run "npm test" --commit "abc123def456"
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**`--message <msg>`** - Commit message override
|
|
28
|
-
```bash
|
|
29
|
-
vizzly run "npm test" --message "Add new component"
|
|
30
|
-
```## Basic Usage
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
vizzly run "<your-test-command>"
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Examples with different test frameworks:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
vizzly run "npm test"
|
|
40
|
-
vizzly run "npx playwright test"
|
|
41
|
-
vizzly run "npx cypress run"
|
|
42
|
-
vizzly run "bundle exec rspec"
|
|
43
|
-
vizzly run "python -m pytest"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## How It Works
|
|
47
|
-
|
|
48
|
-
When you run `vizzly run`:
|
|
49
|
-
|
|
50
|
-
1. **Starts a local server** - Creates a screenshot capture endpoint
|
|
51
|
-
2. **Sets environment variables** - Makes Vizzly available to your tests
|
|
52
|
-
3. **Runs your test command** - Executes your normal test suite
|
|
53
|
-
4. **Captures screenshots** - Collects screenshots from `vizzlyScreenshot()` calls
|
|
54
|
-
5. **Uploads results** - Sends all screenshots to Vizzly for processing
|
|
55
|
-
|
|
56
|
-
## Environment Variables
|
|
57
|
-
|
|
58
|
-
The CLI automatically sets these variables for your test process:
|
|
59
|
-
|
|
60
|
-
- `VIZZLY_SERVER_URL` - Local server URL for screenshot uploads
|
|
61
|
-
- `VIZZLY_BUILD_ID` - Unique identifier for this test run
|
|
62
|
-
- `VIZZLY_ENABLED` - Set to `true` to enable screenshot capture
|
|
63
|
-
- `VIZZLY_TDD_MODE` - Set to `true` when using `--tdd` flag
|
|
64
|
-
|
|
65
|
-
## Adding Screenshots to Tests
|
|
66
|
-
|
|
67
|
-
Import the client and use `vizzlyScreenshot()` in your tests. You can pass either a **Buffer** or a **file path**:
|
|
68
|
-
|
|
69
|
-
### Using a Buffer
|
|
70
|
-
|
|
71
|
-
```javascript
|
|
72
|
-
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
73
|
-
|
|
74
|
-
// Your test framework takes the screenshot
|
|
75
|
-
const screenshot = await page.screenshot();
|
|
76
|
-
|
|
77
|
-
// Send to Vizzly
|
|
78
|
-
await vizzlyScreenshot('homepage', screenshot, {
|
|
79
|
-
properties: {
|
|
80
|
-
browser: 'chrome',
|
|
81
|
-
viewport: '1920x1080'
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Using a File Path
|
|
87
|
-
|
|
88
|
-
```javascript
|
|
89
|
-
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
90
|
-
|
|
91
|
-
// Save screenshot to file first
|
|
92
|
-
await page.screenshot({ path: './screenshots/homepage.png' });
|
|
93
|
-
|
|
94
|
-
// Send to Vizzly using file path
|
|
95
|
-
await vizzlyScreenshot('homepage', './screenshots/homepage.png', {
|
|
96
|
-
properties: {
|
|
97
|
-
browser: 'chrome',
|
|
98
|
-
viewport: '1920x1080'
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**File path support:**
|
|
104
|
-
- Accepts both absolute and relative paths
|
|
105
|
-
- Works with any tool that generates PNG files
|
|
106
|
-
- Useful when screenshots are already saved to disk
|
|
107
|
-
|
|
108
|
-
## Framework Examples
|
|
109
|
-
|
|
110
|
-
### Playwright
|
|
111
|
-
|
|
112
|
-
```javascript
|
|
113
|
-
import { test } from '@playwright/test';
|
|
114
|
-
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
115
|
-
|
|
116
|
-
test('homepage test', async ({ page }) => {
|
|
117
|
-
await page.goto('/');
|
|
118
|
-
|
|
119
|
-
// Using a Buffer
|
|
120
|
-
const screenshot = await page.screenshot();
|
|
121
|
-
await vizzlyScreenshot('homepage', screenshot, {
|
|
122
|
-
properties: {
|
|
123
|
-
browser: 'chrome',
|
|
124
|
-
viewport: '1920x1080',
|
|
125
|
-
page: 'home'
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// Using a file path
|
|
130
|
-
await page.screenshot({ path: './screenshots/homepage.png' });
|
|
131
|
-
await vizzlyScreenshot('homepage', './screenshots/homepage.png', {
|
|
132
|
-
properties: {
|
|
133
|
-
browser: 'chrome',
|
|
134
|
-
viewport: '1920x1080',
|
|
135
|
-
page: 'home'
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Cypress
|
|
142
|
-
|
|
143
|
-
```javascript
|
|
144
|
-
// cypress/support/commands.js
|
|
145
|
-
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
146
|
-
import { join } from 'path';
|
|
147
|
-
|
|
148
|
-
// Using file paths
|
|
149
|
-
Cypress.Commands.add('vizzlyScreenshot', (name, properties = {}) => {
|
|
150
|
-
// Cypress saves screenshots to cypress/screenshots by default
|
|
151
|
-
cy.screenshot(name, { capture: 'viewport' });
|
|
152
|
-
|
|
153
|
-
// Use file path directly
|
|
154
|
-
const screenshotPath = join(Cypress.config('screenshotsFolder'), `${name}.png`);
|
|
155
|
-
|
|
156
|
-
return cy.wrap(
|
|
157
|
-
vizzlyScreenshot(name, screenshotPath, {
|
|
158
|
-
properties: {
|
|
159
|
-
browser: Cypress.browser.name,
|
|
160
|
-
framework: 'cypress',
|
|
161
|
-
...properties
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// In your test
|
|
168
|
-
describe('Homepage', () => {
|
|
169
|
-
it('should render correctly', () => {
|
|
170
|
-
cy.visit('/');
|
|
171
|
-
cy.vizzlyScreenshot('homepage', {
|
|
172
|
-
page: 'home',
|
|
173
|
-
state: 'logged-out'
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Puppeteer
|
|
180
|
-
|
|
181
|
-
```javascript
|
|
182
|
-
import puppeteer from 'puppeteer';
|
|
183
|
-
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
184
|
-
|
|
185
|
-
describe('Visual tests', () => {
|
|
186
|
-
test('homepage screenshot', async () => {
|
|
187
|
-
const browser = await puppeteer.launch();
|
|
188
|
-
const page = await browser.newPage();
|
|
189
|
-
await page.goto('/');
|
|
190
|
-
|
|
191
|
-
// Using a Buffer
|
|
192
|
-
const screenshot = await page.screenshot();
|
|
193
|
-
await vizzlyScreenshot('homepage', screenshot, {
|
|
194
|
-
properties: {
|
|
195
|
-
browser: 'chrome',
|
|
196
|
-
framework: 'puppeteer'
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// Using a file path
|
|
201
|
-
await page.screenshot({ path: './screenshots/homepage.png' });
|
|
202
|
-
await vizzlyScreenshot('homepage', './screenshots/homepage.png', {
|
|
203
|
-
properties: {
|
|
204
|
-
browser: 'chrome',
|
|
205
|
-
framework: 'puppeteer'
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
await browser.close();
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Command Options
|
|
215
|
-
|
|
216
|
-
### Server Configuration
|
|
217
|
-
|
|
218
|
-
**`--port <port>`** - Server port (default: 47392)
|
|
219
|
-
```bash
|
|
220
|
-
vizzly run "npm test" --port 3002
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**`--timeout <ms>`** - Server timeout in milliseconds (default: 30000)
|
|
224
|
-
```bash
|
|
225
|
-
vizzly run "npm test" --timeout 60000
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Build Configuration
|
|
229
|
-
|
|
230
|
-
**`--build-name <name>`** - Custom build name
|
|
231
|
-
```bash
|
|
232
|
-
vizzly run "npm test" --build-name "PR-123"
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
**`--environment <env>`** - Environment name (default: "test")
|
|
236
|
-
```bash
|
|
237
|
-
vizzly run "npm test" --environment "staging"
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**`--branch <branch>`** - Git branch override
|
|
241
|
-
```bash
|
|
242
|
-
vizzly run "npm test" --branch "feature/new-ui"
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Processing Options
|
|
246
|
-
|
|
247
|
-
**`--wait`** - Wait for build completion
|
|
248
|
-
```bash
|
|
249
|
-
vizzly run "npm test" --wait
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**`--upload-all`** - Upload all screenshots without SHA deduplication
|
|
253
|
-
```bash
|
|
254
|
-
vizzly run "npm test" --upload-all
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**`--threshold <number>`** - Comparison threshold (0-1, default: 0.01)
|
|
258
|
-
```bash
|
|
259
|
-
vizzly run "npm test" --threshold 0.02
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Parallel Execution
|
|
263
|
-
|
|
264
|
-
**`--parallel-id <id>`** - Unique identifier for parallel test execution
|
|
265
|
-
```bash
|
|
266
|
-
vizzly run "npm test" --parallel-id "ci-run-123"
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
When using parallel execution, multiple test runners can contribute screenshots to the same build. This is particularly useful for CI/CD pipelines with parallel jobs.
|
|
270
|
-
|
|
271
|
-
### Development Options
|
|
272
|
-
|
|
273
|
-
For TDD mode, use the dedicated `vizzly tdd` command. See [TDD Mode Guide](./tdd-mode.md) for details.
|
|
274
|
-
|
|
275
|
-
**`--allow-no-token`** - Allow running without API token
|
|
276
|
-
```bash
|
|
277
|
-
vizzly run "npm test" --allow-no-token
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**`--token <token>`** - API token override
|
|
281
|
-
```bash
|
|
282
|
-
vizzly run "npm test" --token "your-token-here"
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
## Screenshot Properties
|
|
287
|
-
|
|
288
|
-
The `properties` object in `vizzlyScreenshot()` is flexible and can contain any metadata:
|
|
289
|
-
|
|
290
|
-
```javascript
|
|
291
|
-
await vizzlyScreenshot('dashboard', screenshot, {
|
|
292
|
-
properties: {
|
|
293
|
-
// Technical metadata
|
|
294
|
-
browser: 'chrome',
|
|
295
|
-
os: 'macos',
|
|
296
|
-
viewport: '1920x1080',
|
|
297
|
-
device: 'desktop',
|
|
298
|
-
|
|
299
|
-
// Organizational metadata
|
|
300
|
-
component: 'dashboard',
|
|
301
|
-
page: 'home',
|
|
302
|
-
feature: 'analytics',
|
|
303
|
-
theme: 'dark',
|
|
304
|
-
|
|
305
|
-
// Test metadata
|
|
306
|
-
testSuite: 'smoke-tests',
|
|
307
|
-
userType: 'admin',
|
|
308
|
-
state: 'logged-in',
|
|
309
|
-
|
|
310
|
-
// Custom metadata
|
|
311
|
-
buildNumber: process.env.BUILD_NUMBER,
|
|
312
|
-
environment: 'staging'
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## CI/CD Integration
|
|
318
|
-
|
|
319
|
-
### GitHub Actions
|
|
320
|
-
|
|
321
|
-
```yaml
|
|
322
|
-
name: Visual Tests
|
|
323
|
-
on: [push, pull_request]
|
|
324
|
-
|
|
325
|
-
jobs:
|
|
326
|
-
visual-tests:
|
|
327
|
-
runs-on: ubuntu-latest
|
|
328
|
-
steps:
|
|
329
|
-
- uses: actions/checkout@v4
|
|
330
|
-
- uses: actions/setup-node@v4
|
|
331
|
-
with:
|
|
332
|
-
node-version: '20'
|
|
333
|
-
- run: npm ci
|
|
334
|
-
- run: npx vizzly run "npm test" --wait
|
|
335
|
-
env:
|
|
336
|
-
VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }}
|
|
337
|
-
# Optional: Enhanced git information from GitHub context
|
|
338
|
-
VIZZLY_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
339
|
-
VIZZLY_COMMIT_SHA: ${{ github.event.head_commit.id }}
|
|
340
|
-
VIZZLY_BRANCH: ${{ github.head_ref || github.ref_name }}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
**Enhanced Git Information:** The `VIZZLY_*` environment variables ensure accurate git metadata is captured in your builds, avoiding issues with merge commits that can occur in CI environments.
|
|
344
|
-
|
|
345
|
-
### Parallel Builds in CI
|
|
346
|
-
|
|
347
|
-
For parallel test execution, use `--parallel-id` to ensure all shards contribute to the same build:
|
|
348
|
-
|
|
349
|
-
```yaml
|
|
350
|
-
# GitHub Actions with parallel matrix
|
|
351
|
-
jobs:
|
|
352
|
-
e2e-tests:
|
|
353
|
-
strategy:
|
|
354
|
-
matrix:
|
|
355
|
-
shard: [1/4, 2/4, 3/4, 4/4]
|
|
356
|
-
steps:
|
|
357
|
-
- name: Run tests with Vizzly
|
|
358
|
-
run: |
|
|
359
|
-
npx vizzly run "npm test -- --shard=${{ matrix.shard }}" \
|
|
360
|
-
--parallel-id="${{ github.run_id }}-${{ github.run_attempt }}"
|
|
361
|
-
env:
|
|
362
|
-
VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }}
|
|
363
|
-
|
|
364
|
-
finalize-e2e:
|
|
365
|
-
needs: e2e-tests
|
|
366
|
-
runs-on: ubuntu-latest
|
|
367
|
-
if: always() && needs.e2e-tests.result == 'success'
|
|
368
|
-
steps:
|
|
369
|
-
- name: Finalize parallel build
|
|
370
|
-
run: |
|
|
371
|
-
npx vizzly finalize "${{ github.run_id }}-${{ github.run_attempt }}"
|
|
372
|
-
env:
|
|
373
|
-
VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }}
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
**How Parallel Builds Work:**
|
|
377
|
-
1. All shards with the same `--parallel-id` contribute to one shared build
|
|
378
|
-
2. First shard creates the build, subsequent shards add screenshots to it
|
|
379
|
-
3. After all shards complete, use `vizzly finalize` to trigger comparison processing
|
|
380
|
-
4. Use GitHub's run ID + attempt for uniqueness across workflow runs
|
|
381
|
-
|
|
382
|
-
### GitLab CI
|
|
383
|
-
|
|
384
|
-
```yaml
|
|
385
|
-
visual-tests:
|
|
386
|
-
stage: test
|
|
387
|
-
image: node:20
|
|
388
|
-
script:
|
|
389
|
-
- npm ci
|
|
390
|
-
- npx vizzly run "npm test" --wait
|
|
391
|
-
variables:
|
|
392
|
-
VIZZLY_TOKEN: $VIZZLY_TOKEN
|
|
393
|
-
|
|
394
|
-
# Parallel execution example
|
|
395
|
-
visual-tests-parallel:
|
|
396
|
-
stage: test
|
|
397
|
-
parallel:
|
|
398
|
-
matrix:
|
|
399
|
-
- SHARD: "1/4"
|
|
400
|
-
- SHARD: "2/4"
|
|
401
|
-
- SHARD: "3/4"
|
|
402
|
-
- SHARD: "4/4"
|
|
403
|
-
script:
|
|
404
|
-
- npm ci
|
|
405
|
-
- npx vizzly run "npm test -- --shard=$SHARD" --parallel-id "$CI_PIPELINE_ID-$CI_JOB_ID"
|
|
406
|
-
variables:
|
|
407
|
-
VIZZLY_TOKEN: $VIZZLY_TOKEN
|
|
408
|
-
|
|
409
|
-
finalize-visual-tests:
|
|
410
|
-
stage: finalize
|
|
411
|
-
needs: ["visual-tests-parallel"]
|
|
412
|
-
script:
|
|
413
|
-
- npx vizzly finalize "$CI_PIPELINE_ID-$CI_JOB_ID"
|
|
414
|
-
variables:
|
|
415
|
-
VIZZLY_TOKEN: $VIZZLY_TOKEN
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
## Advanced Usage
|
|
419
|
-
|
|
420
|
-
### Conditional Screenshots
|
|
421
|
-
|
|
422
|
-
Only take screenshots when Vizzly is enabled:
|
|
423
|
-
|
|
424
|
-
```javascript
|
|
425
|
-
import { isVizzlyEnabled, vizzlyScreenshot } from '@vizzly-testing/cli/client';
|
|
426
|
-
|
|
427
|
-
if (isVizzlyEnabled()) {
|
|
428
|
-
const screenshot = await page.screenshot();
|
|
429
|
-
await vizzlyScreenshot('homepage', screenshot);
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
### Batch Screenshot Processing
|
|
434
|
-
|
|
435
|
-
Wait for all screenshots to be processed:
|
|
436
|
-
|
|
437
|
-
```javascript
|
|
438
|
-
import { vizzlyFlush } from '@vizzly-testing/cli/client';
|
|
439
|
-
|
|
440
|
-
// Take multiple screenshots
|
|
441
|
-
await vizzlyScreenshot('page1', screenshot1);
|
|
442
|
-
await vizzlyScreenshot('page2', screenshot2);
|
|
443
|
-
await vizzlyScreenshot('page3', screenshot3);
|
|
444
|
-
|
|
445
|
-
// Wait for all to be processed
|
|
446
|
-
await vizzlyFlush();
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
### Custom Configuration
|
|
450
|
-
|
|
451
|
-
Use a custom configuration per test run:
|
|
452
|
-
|
|
453
|
-
```javascript
|
|
454
|
-
import { configure } from '@vizzly-testing/cli/client';
|
|
455
|
-
|
|
456
|
-
// Configure before taking screenshots
|
|
457
|
-
configure({
|
|
458
|
-
serverUrl: 'http://localhost:3001',
|
|
459
|
-
enabled: true
|
|
460
|
-
});
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
## Troubleshooting
|
|
464
|
-
|
|
465
|
-
**Port already in use**
|
|
466
|
-
```bash
|
|
467
|
-
vizzly run "npm test" --port 3002
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
**Screenshots not captured**
|
|
471
|
-
- Verify you're calling `vizzlyScreenshot()` in your tests
|
|
472
|
-
- Check that your test framework supports the Buffer API
|
|
473
|
-
- Ensure the image data is valid PNG format
|
|
474
|
-
|
|
475
|
-
**Test command not found**
|
|
476
|
-
- Use absolute paths or ensure commands are in PATH
|
|
477
|
-
- Quote complex commands properly
|
|
478
|
-
- Test your command works independently first
|
|
479
|
-
|
|
480
|
-
**Server timeout**
|
|
481
|
-
- Increase timeout for long-running test suites
|
|
482
|
-
- Check for hanging processes or infinite loops
|
|
483
|
-
|
|
484
|
-
```bash
|
|
485
|
-
vizzly run "npm test" --timeout 120000 # 2 minutes
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
## Best Practices
|
|
489
|
-
|
|
490
|
-
### Screenshot Naming
|
|
491
|
-
Use descriptive, consistent names:
|
|
492
|
-
```javascript
|
|
493
|
-
// Good
|
|
494
|
-
await vizzlyScreenshot('homepage-logged-out', screenshot);
|
|
495
|
-
await vizzlyScreenshot('dashboard-admin-view', screenshot);
|
|
496
|
-
|
|
497
|
-
// Avoid
|
|
498
|
-
await vizzlyScreenshot('test1', screenshot);
|
|
499
|
-
await vizzlyScreenshot('screenshot', screenshot);
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
### Organizing Tests
|
|
503
|
-
Group related screenshots with properties:
|
|
504
|
-
```javascript
|
|
505
|
-
await vizzlyScreenshot('user-profile', screenshot, {
|
|
506
|
-
properties: {
|
|
507
|
-
component: 'profile',
|
|
508
|
-
state: 'editing',
|
|
509
|
-
userType: 'admin'
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
### Performance
|
|
515
|
-
- Take screenshots only when necessary
|
|
516
|
-
- Use appropriate image sizes
|
|
517
|
-
- Consider screenshot timing in your tests
|
|
518
|
-
|
|
519
|
-
## Next Steps
|
|
520
|
-
|
|
521
|
-
- Learn about [TDD Mode](./tdd-mode.md) for local development
|
|
522
|
-
- Explore [Upload Command](./upload-command.md) for direct uploads
|
|
523
|
-
- Check the [API Reference](./api-reference.md) for detailed function documentation
|