Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import SnapshotPreferences
],
])
.snapshotDiffThreshold(0.01)
.snapshotCanvasTheme(.dark)
}
```

Expand All @@ -45,6 +46,7 @@ import SnapshotPreferences
| `.snapshotTags([String: String])` | Adds top-level `tags` to the sidecar for filtering or grouping snapshots. |
| `.snapshotAdditionalContext([String: Any])` | Adds arbitrary key-value context to the sidecar `context` object. Values can be strings, numbers, booleans, or nested objects. |
| `.snapshotDiffThreshold(Float?)` | Adds a local `diff_threshold` for this preview. Sentry reports the image as changed only when the share of changed pixels is greater than this value. |
| `.snapshotCanvasTheme(SnapshotCanvasTheme)` | Sets the top-level `canvas_theme` (`.light` or `.dark`) used behind the image in Sentry's web UI. Display metadata only; it doesn't change the rendered snapshot image. |

## Generated Sidecar Metadata

Expand All @@ -59,6 +61,7 @@ SnapshotPreviews generates default sidecar metadata for each preview. The exact
"team": "growth"
},
"diff_threshold": 0.01,
"canvas_theme": "dark",
"context": {
"test_name": "-[YourAppSnapshotTest portrait-Checkout Preview-1-6]",
"accessibility_enabled": false,
Expand Down
2 changes: 2 additions & 0 deletions docs/product/snapshots/uploading-snapshots/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ You can include an optional JSON file to add metadata to each image:
"team": "growth"
},
"diff_threshold": 0.01,
"canvas_theme": "dark",
"context": {
"component": "BillingPage",
"variant": {
Expand All @@ -69,6 +70,7 @@ You can include an optional JSON file to add metadata to each image:
| `group` | string | Groups related snapshots in the UI sidebar. |
| `tags` | object | Key-value string labels attached to the snapshot. Use them to filter and group snapshots in the viewer, for example by theme, viewport, or component variant. |
| `diff_threshold` | number | Value from `0.0` to `1.0`. Sentry reports the image as changed only when the share of changed pixels is greater than this value. `0.01` ignores changes of 1% or less. |
| `canvas_theme` | string | `"light"` or `"dark"`. Controls the background canvas Sentry renders behind the snapshot image in the web UI. Display metadata only; it doesn't change the rendered image. |
| `context` | object | Arbitrary key-value context that tools and LLMs can use to help diagnose changes. Values can be strings, numbers, booleans, or nested objects. |

![Example of how metadata impacts the Sentry UI](../img/sentry_ui_metadata.png)
Expand Down
Loading