Branch function (ifCanDetect, ifCanDetectNot) (Vision)
You can use special branch functions for element.
functions
function | description |
---|---|
ifCanDetect | The code block is executed when specified text is on the screen |
ifCanDetectNot | The code block is executed when specified text is not on the screen |
Sample code
IfCanSelect1.kt
(src/test/kotlin/tutorial/basic/IfCanDetect1.kt
)
@Test
@Order(10)
fun ifCanSelectTest() {
scenario {
case(1) {
condition {
it.macro("[Android Settings Top Screen]")
}.expectation {
ifCanDetect("Network & internet") {
OK("ifCanSelect called")
}.ifElse {
NG()
}
ifCanDetectNot("System") {
OK("ifCanSelectNot called")
}.ifElse {
NG()
}
}
}
case(2) {
action {
it.scrollToBottom()
}.expectation {
ifCanDetect("Network & internet") {
NG()
}.ifElse {
OK("ifElse called")
}
ifCanDetectNot("System") {
NG()
}.ifElse {
OK("ifElse called")
}
}
}
}
}