in azure-communication-ui/demo-app/src/calling-test/java/com/azure/android/communication/ui/callingcompositedemoapp/util/UiTestUtils.kt [68:142]
fun checkViewIdWithContentDescriptionIsDisplayed(
@IdRes viewId: Int,
contentDescription: String,
): ViewInteraction =
onView(
allOf(
withId(viewId),
withContentDescription(contentDescription)
)
).check(ViewAssertions.matches(isDisplayed()))
@Throws(NoMatchingViewException::class)
fun checkViewIdAndTextIsDisplayed(@IdRes viewId: Int, text: String): ViewInteraction =
onView(
allOf(
withId(viewId),
withText(text)
)
).check(ViewAssertions.matches(isDisplayed()))
@Throws(NoMatchingViewException::class)
fun checkViewIdAndTextIsDisplayed(
@IdRes viewId: Int,
@StringRes stringId: Int,
): ViewInteraction =
onView(
allOf(
withId(viewId),
withText(stringId)
)
).check(ViewAssertions.matches(isDisplayed()))
@Throws(NoMatchingViewException::class)
fun clickViewWithId(@IdRes viewId: Int): ViewInteraction =
onView(allOf(withId(viewId), isDisplayed())).perform(click())
@Throws(NoMatchingViewException::class)
fun clickViewWithIdAndText(@IdRes viewId: Int, @StringRes text: Int): ViewInteraction =
onView(
allOf(withId(viewId), withText(text), isDisplayed())
).perform(click())
@Throws(NoMatchingViewException::class)
fun clickViewWithIdAndText(@IdRes viewId: Int, text: String): ViewInteraction =
onView(
allOf(withId(viewId), withText(text), isDisplayed())
).perform(click())
@Throws(NoMatchingViewException::class)
fun clickViewWithIdAndContentDescription(@IdRes viewId: Int, text: String): ViewInteraction =
onView(
allOf(withId(viewId), withContentDescription(text), isDisplayed())
).perform(click())
private fun withRecyclerView(@IdRes recyclerViewId: Int): RecyclerViewMatcher =
RecyclerViewMatcher(recyclerViewId)
@Throws(NoMatchingViewException::class)
fun check3IemRecyclerViewHolderAtPosition(
@IdRes recyclerViewId: Int,
position: Int,
recyclerViewHolderViewIds: Triple<Int, Int, Int>,
) {
onView(withRecyclerView(recyclerViewId).atPosition(position))
.check(
matches(
allOf(
hasDescendant(withId(recyclerViewHolderViewIds.first)),
hasDescendant(withId(recyclerViewHolderViewIds.second)),
hasDescendant(withId(recyclerViewHolderViewIds.third)),
isDisplayed()
)
)
)
}