0
我使用espresso測試應用程序。這個應用程序有2個ListViews,特濃咖啡onData函數找到兩個ListViews,但它們有不同的ID。espresso onData是否與層次結構中的多個視圖匹配?
代碼:
onData(withId(R.id.order_jijia_listview)).perform(ViewActions.click());
結果:
ListView{id=2131493579, res-name=order_jijia_listview, visibility=VISIBLE, width=768,
height=659, 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=0.0, y=345.0, child-count=7} ****MATCHES****
ListView{id=2131493586, res-name=order_jijia_pop_listview, visibility=VISIBLE, width=0,
height=0, has-focus=false, has-focusable=false, has-window-focus=true,
is-clickable=true, is-enabled=true, is-focused=false, is-focusable=false,
is-layout-requested=true, is-selected=false, root-is-layout-requested=false,
has-input-connection=false, x=0.0, y=0.0, child-count=0}