I am trying to test showing Toast but it shown while DialogFragment open (not Activity). I have checked THIS post but most of answers are old / deprecated / for Java. What is the correct way to test it?
My code
@Test
fun testingToast() = runBlocking {
launchFragmentInHiltContainer<EditModeDialog> {
onView(withText(R.string.error_message))
.inRoot(withDecorView(not(activity?.window?.decorView))).check(matches(isDisplayed()))
}
}