I am having a lot of trouble with Espresso It just will not find the descendant that has the certain string and it won't recognise any child views by id either So this is my simple test
ViewInteraction viewInteraction = onView(withRecyclerView(R.id.sail_boat_recycler_view).atPosition(2));
.
viewInteraction.check(matches(hasDescendant(withText(BOAT_NAME))));
Could it be that the item is nested too deeply? here is the xml for the card view
`<?xml version="1.0" encoding="utf-8"?>
`<android.support.v7.widget.CardView
`xmlns:android="http://ift.tt/nIICcg"
`android:layout_width="match_parent"
`android:layout_height="wrap_content"
`android:id="@+id/card_view_line">
`<TableLayout android:layout_width="wrap_content"
`android:layout_height="wrap_content">
`<TableRow>
`<LinearLayout
`android:layout_width="wrap_content"
`android:layout_height="wrap_content"
`android:orientation="horizontal"
`android:layout_weight="1"
`android:id="@+id/line_buttons_linear_layout"
`android:padding="16dp"
`android:paddingLeft="5dp">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_add_line_to_shopping_list"
android:text="@string/button_add_to_shopping_list"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_edit_line"
android:text="@string/button_edit"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_delete_line"
android:text="@string/button_delete"/>
</LinearLayout>
</TableRow>
<TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/line_picture_linear_layout"
android:padding="16dp"
android:paddingRight="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="0.25"
android:id="@+id/line_linear_layout"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_type"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_diameter"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_length"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_needs_replacing"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_function_description"
android:width="200dip"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_date_replaced"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_id"
android:layout_gravity="start"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="20"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/txt_line_colour"
android:visibility="visible"/>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.20"
android:layout_gravity="left"
android:contentDescription="@string/line_photo_text"
android:src="@drawable/can"
android:id="@+id/img_line_photo"/>
</LinearLayout>
</TableRow>
Aucun commentaire:
Enregistrer un commentaire