Several years ago there was an option to check in test activity has been launched due test execution. Nowadays this class is deprecated. From docs it is not clear how to perform this scenario within ActivityScenario
It is possible to launch another activity within tests, but I do not see an option to check activity has been launched during test scenario. How do you solve this use case?
@Test
fun onStart_openMainScreen_checkThereIsAnListItem() {
val activityScenario = ActivityScenario.launch(MainActivity::class.java)
dataBindingIdlingResource.monitorActivity(activityScenario)
onView(ViewMatchers.withId(R.id.nav_view))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
onView(withId(R.id.list))
.perform(RecyclerViewActions.actionOnItemAtPosition<LawsAdapter.ViewHolder>(12, scrollTo()))
onView(withId(R.id.list))
.perform(RecyclerViewActions.actionOnItemAtPosition<LawsAdapter.ViewHolder>(12, click()))
// TODO check details activity has been launched
activityScenario.close()
}