Skip to content

Instantly share code, notes, and snippets.

@macbaszii
Created October 13, 2015 14:58
Show Gist options
  • Select an option

  • Save macbaszii/9a0b46a67af9cd073b09 to your computer and use it in GitHub Desktop.

Select an option

Save macbaszii/9a0b46a67af9cd073b09 to your computer and use it in GitHub Desktop.
private func waitForElementToAppear(element: XCUIElement,
file: String = __FILE__, line: UInt = __LINE__) {
let existsPredicate = NSPredicate(format: "exists == true")
expectationForPredicate(existsPredicate,
evaluatedWithObject: element, handler: nil)
waitForExpectationsWithTimeout(5) { (error) -> Void in
if (error != nil) {
let message = "Failed to find \(element) after 5 seconds."
self.recordFailureWithDescription(message,
inFile: file, atLine: line, expected: true)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment