ActiveDisplayScope

class ActiveDisplayScope(displayId: DisplayId)

Scope which provides necessary data and useful routines for writing multi-display tests. It provides:

  • DisplayId of currently active display.

  • rootMatcher to obtain proper ViewInteraction in specific root. Root matcher shall always be used on ViewInteraction before performing view interactions or checking assertions. ActiveDisplayScope is supplied to a lambda when you introduce a scope with onDisplay routine.

Example

       private val secondary: OnDisplayContext = ...

@Test
fun testSomething() {
...
onDisplay(secondary) {
onView(withId(R.id.ttivi_some_button)).inRoot(rootMatcher)
.check(matches(isDisplayed()))
.perform(click())
}
}
}

Constructors

Link copied to clipboard
fun ActiveDisplayScope(displayId: DisplayId)

Properties

Link copied to clipboard
val rootMatcher: Matcher<Root>

Root to obtain proper ViewInteraction in specific root.

Extensions

Link copied to clipboard
fun ActiveDisplayScope.onDisplay(action: ActiveDisplayScope.() -> Unit)

Prevents contraptions like: