Local generation

iOS

Emerge offers a Swift package to generate snapshots locally for your own debugging. For example, this can be helpful if you have a preview that crashes while rendering.

To get started:

  • Install the Swift Package in your project
  • Add a UI test target with SnapshottingTests as a dependency.
  • Create your test that inherits from SnapshottingTests.PreviewTest

See the repo for full documentation.

Android

Emerge offers a gradle task to generate snapshots locally for debugging or saving locally. You'll need a running emulator or connected device to run the local snapshot generation. Make sure the ANDROID_HOME variable is set on your PATH to the Android SDK location on your system, as this task relies on ADB to execute.

./gradlew :app:emergeLocalSnapshotsDebug

Additionally, you can specify where to save the snapshots to using the snapshots extension of the Emerge Gradle plugin. By default, snapshots are saved to the /build/emergetools/snapshots/outputs directory.

emerge {
  ..
  
  snapshots {
    snapshotsStorageDirectory.set("/app/src/main/snapshots") // Storage of locally generated snapshots
  }
}