Developer Generates App Store Screenshots With Robolectric and Headless Browser, No Phone Needed
A developer building iPhone apps written in Compose needed App Store screenshots at 1206x2622 pixels but had no iPhone and limited cloud build minutes, so they used unit tests instead. Robolectric renders Compose to a bitmap on the desktop JVM, and Roborazzi saves it as a PNG, with a qualifier setting a 402 by 874 dp screen at xxhdpi. To mimic the iPhone safe area, the test adds top padding for the Dynamic Island and bottom padding for the home indicator, and the Coil FakeImageLoaderEngine supplies real images and frozen feed data in place of network content. Because Robolectric does not draw WebViews, the article pages are rendered separately in headless Edge inside a 402-pixel iframe and composited beneath the Compose app bar by a Python script. The approach required a small preview parameter in the app code to avoid a polling loop that would block the test framework from going idle.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in