-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Labels
uiRelated to UI integrationRelated to UI integration
Description
Find a home for this. Ideally the same place that we share whatever idling resource cleverness that we've been hoarding.
/**
* Base class for matchers that examine the workflow [Screen] [shown][View.getScreen]
* by a [View].
*/
abstract class WorkflowScreenMatcher : TypeSafeMatcher<View>() {
final override fun matchesSafely(item: View): Boolean {
return item.getScreen()?.let { matchesScreen(it) } == true
}
protected abstract fun matchesScreen(rendering: Screen): Boolean
}/**
* Matches [View]s showing workflow [Screen]s that have [compatibility keys][Compatible.keyFor]
* that include [string].
*/
fun withScreenWithKeyContaining(string: String): Matcher<View> {
return withScreenWithKey(containsString(string))
}
/**
* Matches [View]s showing workflow [Screen]s that have [compatibility keys][Compatible.keyFor]
* that match [stringMatcher].
*/
fun withScreenWithKey(stringMatcher: Matcher<String>): Matcher<View> {
return WorkflowScreenWithKeyMatcher(stringMatcher)
}
private class WorkflowScreenWithKeyMatcher(
private val stringMatcher: Matcher<String>
) : WorkflowScreenMatcher() {
override fun describeTo(description: Description) {
description.appendText("with Screen with compatibility key: ")
stringMatcher.describeTo(description)
}
override fun matchesScreen(rendering: Screen): Boolean {
return stringMatcher.matches(Compatible.keyFor(rendering))
}
}Metadata
Metadata
Assignees
Labels
uiRelated to UI integrationRelated to UI integration