mattinger
02/20/2025, 2:25 PMdelay
function in between calls
• My test code uses the function composeTestRule.waitUntilExactlyOneExists
What i'm experiencing is that the ``composeTestRule.waitUntilExactlyOneExists`` is blocking the main test thread, which is expected, but it's also blocking the thread that the viewModelScope is executing on. As a result, the delay
function never returns, and the polling loop is just sitting there blocked.
I can overcome this by overriding the main dispatcher, but it seems counter intuitive that the ComposeTestRule and the view model scope in the robolectric engine would use the same underlying dispatcher .
@Before
fun setup() {
Dispatchers.setMain(<http://Dispatchers.IO|Dispatchers.IO>)
}
Has anyone experienced this and/or has a more elegant way to handle this? I would think that robolectric would isolate these two things from each other.