~/talk

Understand the mechanism! Screenshot-testing Compose previews in many variations

TalkinJapaneseat DroidKaigi 2024 · 2024-09-11..09-13· [testing, android]
links:none on file
slides:none on file

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

  1. 0:00Introduction
  2. 1:26Screenshot testing background
  3. 3:55Compose changes and goals
  4. 5:41Tools overview
  5. 8:31Screenshot tools needed
  6. 12:26Preview screenshot capture
  7. 19:31Variation screenshot strategy
  8. 23:06Compose environment changes
  9. 23:47Robolectric environment changes
  10. 26:14Display size manipulation
  11. 28:03Screenshot after animations
  12. 29:28Full implementation example
  13. 35:09Compose Preview Screenshot Testing
  14. 38:16Tool comparison
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.