Skip to content

Stabilize Roborazzi baseline output paths and snapshot workflow docs#146

Merged
jwoglom merged 2 commits into
devfrom
codex/configure-roborazzi-output-and-update-policy
Apr 26, 2026
Merged

Stabilize Roborazzi baseline output paths and snapshot workflow docs#146
jwoglom merged 2 commits into
devfrom
codex/configure-roborazzi-output-and-update-policy

Conversation

@jwoglom

@jwoglom jwoglom commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Keep Roborazzi golden images in deterministic, versioned locations so snapshot baselines can be tracked in the repo and updated intentionally.
  • Ensure snapshot preview tests run only when the Roborazzi recording tasks are invoked, while normal unit-test runs remain unaffected.
  • Make the wear module behave consistently in CI/offline environments with Robolectric offline properties.

Description

  • Update mobile/build.gradle to run snapshot-only tests for Roborazzi tasks by detecting task names and to include snapshot patterns when recording (include '**/snapshots/**') while excluding them for normal runs.
  • Update wear/build.gradle with the same Roborazzi task gating and add CI Robolectric offline system properties (robolectric.offline and robolectric.dependency.dir) so CI/offline runs can use a pre-populated Robolectric cache.
  • Change mobile and wear snapshot helpers (ComposePreviewSnapshotTests.kt) to write deterministic baseline PNGs under src/test/snapshots/roborazzi/ComposePreviewSnapshotTests/<testName>.png so golden images are stable and commit-able.
  • Add .gitignore rules to ignore Roborazzi diff/actual/compare artifacts while allowing the src/test/snapshots baselines to be tracked.
  • Document the baseline recording command and the update policy in README.md (how to run ./gradlew :mobile:recordRoborazziDebug :wear:recordRoborazziDebug and commit updated baselines with UI changes).

Testing

  • Ran ./gradlew clean :mobile:recordRoborazziDebug :wear:recordRoborazziDebug from a clean environment to validate the configuration and task gating, but snapshot recording did not complete because Robolectric attempted to fetch instrumented Android artifacts and the container environment reported Network is unreachable.
  • The Robolectric artifact fetch failure caused Roborazzi snapshot tests to fail (see wear test report failure for ComposePreviewSnapshotTests due to Failed to fetch maven artifact org.robolectric:android-all-instrumented), so no golden PNGs were produced in this environment.
  • The changes to Gradle/test helpers and .gitignore were applied and validated syntactically; when run in a network-enabled or Robolectric-offline-prepared environment the recording command will emit baselines to the newly-configured tracked paths.

Codex Task

@jwoglom jwoglom marked this pull request as ready for review April 26, 2026 22:11
@jwoglom jwoglom merged commit 2cfad9d into dev Apr 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant