Android Espresso how to get EditText from custom view and then typeText

Viewed 787

I'm trying to write an Espresso test that will typeText in a custom SearchView. The custom SearchView is here:

https://github.com/MiguelCatalan/MaterialSearchView/tree/develop/library/src/main/res/layout

I'm using it in my MainActivity. If I directly call 'typeText' on this SearchView, it throws an error because I actually need to get the EditText from this SearchBar.

The EditText is in search_view.xml

I think the Espresso command should look like:

onView(get EditText from SearchView).perform(typeText("chicken"));

How should I get the EditText reference?

1 Answers
Related