How to take App Store screenshots automatically
Take the screenshots from UI tests instead of a simulator you tap through by hand. A UI test opens each screen and saves a screenshot at the point you choose. fastlane runs the tests, so the same screenshots come out again each time the app changes. On iOS the tool is snapshot; on Android it is screengrab.
kinhin writes the wiring: a screenshots lane, the settings files and sample tests.
Steps
- Add the lane. Run
kinhin mobile initin your project. It writes the settings, the sample tests and the lane. It does not edit your Xcode project or your Gradle files. - Add a UI test target (iOS, once). In Xcode, add a UI Testing Bundle target. The iOS setup steps show each click.
- Write the tests. Replace the sample tests with tests that open your screens. Call
snapshot("01-home")on iOS orScreengrab.screenshot("01-home")on Android at each screen. - Run the lane. From the folder that holds
fastlane/, runbundle exec fastlane screenshots. On iOS you get one PNG persnapshotcall and language, infastlane/screenshots/.
Framing with frameit is optional. Uploading to the stores is off until you turn it on.
What has been verified
The iOS lane has been run on an iPhone 17e simulator, and the output layout above is what it wrote. Read Store screenshots with fastlane for every setting and the Android details.
For a full walk-through, including the first build, see Tutorial: first build.
