-
Notifications
You must be signed in to change notification settings - Fork 12
Boolean operation result
Aleksei Tiurin edited this page Apr 1, 2021
·
3 revisions
While using the Ultron framework you always can get the result of any operation as boolean value. It's available for Espresso. EspressoWeb (WebView) and UI Automator elements.
object SomePage : Page<SomePage>{
private val espressoElement = withId(R.id.espressoId)
private val espressoWebViewElement = xpath("some_xpath")
private val uiautomatorElement = byResId(R.id.uiatomatorId)
}
All these elements have isSuccess
method that allows us to get boolean result. In case of false it could be executed to long (5 sec by default). So it reasonable to specify custom timeout for some operations.
espressoElement.isSuccess { withTimeout(2_000).isDisplayed() }
espressoWebViewElement.isSuccess { withTimeout(2_000).exists() }
uiautomatorElement.isSuccess { withTimeout(2_000).isDisplayed() }