launchFragmentInContainer<MyFragment>() onView(withId(R.id.refresh)).perform(click()) scenario.onFrament { fragment -> // Check that the fragment handled the click correctly. } }
// fragment-ktx val fragmentViewModel : MyViewModel by viewModels() val activityViewModel : MyViewModel by activityViewModels() // navigation-ktx val navGraphViewModel: MyViewModel by navGraphViewModels(R.id.main)