Skip to content

Instantly share code, notes, and snippets.

@mbcharbonneau
Created February 3, 2016 22:35
Show Gist options
  • Save mbcharbonneau/14fd75c3a14d7930eabd to your computer and use it in GitHub Desktop.
Save mbcharbonneau/14fd75c3a14d7930eabd to your computer and use it in GitHub Desktop.
Xcode UI Testing
func waitUntilVisible(element: XCUIElement, file: String = __FILE__, line: UInt = __LINE__) {
expectationForPredicate(NSPredicate(format: "exists == 1"), evaluatedWithObject: element, handler: nil)
waitForExpectationsWithTimeout(30) { (error) in
guard error != nil else { return }
let message = "Failed to find \(element) after 30 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