1

I have a login screen in my app then after login view being dismissed a tabbar appears.

App itself works well in all devices/simulators. UI test works in all simulators except iphone 4s.

I think the reason is after login , it takes way too longer to login screen to disappear. So when I try to access tabbar, it throws an exception.

I tried

let tabBarsQuery = app.tabBars
let predicate = NSPredicate(format: "exists == true")
expectationForPredicate(predicate, evaluatedWithObject: tabBarsQuery, handler: nil)
waitForExpectationsWithTimeout(15, handler: nil) 

I get following error

failed: caught "NSUnknownKeyException", "[<XCUIElementQuery 0x7e080d40> valueForUndefinedKey:]: this class is not key value coding-compliant for the key exists."

Why expectation is not working? How can I solve this problem?

SpaceDust__
  • 4,844
  • 4
  • 43
  • 82

1 Answers1

0

So the issue with this seems to be that for whatever reason, the .exists property does not exist for a collection of XCUIElementQueries. In your example, you could not do app.tabBars.exists. However, you can change your predicate to be:

let predicate = NSPredicate(format: "count > 0")

And that should work.

Michael Curtis
  • 564
  • 3
  • 9