OnDisplayContext
The context for onDisplay invocation.
In the lambda given to onDisplay it is important to always use ActiveDisplayScope.rootMatcher when obtaining a ViewInteraction.
The obtainSecondaryDisplayIds routine is helpful to get the list of all available secondary displays and dedicate the one ID to be provided by the displayIdProvider.
You can use createPrimaryOnDisplayContext and createSecondaryOnDisplayContext to construct OnDisplayContext instance when the R.id::ttivi_status_bar_clock
view on each display can be used to click on to move the focus to the display.
Example
class MultidisplayE2eTest : DigitalCockpitTestCase() {
private val primary = createOnDisplayContextPrimary()
private val secondary = createOnDisplayContextSecondary {
obtainSecondaryDisplayIds().last()
}
// ...
@Test
fun testSomething() {
// Launch activity on the secondary display. The display ID of the secondary display
// needs to match with the display ID returned by the lambda given to `secondary`.
// ...
onDisplay(primary) {
// Actions and assertions.
onView(withId(R.id.ttivi_some_button))
.inRoot(rootMatcher)
.check(matches(isDisplayed()))
.perform(click())
}
onDisplay(secondary) {
// Actions and assertions.
onView(withId(R.id.ttivi_some_button_on_secondary_display))
.inRoot(rootMatcher)
.check(matches(isDisplayed()))
.perform(click())
}
}
}
Constructors
Properties
Lambda to move the focus to the display. This is typically archived by clicking on the screen at a location that has no other side affects. See for instance moveFocusToPrimaryDisplayIviActivity and moveFocusToSecondaryDisplayIviActivity as possible implementations.