@argus-vrt/cli 0.1.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 +215 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1778 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +1029 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# @argus-vrt/cli
|
|
2
|
+
|
|
3
|
+
**Visual Regression Testing for React Native**
|
|
4
|
+
|
|
5
|
+
Capture screenshots from iOS Simulators for all your Storybook stories, compare them against baselines, and review changes in a web dashboard.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- macOS with Xcode installed
|
|
10
|
+
- Node.js >= 20
|
|
11
|
+
- React Native app with [Storybook](https://storybook.js.org/tutorials/intro-to-storybook/react-native/en/get-started/) configured
|
|
12
|
+
- iOS Simulator
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
yarn add -D @argus-vrt/cli
|
|
18
|
+
# or
|
|
19
|
+
npm install -D @argus-vrt/cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
### 1. Initialize
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn argus init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This will auto-detect your Storybook config, find available iOS simulators, and create `.argus.json` with sensible defaults.
|
|
31
|
+
|
|
32
|
+
### 2. Add scripts to `package.json`
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"scripts": {
|
|
37
|
+
"visual:test": "argus test",
|
|
38
|
+
"visual:baseline": "argus baseline --update"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Create initial baselines
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Make sure your React Native app with Storybook is running
|
|
47
|
+
yarn ios
|
|
48
|
+
|
|
49
|
+
# Capture screenshots and set baselines
|
|
50
|
+
yarn visual:test --skip-upload
|
|
51
|
+
yarn visual:baseline
|
|
52
|
+
|
|
53
|
+
# Commit your baselines
|
|
54
|
+
git add .visual-baselines
|
|
55
|
+
git commit -m "chore: add visual baselines"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Run visual tests
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# After making UI changes
|
|
62
|
+
yarn visual:test
|
|
63
|
+
|
|
64
|
+
# If changes are intentional, update baselines
|
|
65
|
+
yarn visual:baseline
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Commands
|
|
69
|
+
|
|
70
|
+
### `argus test`
|
|
71
|
+
|
|
72
|
+
Run a complete visual test cycle: capture screenshots, compare against baselines, and upload results.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
argus test [options]
|
|
76
|
+
|
|
77
|
+
Options:
|
|
78
|
+
-b, --branch <branch> Override current git branch
|
|
79
|
+
--base <branch> Base branch for comparison (default: main)
|
|
80
|
+
--skip-capture Skip screenshot capture, use existing screenshots
|
|
81
|
+
--skip-upload Skip uploading results to the web dashboard
|
|
82
|
+
-t, --threshold <threshold> Difference threshold 0-1 (default: 0.01)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `argus init`
|
|
86
|
+
|
|
87
|
+
Interactive setup wizard for your project.
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
argus init [options]
|
|
91
|
+
|
|
92
|
+
Options:
|
|
93
|
+
-f, --force Overwrite existing configuration
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### `argus baseline`
|
|
97
|
+
|
|
98
|
+
Manage visual baselines.
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
argus baseline [options]
|
|
102
|
+
|
|
103
|
+
Options:
|
|
104
|
+
--update Update baselines from current screenshots
|
|
105
|
+
--clear Clear all baselines
|
|
106
|
+
-b, --branch <branch> Branch to use for screenshots (default: current)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `argus capture-all`
|
|
110
|
+
|
|
111
|
+
Capture screenshots of all Storybook stories.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
argus capture-all [options]
|
|
115
|
+
|
|
116
|
+
Options:
|
|
117
|
+
-b, --branch <branch> Override current git branch
|
|
118
|
+
-s, --scheme <scheme> URL scheme for deep linking
|
|
119
|
+
-d, --delay <ms> Delay between captures in ms (default: 1500)
|
|
120
|
+
-f, --filter <pattern> Filter stories by regex pattern
|
|
121
|
+
--skip-shutdown Keep simulator running after capture
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `argus compare`
|
|
125
|
+
|
|
126
|
+
Compare current screenshots against baselines.
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
argus compare [options]
|
|
130
|
+
|
|
131
|
+
Options:
|
|
132
|
+
--base <branch> Base branch for comparison (default: main)
|
|
133
|
+
--current <branch> Current branch (default: current git branch)
|
|
134
|
+
-t, --threshold <threshold> Difference threshold 0-1 (default: 0.01)
|
|
135
|
+
--no-report Skip HTML report generation
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### `argus upload`
|
|
139
|
+
|
|
140
|
+
Upload comparison results to the web dashboard.
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
argus upload [options]
|
|
144
|
+
|
|
145
|
+
Options:
|
|
146
|
+
-b, --branch <branch> Override current git branch
|
|
147
|
+
-u, --api-url <url> Override API URL from config
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### `argus list-stories`
|
|
151
|
+
|
|
152
|
+
List all Storybook stories detected in the project.
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
argus list-stories [options]
|
|
156
|
+
|
|
157
|
+
Options:
|
|
158
|
+
--json Output as JSON
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Configuration
|
|
162
|
+
|
|
163
|
+
Configuration is stored in `.argus.json` in your project root. Run `argus init` to generate it interactively.
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"storybook": {
|
|
168
|
+
"port": 7007,
|
|
169
|
+
"scheme": "myapp",
|
|
170
|
+
"startCommand": "yarn storybook:ios"
|
|
171
|
+
},
|
|
172
|
+
"simulator": {
|
|
173
|
+
"device": "iPhone 16 Pro",
|
|
174
|
+
"os": "18.2",
|
|
175
|
+
"bundleId": "com.myapp"
|
|
176
|
+
},
|
|
177
|
+
"comparison": {
|
|
178
|
+
"mode": "threshold",
|
|
179
|
+
"threshold": 0.01,
|
|
180
|
+
"includeMetrics": true
|
|
181
|
+
},
|
|
182
|
+
"baselineDir": ".visual-baselines",
|
|
183
|
+
"screenshotDir": ".visual-screenshots",
|
|
184
|
+
"apiUrl": "http://localhost:3000"
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
| Field | Required | Description |
|
|
189
|
+
|-------|----------|-------------|
|
|
190
|
+
| `storybook.port` | Yes | Storybook WebSocket port |
|
|
191
|
+
| `storybook.scheme` | Yes | iOS URL scheme for deep linking |
|
|
192
|
+
| `storybook.startCommand` | No | Command to start Storybook |
|
|
193
|
+
| `simulator.device` | Yes | Exact simulator device name (from `xcrun simctl list devices`) |
|
|
194
|
+
| `simulator.os` | Yes | iOS version |
|
|
195
|
+
| `simulator.bundleId` | Yes | App bundle identifier |
|
|
196
|
+
| `comparison.mode` | No | `"strict"` or `"threshold"` (default: `"threshold"`) |
|
|
197
|
+
| `comparison.threshold` | No | Pixel diff threshold 0-1 (default: `0.01`) |
|
|
198
|
+
| `baselineDir` | No | Directory for baseline images (default: `.visual-baselines`) |
|
|
199
|
+
| `screenshotDir` | No | Directory for screenshots (default: `.visual-screenshots`) |
|
|
200
|
+
| `apiUrl` | No | Web dashboard URL for uploading results |
|
|
201
|
+
|
|
202
|
+
## Web Dashboard
|
|
203
|
+
|
|
204
|
+
For a visual review interface with side-by-side diffs and overlay views, see [@argus-vrt/web](https://www.npmjs.com/package/@argus-vrt/web).
|
|
205
|
+
|
|
206
|
+
## How It Works
|
|
207
|
+
|
|
208
|
+
1. **Capture** - Boots iOS simulator, launches your app with Storybook, navigates to each story via deep links, and captures screenshots
|
|
209
|
+
2. **Compare** - Compares current screenshots against baselines using Pixelmatch, generates diff images highlighting changed pixels
|
|
210
|
+
3. **Upload** - Sends results to the web dashboard API (optional)
|
|
211
|
+
4. **Review** - Use the web dashboard to review changes with overlay, side-by-side, and diff views
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|