There is the following test, which when entering the login form, enters incorrect data, in response to which it displays a dialog box with the text "Warning":
@Test fun signInUserWithInvalidPassword() { goToSignIn() AcceptanceHelper.updateValidationTextView(R.string.ui_data_attribute_email, VALID_EMAIL) AcceptanceHelper.updateValidationTextView(R.string.ui_data_attribute_password, "987654321") AcceptanceHelper.clickOnButtonInLayout(R.id.mainSignButton, R.string.common_signin_button_text, R.id.inputLayout) onView(isRoot()).perform(AcceptanceHelper.waitId(R.id.titleTextView, 5000)) AcceptanceHelper.checkTextView(R.id.titleTextView, "Warning") The problem is that the test falls on the line:
onView(isRoot()).perform(AcceptanceHelper.waitId(R.id.titleTextView, 5000)) A pier opens in a fragment of a dialogue, the elements of which he does not find. And here is the actual waitId method waitId :
fun waitId(id: Int, millis: Long): ViewAction { return object : ViewAction { override fun getConstraints(): Matcher<View> { return isRoot() } override fun getDescription(): String { return "wait for a specific view with id <$id> during $millis millis." } override fun perform(uiController: UiController, view: View) { uiController.loopMainThreadUntilIdle() val startTime = System.currentTimeMillis() val endTime = startTime + millis val viewMatcher = withId(id) do { for (child in TreeIterables.breadthFirstViewTraversal(view)) { // found view with required ID if (viewMatcher.matches(child)) { return } } uiController.loopMainThreadForAtLeast(50) } while (System.currentTimeMillis() < endTime) // timeout happens throw PerformException.Builder() .withActionDescription(this.description) .withViewDescription(HumanReadables.describe(view)) .withCause(TimeoutException()) .build() } } } Maybe someone came across, and can tell.