Created
September 21, 2015 10:16
-
-
Save concertman/0d972d038d6fe3cd680a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func AssertPredicateWithWait(element: XCUIElement, predicate: String, file: String = __FILE__, line: UInt = __LINE__) { | |
let existsPredicate = NSPredicate(format: "\(predicate) == true", argumentArray: nil) | |
expectationForPredicate(existsPredicate, evaluatedWithObject: element, handler: nil) | |
waitForExpectationsWithTimeout(5.0) { (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