Why do you go with photographers? Our journey with Android screenshot test Written by Diego Francisco Conspecion

Why do you go with photographers? Our journey with Android screenshot test Written by Diego Francisco Conspecion
Latest Job Opportunities in India

Latest Job Opportunities in India

Discover top job listings and career opportunities across India. Stay updated with the latest openings in IT, government, and more.

Check Out Jobs!
Read More

Why do you go with photographers? Our journey with Android screenshot test Written by Diego Francisco Conspecion

Why did we immigrate from the shot to the photographers for better screenshot tests

Click Enter or click to view the image in full size

Accreditation for Ann Negard on Unlike

Screen footage has become a topic at the present time in the Android community. Usually, we are used to testing our Android user interface with devices tests and with the help of the espresso frame, our application is achieved as expected. But how do we make sure that our user interface looks as expected? This is when the screenshot test comes to play.

Once again in 2019, we published a Spread the talk about the screenshot testBut since then things have changed. Although shot Wonderful, we faced some of the problems that we used as our main snapshot test tool.

  • With the purchase of Silicone Apple M1, We had to play with tolerance of colors I decided to record all screen tests again, complicating the lives of those people who do not have Silicon socket.
  • Our team grew a lot, which made the composition of the emulator because we needed to have simulations with the same specifications to verify and record different tests.
  • Since our team was growing and growing, the tests of the test affected our performance, often due to the choice.

The reasons mentioned above made us make the image of the photographer ascending.

What is the screenshot test?

Screen snapshot test (Kind of Dotting test) It consists of offering a display or a formative, take a screenshot of it, and store it for future comparison so that you can see the difference between the original screen image and the new screen.

the The goal of the screenshot test is to check the appearance of the user interface in a specific condition. It should be noted that it can be used for small user interface components and also full screens.

Click Enter or click to view the image in full size

On the left side, there is the original. On the new right side

For more information about the screenshot test and other best practices for the test, I suggest you to check The modern test on Android Talk Written by Goland Verhof and José Alcraika.

Rescue photographers

Photographers It is an additional component and the Grald Library that allows writing the user interface tests for the fully working on JVM screensWithout the need for an actual or emulator.

Photographers depend on Android Layoutlib He is responsible for inspecting the design editor with display display and composables. Layoutlib is the JVM library to present the display/ingredients without an emulator.

Then, as a result, we will get a screenshot like those below

Click Enter or click to view the image in full size

High

It works faster!

We have been used shot Before the appearance of photographers, which depends on the emulator to operate the screenshot tests. In order to compare the timing of different libraries, we set a standard. You can check this in the table below:

As you can see, this means that the photographers are Fast 3 times in registration and 21 times faster to verify From the shot! 🤯

For standard results, we have performed the same screen snapshot tests with both libraries in fine conditions.

Avoid the spoil the emulator

  • Each computer should use or verify the tests (including CI) the same as the composition of the emulator
    Screen size,
    Screen density,
    Android version,
    Dark or light topic,
    – etc.
  • Expensive simulations
    You need a capable machine to make it smoothly. For example, in CI, you will need a naked metal counterpart due to the requirements for speeding up devices for X86, given that EC2 counterparts do not offer 🤑
  • It is difficult to prepare and keep the simulations work properly
    – It may not be difficult, but to form an emulator and use it on CI is difficult. Although you can use some GitHub actions like Android emulator runnerIt is really difficult to perform your tests without any problems resulting from some SDKS or configurations. Another way is that the contestants are self -hosted as mentioned above, but you will need time and some effort to make them run properly.

Low light

Although we have solved a lot of problems, there is nothing perfect and there are some bares as well.

SDK support

Layoutlib is associated with Android Studio because it is responsible for presenting views and literature on Android Studio without the need for an emulator.

What does that mean? Usually you need to wait for the photographers ’promotion project to the latest version of the latest stable version in Android Studio.

For example, if you want to use photographers with SDK 33 targeting, you cannot do it even officially Layoutlib Electric Eel adds support to SDK 33.

As of the time of writing this post (November 2022), Eleel Eel in Beta 4 is expected to be released in the near future in about December 2022. So you have to decide: stop using photographers and the goal of the 33 application programming interface or keep API 32 or less.

However, thanks to society, There is a trick To continue to use photographers while targeting API 33, the downside is that you need to replace their dependency with informal ones 🤷🏼‍♀

Screen snapshot

Currently, the photographer’s library can only take full screenshots or with This trickFull offer. This means that at the present time, a screenshot can not be obtained for real ingredients. You can check the difference between the shot and the description by performing a button test

Photographers

Click Enter or click to view the image in full size

Photographers screen shot

shot

Screenshot

Thus, our shots will occupy more space (locally and after GitHub or other GIT platforms). However, the good idea is to enable Jet LFS According to Photographers’ documents.

to update: Thanks to This public relations We are able to get screenshots for real ingredients 🎉

Conclusions

At JobandTalet, we have passed the photographer’s implementation trip as our screenshots test library and we are really happy with the result, especially with regard to operating times ✨

To summarize, we think Photographers It is a powerful library, when completed by Robolectric solutions or other JVM solutions, will help you accelerate your tests and avoid simulators or expensive tools such as Firebase test laboratory.

Finally and not last, at JobandTalent, we were focusing heavily on the user interface, and created the role of the specific user interface engineer 🎨 in order to focus on our design system. We will talk about it in the following articles, so stay tuned!

https://jobandtalent.engineering/why-go-with-paparazzi-our-journey-with-android-screenshot-testing-6afa88f41300?source=rss—-66415b986b2d—4

Leave a Comment