Skip to content Skip to sidebar Skip to footer

Activityscenario Hangs On Perform(click())

In general, I'm here because tried-and-true ActivityTestRule<> is deprecated, and apparently I need to use ActivityScenario<> or ActivityScenarioRule<>. But they

Solution 1:

onActivity action block is performed on UIThread and onView will wait for UIThread to idle.

You need to call onView outside the onActivity block or else it will deadlock. From your code

scenario.onActivity( (ma) -> {
   //  Do your UI setup
});
onView(...).perform(...);

Post a Comment for "Activityscenario Hangs On Perform(click())"