VIEWINTERACTION
interface ViewInteraction {
fun check(viewAssertion: ViewAssertion): ViewInteraction
fun perform(vararg viewActions: ViewAction): ViewInteraction
fun inRoot(rootMatcher: Matcher): ViewInteraction
fun noActivity(): ViewInteraction
fun withFailureHandler(failureHandler: FailureHandler): ViewInteraction
}
Slide 5
Slide 5 text
VIEWINTERACTION
interface ViewInteraction {
fun check(viewAssertion: ViewAssertion): ViewInteraction
fun perform(vararg viewActions: ViewAction): ViewInteraction
fun inRoot(rootMatcher: Matcher): ViewInteraction
fun noActivity(): ViewInteraction
fun withFailureHandler(failureHandler: FailureHandler): ViewInteraction
}
Slide 6
Slide 6 text
VIEWINTERACTION
interface ViewInteraction {
fun check(viewAssertion: ViewAssertion): ViewInteraction
fun perform(vararg viewActions: ViewAction): ViewInteraction
fun inRoot(rootMatcher: Matcher): ViewInteraction
fun noActivity(): ViewInteraction
fun withFailureHandler(failureHandler: FailureHandler): ViewInteraction
}
Slide 7
Slide 7 text
VIEWINTERACTION
@Test
fun myTest() {
val interaction: ViewInteraction = Espresso.onView(myView)
}
Slide 8
Slide 8 text
VIEWINTERACTION
@Test
fun myTest() {
val interaction: ViewInteraction = Espresso.onView(myView)
.check(…)
}
Slide 9
Slide 9 text
VIEWINTERACTION
@Test
fun myTest() {
val interaction: ViewInteraction = Espresso.onView(myView)
.check(…)
.perform(…)
.check(…)
}
Slide 10
Slide 10 text
TWO MOVES OF ESPRESSO
▸ ViewActions
▸ perform(), type(), click()
Slide 11
Slide 11 text
TWO MOVES OF ESPRESSO
▸ ViewActions
▸ perform(), type(), click()
▸ ViewAssertions
▸ isDisplayed(), isSelected(), isEnabled()
Slide 12
Slide 12 text
TWO MOVES OF ESPRESSO
@Test
fun emailField_displaysWhatIsTyped() {
Espresso.onView(withId(R.id.email))
.check(isDisplayed())
.perform(typeText(“[email protected]"))
.check(matches(withText("[email protected]")))
}