I am trying to check with Espresso a NestedScrollView, but I have an error:
"The action will not be completed because the target view does not meet one or more of the following restrictions: at least 90 percent of the viewing area is displayed to the user.
I know that this error is due to the fact that Android does not detect the button that I want to click, that is, I need to scroll down to see the button. I also read that scrollTo () is not available for NestedScrollView, so I cannot use it. I guess I need to scroll to the bottom of the NestedScrollView to see the button, and I'm not sure about this, and don't know how to do it.

I want to click the button in red, but it has no visibility. I saw some stack questions and some lessons, but I can't figure out how to scroll the bottom of the nested.
Application Toolbar Code:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.findandgo.activity.MenuPrincipal" > <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/appbar_padding_top" android:theme="@style/AppTheme" > <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll" app:popupTheme="@style/AppTheme.AppBarOverlay" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"/> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" />` </android.support.design.widget.CoordinatorLayout>
NestedScrollView Code:
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fragment_evento_crear" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="fill_vertical" android:background="@drawable/fondo" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".Evento" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:nestedScrollingEnabled="false" android:padding="@dimen/size_20" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin"> <com.findandgo.custom.CustomFontEditText android:id="@+id/idEtEventoNuevoNombre" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/idSpEventoNuevoCategoria" android:layout_alignStart="@+id/idSpEventoNuevoCategoria" android:layout_below="@id/tool_bar" android:hint="@string/sEventoNombre" android:textSize="@dimen/size_12" app:font="@string/font_name_source_amatic_regular" /> ... <ImageButton android:id="@+id/idBEventoNuevoRegistrar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/idEtEventoNuevoDescripcion" android:layout_centerHorizontal="true" android:background="@drawable/btn_save" android:contentDescription="@string/eventoNuevoRegristar" android:textStyle="bold" android:visibility="visible" /> </RelativeLayout> </android.support.v4.widget.NestedScrollView>
As you can see, the button id is idBEventoNuevoRegistrar and the contentDescription is eventoNuevoRegistrar
Finally, in espresso, I tried the following.
onData(withContentDescription(R.string.eventoNuevoRegristar)).check(matches(isDisplayed())).perform(click());
This creates an error: assigned from the class: class android.widget.AdapterView corresponds to several views in the hierarchy.
onView(withId(R.id.idBEventoNuevoRegistrar)).check(matches(isDisplayed())).perform(click());
This leads to an error: The action will not be completed because the target view does not meet one or more of the following restrictions: at least 90 percent of the viewing area is displayed to the user.
Also I tried:
onData(withId(R.id.idBEventoNuevoRegistrar)) .check(matches(isDisplayed())) .perform(click());
This causes an error: android.support.test.espresso.AmbiguousViewMatcherException: 'assigned to class: class android.widget.AdapterView' corresponds to several views in the hierarchy
In the error log, I see NestedScrollView:
NestedScrollView{id=2131362239, res-name=fragment_evento_crear, visibility=VISIBLE, width=720, height=1118, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
And the button I want to click:
AppCompatImageButton{id=2131362214, res-name=idBEventoNuevoRegistrar, desc=eventoNuevoRegristar, visibility=VISIBLE, width=128, height=128, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=296.0, y=1313.0}
Thanks in advance.