Last active
January 4, 2024 08:56
-
-
Save ngallazzi/876cd27fb190db3ea39461ad34068ac7 to your computer and use it in GitHub Desktop.
Espresso view matching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<EditText android:id="@+id/name_field" | |
android:layout_width="wrap_content" | |
android:hint="Please enter your name" android:layout_height="wrap_content" /> | |
<Button android:id="@+id/greet_button" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" android:text="Click me to greet!" /> | |
<Text android:id="@+id/greet_field" android:layout_width="wrap_content" | |
android:visibility="gone" | |
android:layout_height="wrap_content" /> | |
@Test | |
fun greeterSaysHello() { | |
onView(withId(R.id.name_field)).perform(typeText("Steve")) | |
onView(withId(R.id.greet_button)).perform(click()) | |
onView(withText("Hello, I am a Steve")).check(matches(isDisplayed())) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment