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

Make it work with devices/emulators #12

Open
takahirom opened this issue Mar 25, 2023 · 2 comments
Open

Make it work with devices/emulators #12

takahirom opened this issue Mar 25, 2023 · 2 comments

Comments

@takahirom
Copy link
Owner

takahirom commented Mar 25, 2023

I don't know if I do this or not, but We should be able to test both the JVM and the emulator/device using the same test with the following steps using AndroidJUnit4.

  • Create Gradle task for AndroidTest
  • Sending and receiving images via adb. Before the test starts, push the image that is currently stored to the device for verify. And pull the results when the test is over.
  • Creation of roborazzi-android-painter and roborazzi-awt-painter. We need to abstract the painter. We need to be able to draw to Android Bitmap what we are doing now with BufferedImage.
@sergio-sastre
Copy link

I can help with this at some point in the future, but I believe it does not have high prio.

One can always use another library for on-device screenshot testing when needed (as we do 😅)

However, when implementing this, I’d suggest to do something similar to Dropshots. It runs with the connectedAndroidTest tasks, what comes together with support for Gradle managed devices, which other libraries don’t support

@utzcoz
Copy link

utzcoz commented Dec 29, 2023

@sergio-sastre @takahirom I think you can check ActivityScenario, which is cross-environments from Robolectric to Devices. There are two important keys that it can work like this:

  1. AndroidX Test's AndroidJUnit4 will dispatch the runner to RobolectricTestRunner if it finds Robolectric class when running. Otherwise it will use default AndroidX Test runner to run tests on devices.'
  2. Robolectric supports necessary APIs that ActivityScenario requires to support these APIs in Robolectric environment.

Maybe Robarazzi can do similar work to make itself cross-environments with the only one top-level API suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants