Understand the mechanism! Screenshot-testing Compose previews in many variations
summary
Describes turning Jetpack Compose @Preview functions into automated screenshot tests across variants (dark mode, tablet sizes, locales) by collecting previews with Showkase or Compose Preview Scanner and running them under Robolectric (setRuntimeEnvironment, ShadowDisplay). Captures images using Roborazzi or ComposeTestRule with parameterized tests to iterate previews, applying font-scale, UI-mode, orientation and clock control for animations and saving uniquely named files; notes Google’s plugin is simpler but less customizable.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:26Screenshot testing background
- 3:55Compose changes and goals
- 5:41Tools overview
- 8:31Screenshot tools needed
- 12:26Preview screenshot capture
- 19:31Variation screenshot strategy
- 23:06Compose environment changes
- 23:47Robolectric environment changes
- 26:14Display size manipulation
- 28:03Screenshot after animations
- 29:28Full implementation example
- 35:09Compose Preview Screenshot Testing
- 38:16Tool comparison
related talks
44mAutomating Screenshot Testing in Compose Multiplatform
41mAndroid Screenshot Testing on Autopilot
19mLet's Preview! Jetpack Compose
34mMastering Jetpack Compose Previews - Test your UI before it tests you!
23mAll your Compose @Previews to screenshot tests without instrumentation
33mPractical Tips and Tricks to Improve Your Compose Previews
42mMaking UI Specs Visible — Compose Screenshot Testing and a Gallery to Support the AI Agent Era
38mPractical Tips and Tricks to Improve Your Compose Previews
