Espresso wartet nicht, bis eine Swipe -Action auf einem ViewPager fertiggestellt wirdAndroid

Forum für diejenigen, die für Android programmieren
Anonymous
 Espresso wartet nicht, bis eine Swipe -Action auf einem ViewPager fertiggestellt wird

Post by Anonymous »

Espresso wird mit der Funktion beworben, dass es immer darauf wartet, dass das Ui-Thread von Android im Leerlauf ist, damit Sie sich nicht um Zeitprobleme kümmern müssen. Aber ich scheine eine Ausnahme gefunden zu haben. Ich möchte, dass Espresso im ersten Fragment Text in den EditText eingibt, zum zweiten Fragment wischen und mit dem EditText in diesem Fragment (dreimal):
unternehmen:

Code: Select all

@MediumTest
public void testSwipe() throws InterruptedException {
onView(withIdInActiveFragment(EXTERN_HOURS_INPUT))
.perform(typeText("8.0"));
onView(withIdInActiveFragment(DAY_PAGER))
.perform(swipeLeft());
//Thread.sleep(2000); // 
, aber ich erhalte diesen Fehler, während ich den ersten Swipe ausführe: < /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****
Espresso möchte in einen EditText mit der ID extern_hours_input schreiben, die sichtbar ist. Da die Swipe -Aktion noch nicht abgeschlossen ist, sind sowohl die EditTexts im ersten als auch das zweite Fragment sichtbar, weshalb die passende Einstellung (withIdinactiveFagment (extern_hours_input) mit 2 Übereinstimmungen fehlschlägt. fein. Oder weiß zumindest jemand, warum das passiert? Weil das Ui-Thread nicht im Leerlauf sein kann, wenn eine Swipe-Aktion durchgeführt wird, oder?

Code: Select all






















< /code>

und die Aktivität_Swipe_day.xml < /code>: < /p>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post