Skip to content

Commit

Permalink
Improve test failure message
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Aug 12, 2024
1 parent a129b2a commit e20add7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ fun viewWithText(@StringRes text: Int, index: Int = 0): TestView {
}

fun view(selector: BySelector, index: Int = 0): TestView {
return TestView(requireNotNull(device.findObjects(selector).getOrNull(index)))
val obj = device.findObjects(selector).getOrNull(index)
?: throw AssertionError("View not found: $selector, index: $index")
return TestView(obj)
}

fun TestView.childWithIndex(index: Int = 0): TestView {
Expand Down

0 comments on commit e20add7

Please sign in to comment.