<@UJEJ3UXBP> Is there a way to add Idling resource...
# compose
a
@Pedro Gomez Is there a way to add Idling resources to Coil Image loading in compose UI for Screenshot testing? I have few cases, where I use the same Image Url but only first test does not load the image and rest all screenshots have the image @theapache64
2
c
@Abhinav Sharma Coil has its own implementation here which you can copy into your project. Also here’s how it’s registered.
🙏 1
a
Thanks @Colin White I guess I need to modify the ImageLoaderIdlingResource.kt as the EventListener changes are not yet live in 1.4.0
c
Yep, there are some slight changes to the API of EventListener in 2.x (so we can expose the
ImageResult
objects, though it should be possible to backport it to 1.x’s API
1
p
Hey sorry for the late response, I do not check this slack as often as I should do. I guess you fixed your issue already, am I wrong? What I usually do in my projects is to replace the image I load with an asset. If you are using dependency injection or you can check if you are running instrumentation tests you can replace your process to download the image with synchronous code reading one asset and showing it in your view. This will help you to reduce your test flakiness because you'll never relay on the network when running your tests. Sorry for the late response, I hope it helps 😃
a
@Pedro Gomez yes the problem got solved already. Thanks for your reply 👍🏻