Issue
I have an Espresso UI Test that uses intending to stub launching a new activity when a button is clicked.
The below code works perfectly fine on devices with Android version 5.1 and lower but on any device with an android version above that intending
doesn't seem to work as described in the docs.
@Test
public void UnitIshTest() throws Exception {
Instrumentation.ActivityResult result =
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent());
intending(hasComponent(TestingController.class.getName())).respondWith(result);
onView(withId(R.id.layout_with_button)).perform(click());
}
Basically I want to check an intent is fired when a particular button is clicked. But I don't actually want the intent to launch the new Activity.
I've attempted to replace the intending line with: intending(isInternal()).respondWith(result);
to catch any possible intent also without success.
Any idea how to get the same functionality to work on Android 6 & 7 devices?
Solution
I have created a bug ticket on issue tracker since intending doesn't seem to be working as described in the docs and the destination activity is actually launched on devices with newer versions of android.
Answered By - Kai
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.