I'm trying to write some UI tests for an Android APP with the espresso framework.
For now I'm just checking if all the elements are present on the splash screen and then I'm trying to click the login button.
When the the button is clicked the test fails due to an error that I can't seem to understand why it's happening.
My test code is
@RunWith(AndroidJUnit4.class) @SmallTest public class WelcomeTest { @Rule public ActivityTestRule<Welcome> mActivityRule = new ActivityTestRule<>( Welcome.class); @Test public void elements_present() { // Check login onView(withId(R.id.wv_login)).check(matches(isDisplayed())); // Check signup onView(withId(R.id.wv_signup)).check(matches(isDisplayed())); // Check video onView(withId(R.id.videoView)).check(matches(isDisplayed())); // Check swipe right onView(withId(R.id.videoView)).perform(swipeRight()); // Check swipe left onView(withId(R.id.videoView)).perform(swipeLeft()); } @Test public void tap_login() { // Tap login button onView(withId(R.id.wv_login)).perform(click()); } } The output I get is:
Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints: at least 90 percent of the view's area is displayed to the user.
What does this mean and is this caused by my test approach or is it a bug on the code? The app seems to work just fine on my devices.
PS: I have disabled the animations as the espresso documentation suggests