问题
I am trying to test Alert dialog launch code on a fragment button click and as mentioned in the question title it is distorting up the UI whenever i run this test. the layout doesn't appear properly just some icons without the background of the Alertdialog box appears and no text is being displayed.
Here's the test:
@Test
fun mytest() {
//on this click dialog should launch
onView(withId(R.id.button)).perform(click())
//below line verifies whether the dialog has been launched or not
onView(withText(R.string.name)).check(matches(isDisplayed()))
}
So please tell me what I am doing wrong here.
来源:https://stackoverflow.com/questions/63793127/alertdialog-is-not-getting-launched-properlydistorting-app-ui-when-i-am-trying