Its been 2 weeks since I am studying Espresso and I could not grasp intending
and intended
. When do I use intending
and intended
? The provided example and online tutorials are not helping and researching the web is doing me more damage than good.
Semantically, for intellectual reference, why is it intend-ing
and the other intended
, this added more to the confusion. Is this another Google naming blunder or it's just me? These two methods really don't make sense.
I am misunderstanding its usage. I wanted to test if my activity A
launched activity B
. That's it. Here is my code:
@Test
public void shouldLaunchTagListActivity()
{
onView(withId(R.id.edittext_description_minimized))
.perform(click());
onView(withId(R.id.linearlayout_add_note_maximize))
.check(matches(isDisplayed()));
onView(withId(R.id.relativelayout_quick_action_button))
.check(matches(isDisplayed()));
onView(withId(R.id.imagebutton_tag))
.perform(click());
// should I intended or intending here?
// ???
intended(toPackage(HomeScreenActivity.class.getName()));
onView(withId(R.id.coordinatorlayout_tag_list))
.check(matches(isDisplayed()));
}
This test always passes even I supplant the intent with the wrong the target.
I can check if the other activity has been launched by checking if my target view is existing and was seen by the user. But now I am going to run on a different user story where I really need to check if the activity sent the request to launched another activity (my activity, not external).
Any explanation is greatly appreciated!