I want to have a test pause and wait for an element to appear on screen before proceeding.
I don\'t see a good way to create an expectation for this and wait using
You can use this, in Swift 3
func wait(element: XCUIElement, duration: TimeInterval) {
let predicate = NSPredicate(format: "exists == true")
let _ = expectation(for: predicate, evaluatedWith: element, handler: nil)
// We use a buffer here to avoid flakiness with Timer on CI
waitForExpectations(timeout: duration + 0.5)
}
In Xcode 9, iOS 11, you can use the new API waitForExistence