ViewInteraction

public final class ViewInteraction
extends Object

java.lang.Object
   ↳ android.support.test.espresso.ViewInteraction


提供测试作者在视图上执行操作或声明的主要接口。

每个交互都与视图匹配器标识的视图相关联。 所有视图操作和断言均在UI线程上执行(从而确保顺序执行)。 视图检索也是一样(这是为了确保视图状态在执行每个操作之前是“新鲜的”)。

Summary

Public methods

ViewInteraction check(ViewAssertion viewAssert)

检查当前视图匹配器选择的视图上的给定 ViewAssertion

ViewInteraction inRoot(Matcher<Root> rootMatcher)

使此ViewInteraction的作用域为给定根匹配器所选的根。

ViewInteraction perform(ViewAction... viewActions)

对当前视图匹配器选择的视图执行给定的动作。

ViewInteraction withFailureHandler(FailureHandler failureHandler)

使用自定义失败处理程序替换此特定交互的默认失败处理程序(@see Espresso.setFailureHandler)。

Inherited methods

From class java.lang.Object

Public methods

check

ViewInteraction check (ViewAssertion viewAssert)

检查当前视图匹配器选择的视图上的给定 ViewAssertion

Parameters
viewAssert ViewAssertion: the assertion to check.
Returns
ViewInteraction this interaction for further perform/verification calls.

inRoot

ViewInteraction inRoot (Matcher<Root> rootMatcher)

使此ViewInteraction的作用域为给定根匹配器所选的根。

Parameters
rootMatcher Matcher
Returns
ViewInteraction

perform

ViewInteraction perform (ViewAction... viewActions)

对当前视图匹配器选择的视图执行给定的动作。 如果提供了多个动作,则按照在每个动作之前运行的预先检查提供的顺序执行动作。

Parameters
viewActions ViewAction: one or more actions to execute.
Returns
ViewInteraction this interaction for further perform/verification calls.

withFailureHandler

ViewInteraction withFailureHandler (FailureHandler failureHandler)

使用自定义失败处理程序替换此特定交互的默认失败处理程序(@see Espresso.setFailureHandler)。

Parameters
failureHandler FailureHandler: a non-null failurehandler to use to report failures.
Returns
ViewInteraction this interaction for further perform/verification calls.