I have this test that works about half the time.
@Test
public void thirdSwipe() {
onView(withId(R.id.pager)).perform(swipeLeft());
onView(withId(R.id.pager)).perform(swipeLeft());
onView(withId(R.id.pager)).perform(swipeLeft());
onView(allOf(withId(R.id.hint_english_text), withText("dog 0a"))).check(matches(isDisplayed()));
}
I get this failure:
android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'is displayed on the screen to the user' doesn't match the selected view.
Expected: is displayed on the screen to the user
Got: "TextView{id=2131427358, res-name=hint_english_text, visibility=VISIBLE, width=624, height=62, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=20.0, y=20.0, text=dog 0a, input-type=0, ime-target=false, has-links=false}"
So, it looks like it found the TextView
with "dog 0a"
, but it won't recognize it.
I have looked at other questions and I do set the text with a String
, this is just a few lines from my class:
private String englishText;
englishTextView.setText(englishText);
Also, I am using allOf()
.
Any help would be appreciated. This view is inside of a ViewPager
's view, so I'm not sure if the test is happening before the ViewPager
is idyl, but it does say it finds the view.