https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
r

Rodrigo Guerrero

09/28/2023, 2:47 PM
hello, I'm having issues when running
paparazzi
tests using
coil
. 🧵
I'm setting
coil
like this:
Copy code
val engine = FakeImageLoaderEngine.Builder()
            .intercept(url, ColorDrawable(Color.RED))
            .default(ColorDrawable(Color.BLUE))
            .build()
        val imageLoader = ImageLoader.Builder(paparazzi.context)
            .components { add(engine) }
            .build()
        Coil.setImageLoader(imageLoader)
and
paparazzi
like this:
Copy code
@get:Rule
    val paparazzi = Paparazzi(deviceConfig = DeviceConfig.PIXEL_5)
if I run a single test, the screenshot is generated fine
however, if I have more than 1 test, only the first screenshot shows the image, but the other don't
is there a way to make paparazzi work with several tests using coil?
b

Benoit Quenaudon

09/28/2023, 4:21 PM
Doesn’t sound related to coil. If you take multiple shots in the same test, you need to set a name to your snapshot. If that’s one snapshot per test, it should be different.
r

Rodrigo Guerrero

09/28/2023, 4:22 PM
Yeah. I have one screenshot per test only
b

Benoit Quenaudon

09/28/2023, 4:23 PM
Were you able to scope it down and confirm Coil was the difference between tests getting generated or not?
r

Rodrigo Guerrero

09/28/2023, 4:26 PM
No. I don't know why this is happening. I only mentioned coil because is the setup I have.
Hmm. Actually, all the screenshots are created. But the image loaded with coil only shows in the first screenshot. The other screenshots are created but don't show the coil image
b

Benoit Quenaudon

09/28/2023, 4:35 PM
Maybe share more code? Or try to narrow down the problem
r

Rodrigo Guerrero

09/28/2023, 4:39 PM
I'll try something else tomorrow and update with what i find
I have created this repo to reproduce the issue: https://github.com/guerrerorodrigo/paparazzicoil . I have 3 tests (which are exactly the same). When I run
./gradlew app:recordPaparazziDebug
only one screenshot shows the image, the other don't.
I tried the same with
roborazzi
, with the same
coil
configuration, and the images are generated correctly
b

Benoit Quenaudon

10/02/2023, 11:59 AM
The repro project is great. I’d create an issue on the Paparazzi repo directly explaining it all. Better way to get visibility
👍 1