Screenshot Stabilization for Native apps
Learn how to stabilize screenshots for Native apps
Dynamic content
We currently do not support pausing of animations or stabilization of any dynamic content in App Percy. Please use the ignore region feature on the Percy review screen to mark dynamic zones on the screenshot so that from the next build onwards we would ignore all the differences in the selected area. You can optionally select more than one such ignored regions.
Locale-related issues
If you are using devices with different locale settings then it’s possible that the app under test would change language, date format, currency format, temperature unit, etc as per local. For eg. the Date could be written as 24 Dec 2022 or Dec 24, 2022, depending on the locale.
For purposes of visual tests, you can either use ignore region from the review screen to ignore such differences or use appium capability of locale and language to stabilize the images. Please refer to this document for using the above capabilities.
Screenshot Quality
For iOS sessions, you can use screenshotQuality capability for setting screenshot quality that Appium (and thus App Percy) would use. Higher quality screenshots tend to have fewer compression artifacts and thus resulting in less noise in comparison.
Screenshot quality can only be set while launching a new Appium session. This is a standard Appium capability with possible values of 0, 1, 2 where 0 is the highest quality and 2 is the lowest quality. The default value for this capability is 1. Refer to Appium iOS driver screenshotQuality for more details.
Flaky screenshots
It’s possible that the last action that you performed on the device takes time to complete and so when you are calling percyScreenshot state of the app is always different causing diff on each build.
For example, let us say you have a login button, which on click makes a web request and moves to home activity if the login was successful. If you have code like following
This is likely to flake as it is possible that sometimes login takes 300ms and sometimes it takes 2 seconds. So in some screenshots, you would see a loading spinner, while in others you would see the correct home activity.
For such cases always use either sleep in between that gives sufficient time to load state every time. Or use Appium waitFor* commands. So that you can wait for some element to be displayed or some activity to be loaded before you take a screenshot.
The above example would look something like
Please refer to appium docs for your Appium client to find exact code that would help you stabilize.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!