@vizzly-testing/cli 0.33.0 → 0.35.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.
Files changed (37) hide show
  1. package/README.md +53 -3
  2. package/dist/api/core.js +2 -1
  3. package/dist/cli.js +21 -8
  4. package/dist/client/index.js +62 -21
  5. package/dist/commands/api.js +9 -3
  6. package/dist/commands/init.js +214 -2
  7. package/dist/commands/preview.js +13 -11
  8. package/dist/commands/project.js +1 -1
  9. package/dist/commands/run.js +18 -6
  10. package/dist/commands/tdd-daemon.js +8 -3
  11. package/dist/commands/tdd.js +24 -4
  12. package/dist/commands/upload.js +31 -13
  13. package/dist/reporter/reporter-bundle.iife.js +1 -1
  14. package/dist/sdk/index.js +23 -9
  15. package/dist/server/handlers/api-handler.js +3 -2
  16. package/dist/server/handlers/tdd-handler.js +5 -1
  17. package/dist/server/routers/screenshot.js +11 -4
  18. package/dist/services/build-manager.js +6 -1
  19. package/dist/test-runner/core.js +4 -1
  20. package/dist/test-runner/operations.js +2 -1
  21. package/dist/types/client.d.ts +32 -5
  22. package/dist/types/index.d.ts +33 -5
  23. package/dist/uploader/core.js +41 -9
  24. package/dist/uploader/operations.js +19 -17
  25. package/dist/utils/config-loader.js +12 -6
  26. package/dist/utils/context.js +46 -76
  27. package/dist/utils/environment-config.js +20 -0
  28. package/dist/utils/output.js +5 -5
  29. package/dist/utils/screenshot-options.js +60 -10
  30. package/package.json +2 -1
  31. package/skills/vizzly/SKILL.md +99 -0
  32. package/skills/vizzly/agents/openai.yaml +4 -0
  33. package/skills/vizzly/references/cli-context.md +42 -0
  34. package/skills/vizzly/references/dynamic-content.md +44 -0
  35. package/skills/vizzly/references/public-screenshots.md +44 -0
  36. package/skills/vizzly/references/sdks.md +62 -0
  37. package/skills/vizzly/references/setup-ci.md +42 -0
@@ -0,0 +1,62 @@
1
+ # SDK Capture Patterns
2
+
3
+ Vizzly works best when screenshots are attached to real user journeys and stable names.
4
+
5
+ ## JavaScript Client
6
+
7
+ ```javascript
8
+ import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
9
+
10
+ let screenshot = await page.screenshot();
11
+ await vizzlyScreenshot('settings-profile-edit-mode', screenshot, {
12
+ properties: {
13
+ browser: 'chromium',
14
+ viewport: 'desktop',
15
+ state: 'edit'
16
+ },
17
+ threshold: 2,
18
+ minClusterSize: 4
19
+ });
20
+ ```
21
+
22
+ `vizzlyScreenshot(name, image, options)` accepts a PNG buffer or file path.
23
+
24
+ Important options:
25
+
26
+ - `properties`: metadata used for baseline identity and filtering.
27
+ - `threshold`: per-screenshot CIEDE2000 Delta E tolerance.
28
+ - `minClusterSize`: minimum changed-pixel cluster size.
29
+ - `fullPage`: marks full-page captures.
30
+
31
+ ## Vitest
32
+
33
+ Use the Vizzly Vitest plugin when present. It keeps the native `toMatchScreenshot` style:
34
+
35
+ ```javascript
36
+ await expect(page.getByRole('heading')).toMatchScreenshot('hero-section.png', {
37
+ properties: {
38
+ theme: 'dark',
39
+ viewport: 'desktop'
40
+ },
41
+ threshold: 2,
42
+ fullPage: true
43
+ });
44
+ ```
45
+
46
+ ## Storybook And Static Sites
47
+
48
+ If the repo uses Vizzly Storybook or static-site clients, prefer those existing flows over adding custom Playwright screenshots. They already know how to crawl stories/pages, name screenshots, and attach viewport metadata.
49
+
50
+ ## Swift
51
+
52
+ Swift/XCTest projects use `VizzlyXCTest` helpers such as `app.vizzlyScreenshot(name:properties:threshold:minClusterSize:)`. For iOS work, verify against the Swift package docs in the repo before changing examples.
53
+
54
+ ## Naming
55
+
56
+ Use stable, descriptive screenshot names:
57
+
58
+ - Good: `checkout-payment-form-valid-card`
59
+ - Good: `settings-profile-edit-mode`
60
+ - Avoid: `screenshot1`, `test`, names with slashes
61
+
62
+ Use properties for variants instead of stuffing every variant into the name.
@@ -0,0 +1,42 @@
1
+ # Setup And CI
2
+
3
+ Use Vizzly locally for fast feedback and in CI for shared review.
4
+
5
+ ## Local Setup
6
+
7
+ ```bash
8
+ vizzly init
9
+ vizzly tdd start
10
+ vizzly tdd run "<test command>" --no-open
11
+ ```
12
+
13
+ The local SDK discovers `.vizzly/server.json` and sends screenshots to the TDD server when it is running.
14
+
15
+ ## Cloud Setup
16
+
17
+ ```bash
18
+ export VIZZLY_TOKEN="project-token"
19
+ vizzly run "<test command>" --wait
20
+ ```
21
+
22
+ Use project tokens in CI. Avoid committing tokens.
23
+
24
+ ## Parallel CI
25
+
26
+ Use `--parallel-id` when jobs are sharded:
27
+
28
+ ```bash
29
+ vizzly run "npm test -- --shard=1/4" --parallel-id shard-1 --wait
30
+ ```
31
+
32
+ Keep fast PR checks and broad scheduled checks separate:
33
+
34
+ - PR builds: critical flows and changed surfaces.
35
+ - Nightly builds: full-page sweeps, generated image suites, docs/manual captures.
36
+
37
+ ## Troubleshooting
38
+
39
+ - Run `vizzly doctor` for local configuration checks.
40
+ - Run `vizzly status <build-id>` for cloud build status.
41
+ - Run `vizzly context build <build-id> --agent --json` for review evidence.
42
+ - If no screenshots appear, verify the SDK/import is present and the TDD server or `vizzly run` wrapper is active.