MaterialDesignLibrary
MaterialDesignLibrary copied to clipboard
ButtonRectangle espresso click action
ButtonRectangle doesn't get clicked when using espresso.
onView(withId(R.id.enterBtn)).perform(click());
Here's what happens

It stays like that, and test times out
Yes, I have noticed the same issue. Is there a workaround or a fix in the horizon?
I really hope testing is taken much more seriously, as far as I am concerned, this is a showstopper, it's pretty but broken.
It's not perfect, but I've been calling the onClick function directly (specified in my layout xml) instead of via the button.
e.g. for the following (simplified) xml:
<ButtonRectangle
android:id="@+id/register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="signupWithEmail">
I'll just do the following in my test:
mainActivity.getActivity().signupWithEmail(null);
instead of the usual:
onView(withId(R.id.register)).perform(click());
Hi @jaydeep17, @andrewcross and @appmath,
I have managed to create a workaround for this library to disable button ripple effect when the app is under test.
My workaround requires that a indicator class named 'TestingIndicator', be created within the 'src/androidTest' folder whose classes are only loaded when app is being tested. This class must have package name the same as that of the app under test.
When a button (extends CustomView) is instantiated, we check for presence of 'TestingIndicator' using Class.forName method. If it exists, set variable to define app is under test and from that variable, disable ripple effect.
See commit here to my fork: https://github.com/wilson208/MaterialDesignLibrary/commit/2450808b99e51413404d4b62dcb27b0b0bbbccb2
I am looking for your guys opinions as to whether this is a viable solution to create a pull request, I know its a little hacky but cant think of another way to do this at the moment.
Wilson.
Any update with this? considering changing buttons over this issue.