Настройка - ViewPager с EditText в каждом фрагменте. Я хочу, чтобы Espresso вводил текст в EditText в первом фрагменте, проведите ко второму фрагменту и делайте то же самое с EditText в этом фрагменте (3 раза):
Код: Выделить всё
@MediumTest
public void testSwipe() throws InterruptedException {
onView(withIdInActiveFragment(EXTERN_HOURS_INPUT))
.perform(typeText("8.0"));
onView(withIdInActiveFragment(DAY_PAGER))
.perform(swipeLeft());
//Thread.sleep(2000); //
Но я получаю эту ошибку при выполнении первого удара: < /p>
android.support.test.espresso.AmbiguousViewMatcherException: '(has parent matching: is displayed on the screen to the user and with id: de.cp.cp_app_android:id/extern_hours_input)' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.
View Hierarchy:
...
+-------->AppCompatEditText{id=2131558508, res-name=extern_hours_input, visibility=VISIBLE, width=110, height=91, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=true, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=true, editor-info=[inputType=0x2002 imeOptions=0x6 privateImeOptions=null actionLabel=null actionId=0 initialSelStart=3 initialSelEnd=3 initialCapsMode=0x0 hintText=null label=null packageName=null fieldId=0 fieldName=null extras=null ], x=165.0, y=172.0, text=8.0, input-type=8194, ime-target=true, has-links=false} ****MATCHES****
...
+-------->AppCompatEditText{id=2131558508, res-name=extern_hours_input, visibility=VISIBLE, width=110, height=91, 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=true, editor-info=[inputType=0x2002 imeOptions=0x6 privateImeOptions=null actionLabel=null actionId=0 initialSelStart=0 initialSelEnd=0 initialCapsMode=0x2000 hintText=null label=null packageName=null fieldId=0 fieldName=null extras=null ], x=165.0, y=172.0, text=, input-type=8194, ime-target=false, has-links=false} ****MATCHES****
Если я вручную принуждающуюся все, добавляя все, что снов (2000); хорошо. Или кто -нибудь, по крайней мере, знает, почему это происходит? Поскольку ui-thread не может быть холостом, когда выполняется действие смахивания, не так ли?
Код: Выделить всё
< /code>
и Activity_swipe_day.xml < /code>: < /p>
Подробнее здесь: https://stackoverflow.com/questions/372 ... e-finished