I am trying to test a click on a button that sends the user to the Phone activity... Like this:
public void callNumber(String number){
Uri numberUri = Uri.parse("tel:"+number);
Intent callIntent = new Intent(Intent.ACTION_DIAL, numberUri);
startActivity(callIntent);
}
Well... but when I run this test:
@Test
public void clickDialButtonTest(){
onView(withId(R.id.help_viewpager)).perform(swipeLeft());
onView(withId(R.id.help_viewpager)).perform(swipeLeft());
onView(withId(R.id.phone_call_btn)).perform(click());
intended(allOf(hasAction(Intent.ACTION_DIAL)));
}
I get this:
Wanted to match 1 intents. Actually matched 0 intents.
I can see that the activity opens and I works fine when I am using the app... But in the espresso test it doesn't work.
I think that the problem is that espresso does't wait for the next activity to start before testing. But I don't know how to wait for it.
Any help is appreciated!
Aucun commentaire:
Enregistrer un commentaire