automated tests - Espresso in Android - how to insert the text into more text inputs? -


i'm trying set text text inputs on same activity (one one).

problem on first input text filled correctly on second input exception message.

android.support.test.espresso.performexception:  error performing 'single click' on view 'with id: com.example.xxx.test:id/txtfield2'. 

here test method:

  @test     public void buttonshouldupdatetext(){         this.clickonactionbarmenuicon();         this.clickonactionbarmenuitem(10);         this.clickonbutton();         this.checktextonactivity("hello world!");         this.inserttextintoinput(r.id.txtfieldone, "hello world!"); // works fine          this.inserttextintoinput(r.id.txtfieldtwo, "hello world2"); // throws exception     } 

and method following:

public void inserttextintoinput(integer inputid, string text) {     onview(withid(inputid)).perform(typetext(text)); } 

layout following:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     android:paddingbottom="@dimen/activity_vertical_margin"     tools:context="activities.secondactivity">      <textview android:text="@string/hello_world"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/text1secondview" />      <edittext         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/txtfieldone"         android:layout_below="@+id/text1secondview"         android:layout_alignparentstart="true"         android:layout_margintop="103dp"         android:layout_alignparentend="true" />      <edittext         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/txtfieldtwo"         android:layout_margintop="51dp"         android:layout_below="@+id/txtfieldone"         android:layout_alignparentstart="true"         android:layout_alignparentend="true" />  </relativelayout> 

how can solve , doing wrong please?

most have keyboard covering edit text. try closing with

closesoftkeyboard() viewaction when enter text in first input field.

keep in mind closesoftkeyboard() not wait keyboard animation stop: https://code.google.com/p/android-test-kit/issues/detail?id=79


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -