@vizzly-testing/cli 0.20.0 → 0.20.1-beta.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/dist/api/client.js +134 -0
- package/dist/api/core.js +341 -0
- package/dist/api/endpoints.js +314 -0
- package/dist/api/index.js +19 -0
- package/dist/auth/client.js +91 -0
- package/dist/auth/core.js +176 -0
- package/dist/auth/index.js +30 -0
- package/dist/auth/operations.js +148 -0
- package/dist/cli.js +178 -3
- package/dist/client/index.js +144 -77
- package/dist/commands/doctor.js +121 -36
- package/dist/commands/finalize.js +49 -18
- package/dist/commands/init.js +13 -18
- package/dist/commands/login.js +49 -55
- package/dist/commands/logout.js +17 -9
- package/dist/commands/project.js +100 -71
- package/dist/commands/run.js +189 -95
- package/dist/commands/status.js +101 -66
- package/dist/commands/tdd-daemon.js +61 -32
- package/dist/commands/tdd.js +104 -98
- package/dist/commands/upload.js +78 -34
- package/dist/commands/whoami.js +44 -42
- package/dist/config/core.js +438 -0
- package/dist/config/index.js +13 -0
- package/dist/config/operations.js +327 -0
- package/dist/index.js +1 -1
- package/dist/project/core.js +295 -0
- package/dist/project/index.js +13 -0
- package/dist/project/operations.js +393 -0
- package/dist/reporter/reporter-bundle.css +1 -1
- package/dist/reporter/reporter-bundle.iife.js +16 -16
- package/dist/screenshot-server/core.js +157 -0
- package/dist/screenshot-server/index.js +11 -0
- package/dist/screenshot-server/operations.js +183 -0
- package/dist/sdk/index.js +3 -2
- package/dist/server/handlers/api-handler.js +14 -5
- package/dist/server/handlers/tdd-handler.js +191 -53
- package/dist/server/http-server.js +9 -3
- package/dist/server/routers/baseline.js +58 -0
- package/dist/server/routers/dashboard.js +10 -6
- package/dist/server/routers/screenshot.js +32 -0
- package/dist/server-manager/core.js +186 -0
- package/dist/server-manager/index.js +81 -0
- package/dist/server-manager/operations.js +209 -0
- package/dist/services/build-manager.js +2 -69
- package/dist/services/index.js +21 -48
- package/dist/services/screenshot-server.js +40 -74
- package/dist/services/server-manager.js +45 -80
- package/dist/services/test-runner.js +90 -250
- package/dist/services/uploader.js +56 -358
- package/dist/tdd/core/hotspot-coverage.js +112 -0
- package/dist/tdd/core/signature.js +101 -0
- package/dist/tdd/index.js +19 -0
- package/dist/tdd/metadata/baseline-metadata.js +103 -0
- package/dist/tdd/metadata/hotspot-metadata.js +93 -0
- package/dist/tdd/services/baseline-downloader.js +151 -0
- package/dist/tdd/services/baseline-manager.js +166 -0
- package/dist/tdd/services/comparison-service.js +230 -0
- package/dist/tdd/services/hotspot-service.js +71 -0
- package/dist/tdd/services/result-service.js +123 -0
- package/dist/tdd/tdd-service.js +1145 -0
- package/dist/test-runner/core.js +255 -0
- package/dist/test-runner/index.js +13 -0
- package/dist/test-runner/operations.js +483 -0
- package/dist/types/client.d.ts +25 -2
- package/dist/uploader/core.js +396 -0
- package/dist/uploader/index.js +11 -0
- package/dist/uploader/operations.js +412 -0
- package/dist/utils/colors.js +187 -39
- package/dist/utils/config-loader.js +3 -6
- package/dist/utils/context.js +228 -0
- package/dist/utils/output.js +449 -14
- package/docs/api-reference.md +173 -8
- package/docs/tui-elements.md +560 -0
- package/package.json +13 -13
- package/dist/services/api-service.js +0 -412
- package/dist/services/auth-service.js +0 -226
- package/dist/services/config-service.js +0 -369
- package/dist/services/html-report-generator.js +0 -455
- package/dist/services/project-service.js +0 -326
- package/dist/services/report-generator/report.css +0 -411
- package/dist/services/report-generator/viewer.js +0 -102
- package/dist/services/static-report-generator.js +0 -207
- package/dist/services/tdd-service.js +0 -1437
package/docs/api-reference.md
CHANGED
|
@@ -84,20 +84,53 @@ await vizzlyScreenshot('homepage', './screenshots/homepage.png', {
|
|
|
84
84
|
|
|
85
85
|
### `vizzlyFlush()`
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Signal test completion and trigger the results summary. Call this in your test framework's global teardown to see a summary of all visual comparisons.
|
|
88
88
|
|
|
89
|
-
**Returns:** `Promise<
|
|
89
|
+
**Returns:** `Promise<{ success: boolean, summary: object } | null>`
|
|
90
90
|
|
|
91
|
-
**
|
|
91
|
+
**Summary object:**
|
|
92
|
+
```javascript
|
|
93
|
+
{
|
|
94
|
+
total: number, // Total screenshots compared
|
|
95
|
+
passed: number, // Screenshots that matched baseline
|
|
96
|
+
failed: number, // Screenshots with visual differences
|
|
97
|
+
new: number, // New screenshots (no baseline)
|
|
98
|
+
errors: number // Screenshots that failed to process
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Example - Playwright global teardown:**
|
|
92
103
|
```javascript
|
|
104
|
+
// playwright.config.js or global-teardown.js
|
|
93
105
|
import { vizzlyFlush } from '@vizzly-testing/cli/client';
|
|
94
106
|
|
|
95
|
-
|
|
96
|
-
await
|
|
97
|
-
|
|
107
|
+
export default async function globalTeardown() {
|
|
108
|
+
await vizzlyFlush();
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Example - Jest/Vitest:**
|
|
113
|
+
```javascript
|
|
114
|
+
import { vizzlyFlush } from '@vizzly-testing/cli/client';
|
|
115
|
+
|
|
116
|
+
afterAll(async () => {
|
|
117
|
+
await vizzlyFlush();
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
When `vizzlyFlush()` is called, the TDD server prints a summary like:
|
|
98
122
|
|
|
99
|
-
|
|
100
|
-
|
|
123
|
+
```
|
|
124
|
+
[vizzly] 8 screenshots compared
|
|
125
|
+
|
|
126
|
+
+ 5 passed
|
|
127
|
+
|
|
128
|
+
! 3 visual changes detected
|
|
129
|
+
- billing-settings-page
|
|
130
|
+
- checkout-form
|
|
131
|
+
- profile-page
|
|
132
|
+
|
|
133
|
+
> View changes: http://localhost:47392/dashboard
|
|
101
134
|
```
|
|
102
135
|
|
|
103
136
|
### `isVizzlyEnabled()`
|
|
@@ -664,6 +697,11 @@ Configuration loaded via cosmiconfig in this order:
|
|
|
664
697
|
comparison: {
|
|
665
698
|
threshold: number, // CIEDE2000 Delta E (default: 2.0)
|
|
666
699
|
minClusterSize: number // Min cluster size for noise filtering (default: 2)
|
|
700
|
+
},
|
|
701
|
+
|
|
702
|
+
// Output Configuration
|
|
703
|
+
output: {
|
|
704
|
+
logLevel: string // Log level: 'debug', 'info', 'warn', 'error' (default: 'info')
|
|
667
705
|
}
|
|
668
706
|
}
|
|
669
707
|
```
|
|
@@ -727,6 +765,133 @@ These are set automatically when running `vizzly run` or `vizzly tdd`:
|
|
|
727
765
|
|----------|-------------|
|
|
728
766
|
| `VIZZLY_USER_AGENT` | Custom User-Agent string for API requests |
|
|
729
767
|
|
|
768
|
+
## Controlling Output
|
|
769
|
+
|
|
770
|
+
Vizzly is designed to be quiet by default - it won't clutter your test runner output.
|
|
771
|
+
|
|
772
|
+
### Default Behavior
|
|
773
|
+
|
|
774
|
+
- **During tests**: Zero output from Vizzly (test runner owns the terminal)
|
|
775
|
+
- **After tests**: Summary showing pass/fail counts and dashboard link
|
|
776
|
+
|
|
777
|
+
### When is the Summary Shown?
|
|
778
|
+
|
|
779
|
+
The summary is automatically displayed in these scenarios:
|
|
780
|
+
|
|
781
|
+
1. **`vizzly tdd run "npm test"`** - Summary shown when the test command completes
|
|
782
|
+
2. **`vizzlyFlush()` called** - Summary shown when flush is called (use in global teardown)
|
|
783
|
+
|
|
784
|
+
If you're using `vizzly tdd start` (daemon mode) and running tests directly, add `vizzlyFlush()` to your test framework's global teardown to see the summary.
|
|
785
|
+
|
|
786
|
+
#### Playwright
|
|
787
|
+
|
|
788
|
+
```javascript
|
|
789
|
+
// playwright.config.js
|
|
790
|
+
export default {
|
|
791
|
+
globalTeardown: './global-teardown.js'
|
|
792
|
+
};
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
```javascript
|
|
796
|
+
// global-teardown.js
|
|
797
|
+
import { vizzlyFlush } from '@vizzly-testing/cli/client';
|
|
798
|
+
|
|
799
|
+
export default async function globalTeardown() {
|
|
800
|
+
// Show Vizzly visual test summary (if TDD server is running)
|
|
801
|
+
await vizzlyFlush();
|
|
802
|
+
|
|
803
|
+
// ... your other teardown logic
|
|
804
|
+
}
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
#### Jest
|
|
808
|
+
|
|
809
|
+
```javascript
|
|
810
|
+
// jest.config.js
|
|
811
|
+
module.exports = {
|
|
812
|
+
globalTeardown: './global-teardown.js'
|
|
813
|
+
};
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
```javascript
|
|
817
|
+
// global-teardown.js
|
|
818
|
+
const { vizzlyFlush } = require('@vizzly-testing/cli/client');
|
|
819
|
+
|
|
820
|
+
module.exports = async () => {
|
|
821
|
+
await vizzlyFlush();
|
|
822
|
+
};
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
#### Vitest
|
|
826
|
+
|
|
827
|
+
```javascript
|
|
828
|
+
// vitest.config.js
|
|
829
|
+
export default {
|
|
830
|
+
test: {
|
|
831
|
+
globalSetup: './global-teardown.js'
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
```javascript
|
|
837
|
+
// global-teardown.js
|
|
838
|
+
import { vizzlyFlush } from '@vizzly-testing/cli/client';
|
|
839
|
+
|
|
840
|
+
export async function teardown() {
|
|
841
|
+
await vizzlyFlush();
|
|
842
|
+
}
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### Example Output
|
|
846
|
+
|
|
847
|
+
```
|
|
848
|
+
[vizzly] 8 screenshots compared
|
|
849
|
+
|
|
850
|
+
+ 5 passed
|
|
851
|
+
|
|
852
|
+
! 3 visual changes detected
|
|
853
|
+
- billing-settings-page
|
|
854
|
+
- checkout-form
|
|
855
|
+
- profile-page
|
|
856
|
+
|
|
857
|
+
> View changes: http://localhost:47392/dashboard
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
### Verbose Mode
|
|
861
|
+
|
|
862
|
+
Use `--verbose` or `-v` to see per-screenshot details:
|
|
863
|
+
|
|
864
|
+
```bash
|
|
865
|
+
vizzly tdd run "npm test" --verbose
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
In verbose mode, each screenshot is listed individually with diff percentages for failures.
|
|
869
|
+
|
|
870
|
+
### Environment Variables for Output
|
|
871
|
+
|
|
872
|
+
| Variable | Description | Default |
|
|
873
|
+
|----------|-------------|---------|
|
|
874
|
+
| `VIZZLY_LOG_LEVEL` | CLI verbosity: `debug`, `info`, `warn`, `error` | `info` |
|
|
875
|
+
| `VIZZLY_CLIENT_LOG_LEVEL` | Client SDK verbosity (runs in test process) | `error` |
|
|
876
|
+
|
|
877
|
+
The client SDK defaults to `error` to minimize noise in test output. Set to `debug` for troubleshooting:
|
|
878
|
+
|
|
879
|
+
```bash
|
|
880
|
+
VIZZLY_CLIENT_LOG_LEVEL=debug npm test
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
### Config File
|
|
884
|
+
|
|
885
|
+
You can also configure output settings in `vizzly.config.js`:
|
|
886
|
+
|
|
887
|
+
```javascript
|
|
888
|
+
export default defineConfig({
|
|
889
|
+
output: {
|
|
890
|
+
logLevel: 'debug' // Show detailed per-screenshot output
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
```
|
|
894
|
+
|
|
730
895
|
## Error Handling
|
|
731
896
|
|
|
732
897
|
### Client Errors
|