I want check authauthorization screen is displayed with kaspresso
But isDisplyed() dont return boolean, and i have error.
How check element is displayed without exception
Now my solution:
fun isNeedAuth(): Boolean {
return try {
authButton.isEnabled()
true
} catch (e: NullPointerException) {
false
}
}
I'm personally using:
In tests it looks like:
Also, you can make an extension for KViews:
And use it like:
More advanced solution with waiting for desired state:
Usage example (will throw exception if condition is not met in 10 seconds):
Or without throwing exception: