02/02/2021, 12:52 AM
has anyone used Espresso to test Android UX that’s backed by a multiplatform ktor client? I’m trying to use Espresso to verify that a response is rendered on the screen, my test starts and I call
and see the request logged, but the ktor client gets blocked and the ktor function never returns. As such the test hangs forever. The application runs fine normally.
I’ve made sure to wrap the call with a counting idling resource at the view model layer a la Smoothie: The only way I can seem to make the ktor function return is by wrapping it in
but that then blocks the UI / main thread.

Jorge R

02/02/2021, 11:22 AM
If you are planning to test this kind of scenario, you better have an architecture that is supporting dependency injection, so you can disconnect from network request calls. Those are introducing a lot of toxicity in tests and it is not worth the effort to do a full end to end testing using Espresso, IMHO.