1.22.0
Experimental Compose Preview Support ๐
We're excited to announce the experimental release of Compose Preview Support for Roborazzi, a powerful new feature that streamlines the process of generating screenshot tests for Jetpack Compose Previews.
Key Features
- Automated Test Generation: Automatically generate screenshot tests for Composable Previews using the ComposablePreviewScanner library
- Manual Integration Support: For those who prefer more control, we've added helper functions to manually integrate Compose Preview screenshot tests.
How to Use
To enable Compose Preview screenshot test generation, add the following to your build.gradle.kts
:
roborazzi {
generateComposePreviewRobolectricTests {
enable = true
}
}
After configuration, run the recordRoborazziDebug
task to generate screenshots using the newly created tests.
Customization Options
Customize your setup with options like:
- Specifying package names to scan
- Defining a custom test class
- Configuring Robolectric settings
Manual Integration
For manual integration, add the following dependency:
testImplementation("io.github.takahirom.roborazzi:roborazzi-compose-preview-scanner-support:[version]")
Then use the ComposablePreview<AndroidPreviewInfo>.captureRoboImage()
function in your tests. Note that ComposablePreview
is a class provided by the ComposablePreviewScanner library, which Roborazzi utilizes for this feature.
This approach allows for more fine-grained control over the screenshot capture process for Compose Previews.
Acknowledgements
Special thanks to @yschimke for the initial proposal, and to @sergio-sastre and @yschimke for their valuable design and code reviews.
For more detailed information on setup and usage, please visit our documentation.
Enhanced Accessibility Text Capture
Thanks to @lukas-mercari 's contribution, we've improved accessibility text dumping for merged Compose elements. Both content descriptions and text are now captured, providing more comprehensive accessibility information in tests.
What's Changed
- [roborazzi-idea-plugin] Fix: Icons are not shown in the new UI by @takahirom in #421
- [CI]Wait for main to succeed for compare ci by @takahirom in #422
- [CI] Remove main push trigger from compare ci by @takahirom in #423
- [CI] Add unit test for WebAssets class by @eyedol in #412
- [Sample]Update dependency androidx.compose.foundation:foundation to v1.6.8 by @renovate in #340
- [Bug fixes] Dump both content description as well as text for the case when two elements are merged by @lukas-mercari in #430
- [Improvement] Add roborazzi-compose-preview-scanner-support module to handle preview settings by @takahirom in #427
- [Feature] Implement generateRobolectricPreviewTests prototype by @takahirom in #416
Full Changelog: 1.21.0...1.22.0