Skip to content

[DNM] feat(snapshots): Add Roborazzi support for Compose preview scanning#1171

Draft
runningcode wants to merge 1 commit into
mainfrom
no/roborazzi-snapshots
Draft

[DNM] feat(snapshots): Add Roborazzi support for Compose preview scanning#1171
runningcode wants to merge 1 commit into
mainfrom
no/roborazzi-snapshots

Conversation

@runningcode
Copy link
Copy Markdown
Contributor

Summary

Wires sentryUploadSnapshots<Variant> into the Roborazzi build flow when io.github.takahirom.roborazzi is applied, mirroring the existing Paparazzi integration. Roborazzi already provides @Preview-driven Robolectric test generation, so the plugin only configures it, pins its outputDir, and hooks recordRoborazzi<Variant> as a dependency of the upload task.

Behavior

When the user applies io.github.takahirom.roborazzi and sets sentry.snapshots.enabled = true:

  • Auto-adds roborazzi-compose-preview-scanner-support and ComposablePreviewScanner:android to testImplementation.
  • Configures Roborazzi's generateComposePreviewRobolectricTests from the shared snapshots.previews DSL (enable=true, packages from packageTrees, includePrivatePreviews pass-through) — using convention() so user values override.
  • Pins roborazzi.outputDir to build/sentry/snapshots/<variant>/ (also via convention()).
  • Hooks recordRoborazzi<Variant> as a dependency of sentryUploadSnapshots<Variant> and points its snapshotsPath at the staging dir.

If both app.cash.paparazzi and io.github.takahirom.roborazzi are applied to the same module, configuration fails with a clear message.

Notes

  • No sidecar JSON is emitted on the Roborazzi path (per-image metadata is deferred to the ingestion side reading Roborazzi's native results-summary.json once upstream populates context_data with AndroidPreviewInfo). Paparazzi keeps its richer sidecar flow.
  • Per-snapshot @SentrySnapshot.diffThreshold remains Paparazzi-only for now.

Wire `sentryUploadSnapshots<Variant>` into the Roborazzi build flow when
`io.github.takahirom.roborazzi` is applied, mirroring the existing
Paparazzi integration. Roborazzi already provides @Preview-driven
Robolectric test generation, so the plugin only:

- Configures `roborazzi.generateComposePreviewRobolectricTests` from the
  shared `snapshots.previews` DSL (enable, packages, includePrivatePreviews),
  using `convention()` so user-supplied values still win.
- Pins `roborazzi.outputDir` to `build/sentry/snapshots/<variant>/` for the
  upload task to consume.
- Hooks `recordRoborazzi<Variant>` as a dependency of
  `sentryUploadSnapshots<Variant>` and points its `snapshotsPath` at the
  staging dir.
- Adds the required `roborazzi-compose-preview-scanner-support` and
  `ComposablePreviewScanner:android` test dependencies.

Applying both Paparazzi and Roborazzi to the same module fails at
configuration time with a clear message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- Add Roborazzi support for Compose preview scanning ([#1171](https://github.com/getsentry/sentry-android-gradle-plugin/pull/1171))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against b0719d7

@runningcode runningcode changed the title feat(snapshots): Add Roborazzi support for Compose preview scanning [DNM] feat(snapshots): Add Roborazzi support for Compose preview scanning Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant