Skip to content

1.8.0

Compare
Choose a tag to compare
@takahirom takahirom released this 22 Jan 01:27
17046b8

Announcement: Simplified Release Strategy for Roborazzi

We're making some changes to our release strategy to enhance your experience. Moving forward, we will be streamlining our versioning system. Instead of maintaining separate alpha/rc/stable versions, we will integrate experimental features directly into stable releases, marked with clear experimental annotations. This approach aims to simplify updates and improve clarity while ensuring you still have access to the latest features and improvements.

We value your input and experience. If you have any thoughts or feedback on this change, please feel free to share them with us on GitHub Issue #243.

Fix from 1.8.0-rc-1

  • Use ComposeTestRule interface instead of concrete AndroidComposeTestRule class.
    @GisoBartels, Thank you for your code contribution!
    #241

New Feature from 1.7

Introducing the experimental roboOutputName() function

Streamline the customization of Roborazzi image file names. This utility is especially effective in parameterized tests, allowing for dynamic file naming based on test parameters. For an example of its usage, see the snippet below, which demonstrates generating screenshots before and after UI interactions.

@Test
fun launchScreen() {
  // Generates a file named "org.your.pkg.TestClassName.launchScreen_before.png"
  onView(ViewMatchers.isRoot()).captureRoboImage("${roboOutputName()}_before.png")
  // Replace with specific actions, e.g., onView(xxx).performClick()
  
  // Generates a file named "org.your.pkg.TestClassName.launchScreen_after.png"
  onView(ViewMatchers.isRoot()).captureRoboImage("${roboOutputName()}_after.png")
}

Tailor your file naming convention in gradle.properties for even more control, such as omitting the package name.
Set roborazzi.record.namingStrategy=testClassAndMethod for a streamlined naming pattern.
Learn more: Roborazzi Documentation

Enhanced Comparison with Grid and Labels 🚀

This update introduces a new grid and label feature, making visual comparisons more intuitive and effective. The grid layout provides a structured view, while labels offer clear identification, streamlining the testing process.

You can use the old style by setting ComparisonStyle to ComparisonStyle.Simple in RoborazziOptions

  data class CompareOptions(
...
    val comparisonStyle: ComparisonStyle = ComparisonStyle.Grid(),
  ) {
    @ExperimentalRoborazziApi
    sealed interface ComparisonStyle {
      @ExperimentalRoborazziApi
      data class Grid(
        val bigLineSpaceDp: Int? = 16,
        val smallLineSpaceDp: Int? = 4,
        val hasLabel: Boolean = true
      ) : ComparisonStyle

      object Simple : ComparisonStyle
    }

image

Make Roborazzi's ImageComparator customizable.

You can now modify the ImageComparator using CompareOptions.imageComparator.

Behavior changes 🔧

Set the default value of CompareOptions.changeThreshold to zero. This means it will detect even a single pixel change.

What's Changed

  • Make Roborazzi's ImageComparator customizable by @takahirom in #182
  • Set Default Value of CompareOptions.changeThreshold to Zero by @takahirom in #183
  • Fixed a bug where options set via RoborazziRule were ignored by @takahirom in #187
  • Fix the issue of keeping the previous test reports by @takahirom in #189
  • [CI]Speed up integration tests by @takahirom in #190
  • Refactor processOutputImageAndReport by @takahirom in #191
  • Fix the bug where the test reports are not updated when the tests fail by @takahirom in #194
  • Add a document about experimental output parameter by @takahirom in #195
  • Migrate Robolectric to gradle version catalog by @takahirom in #196
  • Add default parameter for CompareOptions.resultValidator by @takahirom in #203
  • Enhance Flexibility with Custom File Naming in Roborazzi via roboOutputName() Function by @takahirom in #205
  • Fix the issue where errors are ignored and occur when changing the size during GIF recording. by @takahirom in #210
  • Add labels and grid lines for the comparison image by @takahirom in #206
  • Fix simple comparison image by @takahirom in #213

Full Changelog: 1.7.0...1.8.0