You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an XML file with TextInputEditText and add tags for TextInputEditText ( tagTextInputEditText) and for EditText inside the TextInputEditText (tagEditText). add to Hint any text (e.x. "hint")
create a UI test running the activity with this XML.
add this code KTextInputLayout { withTag(tagEditText) }.hasHint("any text _"+ UUID.randomUUID())
Observed Results:
The Test will pass
Expected Result
The Test should fail!
Expected an AssertionError that EditText is not TextInputLayout
Relevant Code:
The problem is that methods check instances and do not throw an exception if it is different than expected
fun hasHint(hint: String) {
view.check(ViewAssertion { view, notFoundException ->
if (view is TextInputLayout) {
if (hint != view.hint.toString()) {
throw AssertionError(
"Expected hint is $hint," +
" but actual is ${view.hint}"
)
}
} else {
notFoundException?.let { throw AssertionError(it) } // here code should throw AssertionError("expected TextInputLayout, but got $view") if notFoundException is null
}
})
// code here
The text was updated successfully, but these errors were encountered:
Steps to reproduce:
tagTextInputEditText
) and for EditText inside the TextInputEditText (tagEditText
). add to Hint any text (e.x. "hint")KTextInputLayout { withTag(tagEditText) }.hasHint("any text _"+ UUID.randomUUID())
Observed Results:
The Test will pass
Expected Result
The Test should fail!
Expected an
AssertionError
that EditText is not TextInputLayoutRelevant Code:
The problem is that methods check instances and do not throw an exception if it is different than expected
The text was updated successfully, but these errors were encountered: