You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Why
The Swift SDK was doing the right high-level job, but its package shape
made native app integration heavier than it needed to be. The core
`Vizzly` product pulled in XCTest helpers, and Swift comparison options
were sent at the top level even though the TDD server reads
per-screenshot comparison settings from `properties`.
We also did not have the same real E2E confidence for Swift that the
other SDKs have. A green unit test could still miss server discovery,
actual PNG upload, local baseline creation, repeated screenshot
matching, or the cloud CI path.
## What changed
- Split XCTest convenience APIs into a new `VizzlyXCTest` product while
keeping the core `Vizzly` client lightweight.
- Updated Swift screenshot payload construction so `threshold`,
`minClusterSize`, and `fullPage` flow through `properties`, matching the
server contract.
- Added focused Swift tests for payload shaping and default
server-config behavior.
- Added `VizzlyE2ETests`, which upload real PNG bytes through
`VizzlyClient` against a real local TDD server.
- Added `npm run test:swift:e2e`, which builds the CLI, starts an
isolated TDD run in a temp directory, and runs the Swift E2E suite.
- Added the Swift SDK to `.github/workflows/sdk-e2e.yml` with both
TDD-mode and cloud-mode runs.
- Wired cloud-mode Swift E2E through the repo secret
`VIZZLY_SWIFT_CLIENT_TOKEN`, matching the per-SDK token pattern used by
the other SDKs.
- Simplified the synchronous upload path with a small request-state
helper for timeout/cancel handling.
- Updated Swift SDK docs and examples for the SPM product split, E2E
command, direct-client usage, and current integration guidance.
## Validation
- `swift test`
- `npm run test:swift:e2e`
- `swift build --sdk
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk
--triple arm64-apple-ios13.0-simulator`
- `swift package describe --type json`
- `git diff --check`
- `ruby -e 'require "yaml";
YAML.load_file(".github/workflows/sdk-e2e.yml"); puts "ok"'`
- Confirmed `VIZZLY_SWIFT_CLIENT_TOKEN` exists in repo Actions secrets.
pod 'Vizzly', :git => 'https://github.com/vizzly-testing/cli', :branch => 'main'
39
-
```
46
+
Vizzly does not currently ship a CocoaPods podspec. Use Swift Package Manager
47
+
for native app integration.
40
48
41
49
## Quick Start
42
50
@@ -54,6 +62,7 @@ This starts a local server at `http://localhost:47392` that receives screenshots
54
62
```swift
55
63
importXCTest
56
64
importVizzly
65
+
importVizzlyXCTest
57
66
58
67
classMyUITests: XCTestCase {
59
68
let app =XCUIApplication()
@@ -128,14 +137,17 @@ func testNavigationBar() {
128
137
129
138
```swift
130
139
functestAnimatedContent() {
131
-
// Allow up to 5% pixel difference (useful for animations)
140
+
// Allow a higher comparison threshold for animated content
132
141
app.vizzlyScreenshot(
133
142
name: "animated-banner",
134
143
threshold: 5
135
144
)
136
145
}
137
146
```
138
147
148
+
If `threshold` or `minClusterSize` is omitted, the server's configured
149
+
comparison settings are used.
150
+
139
151
### Multiple Device Orientations
140
152
141
153
```swift
@@ -187,7 +199,8 @@ extension XCUIApplication {
187
199
funcvizzlyScreenshot(
188
200
name: String,
189
201
properties: [String: Any]?=nil,
190
-
threshold: Int=0,
202
+
threshold: Double?=nil,
203
+
minClusterSize: Int?=nil,
191
204
fullPage: Bool=false
192
205
) -> [String: Any]?
193
206
}
@@ -200,7 +213,8 @@ extension XCUIElement {
200
213
funcvizzlyScreenshot(
201
214
name: String,
202
215
properties: [String: Any]?=nil,
203
-
threshold: Int=0
216
+
threshold: Double?=nil,
217
+
minClusterSize: Int?=nil
204
218
) -> [String: Any]?
205
219
}
206
220
```
@@ -213,15 +227,17 @@ extension XCTestCase {
213
227
name: String,
214
228
app: XCUIApplication,
215
229
properties: [String: Any]?=nil,
216
-
threshold: Int=0,
230
+
threshold: Double?=nil,
231
+
minClusterSize: Int?=nil,
217
232
fullPage: Bool=false
218
233
) -> [String: Any]?
219
234
220
235
funcvizzlyScreenshot(
221
236
name: String,
222
237
element: XCUIElement,
223
238
properties: [String: Any]?=nil,
224
-
threshold: Int=0
239
+
threshold: Double?=nil,
240
+
minClusterSize: Int?=nil
225
241
) -> [String: Any]?
226
242
}
227
243
```
@@ -236,7 +252,8 @@ class VizzlyClient {
236
252
name: String,
237
253
image: Data,
238
254
properties: [String: Any]?=nil,
239
-
threshold: Int=0,
255
+
threshold: Double?=nil,
256
+
minClusterSize: Int?=nil,
240
257
fullPage: Bool=false
241
258
) -> [String: Any]?
242
259
@@ -254,8 +271,9 @@ class VizzlyClient {
254
271
The SDK automatically discovers a running Vizzly TDD server using this priority order:
255
272
256
273
1.**VIZZLY_SERVER_URL environment variable** - Explicitly set server URL
257
-
2.**Global server file** - `~/.vizzly/server.json` written by CLI
258
-
3.**Default port health check** - Tests `http://localhost:47392/health`
274
+
2.**Project server file** - `.vizzly/server.json` in the current directory
275
+
3.**Global server file** - `~/.vizzly/server.json` written by CLI
276
+
4.**Default port health check** - Tests `http://localhost:47392/health`
259
277
260
278
When you run `vizzly tdd start`, the CLI automatically writes server info to `~/.vizzly/server.json` in your home directory, enabling zero-config discovery from iOS tests.
261
279
@@ -440,6 +458,18 @@ Check out the `Example/` directory for:
440
458
- Custom properties and thresholds
441
459
- Direct client usage
442
460
461
+
## SDK E2E Tests
462
+
463
+
The Swift SDK has an end-to-end test path that runs against a real local
464
+
Vizzly TDD server and uploads real PNG bytes through `VizzlyClient`:
465
+
466
+
```bash
467
+
npm run test:swift:e2e
468
+
```
469
+
470
+
This command builds the CLI, starts an isolated TDD run in a temp directory,
471
+
and executes the `VizzlyE2ETests` SwiftPM suite.
472
+
443
473
## Contributing
444
474
445
475
Bug reports and pull requests are welcome at https://github.com/vizzly-testing/cli
0 commit comments