-
Notifications
You must be signed in to change notification settings - Fork 108
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
Integration with Paparazzi screenshot testing #207
Comments
Showkase itself doesn't provide any integrations (yet). The blog post that you probably saw(https://proandroiddev.com/automatic-screenshot-testing-for-all-your-compose-previews-6add202fecc7) used Showkase for the automated infra but then integrated it with Facebook's library. In theory, it can work with anything but you will have to do that setup today. I fully intend to provide a sample integration and expose it as an artifact at some point. If you are interested, I'd be happy to accept a contribution that adds a Paparazzi integration submodule (or even Shot). |
Wow, Paparazzi looks interesting. I'm not very happy with Facebook's library. It's not very maintained and it doesn't work for API 28+. If it runs without emulator, it can faster and a deal-breaker for CI integrations. Emulators on CI are pain to setup. I might try to play with Papparazi + Showkase in some free time. |
I tried to play with Paparazzi in my sample app and when I run the Paparazzi test command, I get this:
The root cause is that Showkase screenshot testing support requires to be run as instrumentation test. Why is that? Paparazzi provides The code I tried is in this branch: https://github.com/davidvavra/showkase-screenshot-tests/tree/paparazzi |
I think that's a Compose requirement itself. I haven't double checked this but that's what I always assumed. |
Well, Papparazi has to do it somehow. They support snapshotting Views without instrumentation. They don't support Compose now, but they plan it for v1. But I'm assuming wrapping composables into Views might work. Might be worth investigating how they do it. |
They embed the android studio renderer and rely on it to render views as images without requiring an emulator |
I started the integration of paparazzi 1.0.0 (snapshot, the version supporting compose) in https://github.com/marcorighini/Showkase/tree/paparazzi-screenshot-testing-integration Still to investigate:
|
I was able to utilize Showkase's code generation to automatically populate Paparazzi tests by avoiding the Instead, I just pulled out the list of components (from |
@alexvanyo Very cool! I had initially taken the parameterized test route myself but eventually found a limitation that didn't allow us to use it with our setup. It was something to do with how the Firebase Test Lab was handling sharding iirc. |
Just curious, were you trying to run those Paparzzi + Showkase tests on device? |
@alexvanyo No I meant for the original implementation of automated screenshot testing itself. It wasn't using Paparazzi then but I think this might be viable now that Paparazzi supports Compose. |
Ah gotcha, yeah parameterized testing doesn't play well with instrumented tests last time I checked, I am using https://github.com/google/TestParameterInjector for that. |
@alexvanyo Great! Can you share some code sample? I would like to play around with it and maybe then publish some article/library for it. I would love to get rid of Android emulator in our CI setup, it is causing a lot of flakiness/slowness/maintanance. |
Just as an update to an earlier comment on this thread, I did push a PR that adds Shot integration as a new artifact - #232. This should give you an end-to-end working solution for screenshot testing. Would love to have a similar artifact for Paparazzi as well... |
https://gist.github.com/alexvanyo/c4d2b6530f860f3c89a33324d4152ae8 has the main |
@alexvanyo I couldn't make it work. I'd be great if you can share all the related classes or a sample repo. |
android/nowinandroid#101 has a full PR in a project with the setup with Paparazzi for reference! |
Thanks @alexvanyo, I created a full-fledged example including CI integration based on your work: https://github.com/davidvavra/showkase-screenshot-tests And I wrote an article about it: |
A sample implementation has also been added to Showkase itself for your reference - https://github.com/airbnb/Showkase/blob/master/showkase-screenshot-testing-paparazzi-sample/src/test/java/com/airbnb/android/showkase/screenshot/testing/paparazzi/sample/PaparazziSampleScreenshotTest.kt |
I've just started working on an artifact ( |
Showkase is actually providing an integration with facebook screenshot testing.
Is it possible to integrate Showkase with Paparazzi (screenshot testing without device, link https://github.com/cashapp/paparazzi)?
The text was updated successfully, but these errors were encountered: