Ich habe password.setError(getResources().getString(R.string.incorrect_data));
Wenn ich ungültiges Passwort gesetzt Show Textview mit Text, ich es von Espresso testen müssen, schreibe ich:Wie kann man mit Espresso testen android.widget.TextView setError? „! Ungültige Daten“ -
onView(withText(R.string.incorrect_data)).check(matches(isDisplayed()));
Aber es ist falsch, ich habe:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with string from resource id: <2131493034>[incorrect_data] value: Invalid data!
If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:android.widget.ListView{307b4f3a IFED.VC. ......ID -480,0-0,1022 #7f0a004c app:id/left_drawer}
Und wenn ich schreibe: onView(withText("Invalid data!")).check(matches(isDisplayed()));
ich habe:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with text: is "Invalid data!"
If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:android.widget.ListView{307b4f3a IFED.VC. ......ID -480,0-0,1022 #7f0a004c app:id/left_drawer}
Ich benutze Espresso 2:
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static android.support.test.espresso.Espresso.onView;
Helfen Sie mir, bitte.