Xcode 7 introduces new UI Testing tools. I want to filter an element that matching more than one query.
For instance. A table with cells that each cell has 4 labels inside them. I want to find element that contain.
label 1 text = "A"
label 1 text = "B"
label 1 text = "C"
label 1 text = "D"
Framework has api to give it one predicate. For example.
app.cells.containingPredicate
Anything available to filter using more than one predicate. Or any alternative to achieve my requirement?
You can chain containingPredicate filters like below.
app.cells.containingPredicate(NSPredicate(format: "label BEGINSWITH 'A'")).containingPredicate(NSPredicate(format: "label BEGINSWITH 'B'")).containingPredicate(NSPredicate(format: "label BEGINSWITH 'C'")).containingPredicate(NSPredicate(format: "label BEGINSWITH 'D'"))
This will keep filtering out your cells until a cell with all for labels match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With