Android, how to test Google Map

Viewed 4261

So, I have problems with testing my Google Map functionality. In my activty I have callback onMapClick(LatLng latlng) in which there is method to show/hide toolbar. Now, I would like to test it, but I have no clue how to perform click on the map. I tried to use this:

onView(withContentDescription("Mapa Google")).perform(click());

and this:

UiDevice device = UiDevice.getInstance(getInstrumentation());
UiObject map = device.findObject(new UiSelector()
        .descriptionContains("Mapa Google"));
map.click();

but it seams that, it doesn't work. Do you know how can I test this kind of behavior?

3 Answers
Related