Overview
Last updated
Last updated
A set of TestRules, ActivityScenarios and utils to facilitate UI & screenshot testing under certain configurations, independent of the UI testing libraries you are using. For screenshot testing, it supports:
Jetpack Compose
Android Views (e.g. custom Views, ViewHolders, etc.)
Activities
Fragments
Cross-library & Shared screenshot testing i.e. same test running either on device or on JVM.
This library enables you to easily change the following configurations in your UI tests:
Locale (also Pseudolocales en_XA & ar_XB)
App Locale (i.e. per-app language preference)
System Locale
Font size
Orientation
Custom themes
Dark mode / Day-Night mode
Display size
Wondering why verifying our design under these configurations is important? I've got you covered:
🎨 Design a pixel perfect Android app
Thanks to Screenshotbot for their support!
By using Screenshotbot instead of the in-build record/verify modes provided by most screenshot libraries, you'll give your colleagues a better developer experience, since they will not be required to manually record screenshots after every run, instead getting notifications on their Pull Requests.
This library has been possible due to the work others have done previously. Most TestRules are based on code written by others:
SystemLocaleTestRule -> Screengrab
FontSizeTestRule -> Novoda/espresso-support
UiModeTestRule -> AdevintaSpain/Barista
Orientation change for activities -> Shopify/android-testify
MeasureViewHelpers -> a copy of ViewHelpers from Facebook screenshot-tests-for-android
Moreover, to enable cross-library screenshot tests this library uses the following screenshot testing libraries under the hood:
Create an issue in this repo
Fork the repo Android screenshot testing playground
In that repo, add an example and test where the bug is reproducible/ and showcasing the new feature.
Once pushed, add a link to the PR in the issue created in this repo and add @sergio-sastre as a reviewer.
Once reviewed and approved, create an issue in this repo.
Fork this repo and add the approved code from the other repo to this one (no example or test needed). Add @sergio-sastre as a reviewer.
Once approved, I will merge the code in both repos, and you will be added as a contributor to Android UI testing utils as well as Android screenshot testing playground.
I'll try to make the process easier in the future if I see many issues/feature requests incoming.
Android UI testing utils logo modified from one by Freepik - Flaticon