Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for pixel-by-pixel comparison of screenshots #403

Open
AzamatCherchesov opened this issue Nov 2, 2022 · 4 comments
Open

Support for pixel-by-pixel comparison of screenshots #403

AzamatCherchesov opened this issue Nov 2, 2022 · 4 comments
Labels
enhancement New feature or request research To understand if improvement is possible and whether it suits the Kaspresso

Comments

@AzamatCherchesov
Copy link
Collaborator

No description provided.

@AzamatCherchesov AzamatCherchesov added enhancement New feature or request research To understand if improvement is possible and whether it suits the Kaspresso labels Nov 2, 2022
@sergio-sastre
Copy link
Contributor

Once this is groomed, I'd like to review the approach taken.
I believe it will be super easy to oversee something and I have pretty good experience in the area

@AzamatCherchesov
Copy link
Collaborator Author

@sergio-sastre Hello.
Sounds very good.
Do you have elements of an implementation available on github?

We're not sure if it's in the Kaspresso area

We can implement a method for tests that will screenshot the screen during the test run, compare it with the reference value and show the difference

But we see a lot of edge cases, such as runs on different devices. Do you think it makes sense to do this within the Kaspresso, or should it be done outside?
On the infrastructure side and CI/CD for example?

@Areyana
Copy link
Collaborator

Areyana commented Nov 29, 2022

I reviewed several approaches for pixel-by-pixel comparison on github. There are a lot of simple solutions, with just pixel diff (and recolored pixel diff) and more complex solutions with side image comparison tools on lua/python. The main questions are:

  1. Where to store reference images, how to update reference images ?

We can write some gradle plugin that can integrate our reference images by command in AS project (for example, src/main/references). But is it really in the Kaspresso area ? It's more like an infrastructure tool, that is not related for Kaspresso capabilities as a Test framework. Also, i think that most of production teams will create some kind of CI/CD tools to handle reference images on their pipelines.

  1. Edge cases on different devices

As a UI test frame we need to provide basic solution out of the box, so again we need to write some sh scripts to create one ideal "emulator" but the UI view is not deterministic even around one emulator (also Kaspresso in this cases needs to manage folders for different resolutions like android resources for example). Again seems to be like CI/CD pipelines work.

  1. Image comparison mechanic + reports

The most simple solution as i mentioned was pixel by pixel diff with % threshold. As a output we'll have the screenshoted image and reference image with recolored pixel diff, but i think it's too simple solution for Kaspresso. As for more complex solutions i think again it will be better to run on CI/CD pipelines cause of running complicated 3rd party tools is a bit too much for an on device ui test framework.

  1. Maintenance
    As for complex feature we need to maintain it, but popularity of that feature under question.

In conclusion, as we discussed with @AzamatCherchesov and team, now we won't do anything related for pixel-by-pixel comparison cause it's not Kaspresso related feature from our point of view. Maybe we can create another one 3rd party tool for that problem, but not in Kaspresso for now.

@sergio-sastre
Copy link
Contributor

sergio-sastre commented Nov 29, 2022

I reviewed several approaches for pixel-by-pixel comparison on github. There are a lot of simple solutions, with just pixel diff (and recolored pixel diff) and more complex solutions with side image comparison tools on lua/python. The main questions are:

  1. Where to store reference images, how to update reference images ?

We can write some gradle plugin that can integrate our reference images by command in AS project (for example, src/main/references). But is it really in the Kaspresso area ? It's more like an infrastructure tool, that is not related for Kaspresso capabilities as a Test framework. Also, i think that most of production teams will create some kind of CI/CD tools to handle reference images on their pipelines.

  1. Edge cases on different devices

As a UI test frame we need to provide basic solution out of the box, so again we need to write some sh scripts to create one ideal "emulator" but the UI view is not deterministic even around one emulator (also Kaspresso in this cases needs to manage folders for different resolutions like android resources for example). Again seems to be like CI/CD pipelines work.

  1. Image comparison mechanic + reports

The most simple solution as i mentioned was pixel by pixel diff with % threshold. As a output we'll have the screenshoted image and reference image with recolored pixel diff, but i think it's too simple solution for Kaspresso. As for more complex solutions i think again it will be better to run on CI/CD pipelines cause of running complicated 3rd party tools is a bit too much for an on device ui test framework.

  1. Maintenance
    As for complex feature we need to maintain it, but popularity of that feature under question.

In conclusion, as we discussed with @AzamatCherchesov and team, now we won't do anything related for pixel-by-pixel comparison cause it's not Kaspresso related feature from our point of view. Maybe we can create another one 3rd party tool for that problem, but not in Kaspresso for now.

@AzamatCherchesov @Areyana
Wow, sorry for not replying before, I completely forgot about this!

Completely agree on that.
One can always use Kaspresso for "waiting for views" to be ready before taking any screenshot. Moreover, since Kaspresso can also run with Robolectric, any current framework, including Paparazzi which runs on the JVM as well, could be use together with Kaspresso for screenshot testing.

What could be interesting is to add some samples in Kaspresso on how you can use it together with e.g Shot and Paparazzi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research To understand if improvement is possible and whether it suits the Kaspresso
Projects
None yet
Development

No branches or pull requests

3 participants