3

Android アプリ用の Espresso テストを作成したいと考えています。カスタムモデルで作られた多くのグリッドアイテム(〜1000)を含むStaggeredGridViewStaggeredGridView GithubRecipe.class )があります( )

<com.etsy.android.grid.StaggeredGridView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/mainPageGridView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="main_grid"
        android:descendantFocusability="blocksDescendants"
        app:column_count="2"
        app:item_margin="8dp">

    </com.etsy.android.grid.StaggeredGridView>

グリッド項目はシンプルLinearLayoutImageTextView.

問題は、画面に表示されていない要素をクリックしたい場合、エスプレッソが動かなくなり、アクションを実行するためにスクロールしないことです。

私は次のことを試しました(位置を1に変更すると、正常に動作します):

onData(anything()).inAdapterView(withId(R.id.mainPageGridView))
            .atPosition(5)
            .perform(click());

そしてこれを試しました:

onData(anything()).inAdapterView(withId(R.id.mainPageGridView))
            .atPosition(5)
            .perform(scrollTo(), click());

それはバグですか、それともいくつかのパラメーターがありませんか?

4

1 に答える 1