Assigned
Status Update
Comments
no...@google.com <no...@google.com>
ns...@gmail.com <ns...@gmail.com> #2
I tried adding screenshotTestImplementation(libs.androidx.window)
but it didn't fix it.
hu...@google.com <hu...@google.com>
lo...@gmail.com <lo...@gmail.com> #3
This is likely a duplicate of libs.androidx.window
dependency to implementation
to see if it works?
se...@gmail.com <se...@gmail.com> #4
Hi there! I'm the author of ComposablePreviewScanner. The library works with TestParameters indeed, whereas there might be a bug somewhere. I suggest that you open a Github issue in the repo with a link to a project where it is reproducible.
That issue has nothing to do with Compose Preview Screenshot Testing tool, but that library
That issue has nothing to do with Compose Preview Screenshot Testing tool, but that library
lo...@gmail.com <lo...@gmail.com> #5
Are you sure about that? The behavior is the same for Showkase and ComposablePreviewScanner. I think these two work fine, but this new screenshot testing library is just not designed to pick up those generated test cases. With Paparazzi for example (that I am currently using) those two libraries work completely fine. Or am I missing something?
Description
In the latest beta of AGP 8.5.0, we get the new feature of screenshot testing which is awesome!
As shown in your example, we have to define our composables that should be tested inside
main/src/screenshotTest
. While it is generally a good idea to separate production from testing code, I find it way more convenient to reuse my existing previews for my screenshots tests. In general, I would have to duplicate the existing previews as I also want them besides my composable code and would also have to keep in mind that I have to keep those in sync when for example new states can be handled by the composable. With my current approach (see below), I just write my previews in the composable file and don't have to care at all about updating the screenshot test which is super convenient.Currently, I am using a combination of Showkase and Paparazzi to create my screenshots. First, I am using Showkase to get all previews from my codebase:
Then, I set up a single test using a
TestParameterInjector
to provide all composables:While this works generally very well, there are sometimes situations where the Android Studio preview is different than the rendered screenshot because Paparazzi has to manually update the layoutllib and then release a new version of their library. To fix that, I would highly prefer to use the first party lib for that.
To sum up: I would like to have the option in the new compose screenshot testing library to render my already existing composables from my producion codebase instead of writing extra testing composables.