Created
July 8, 2016 16:44
-
-
Save Morbix/70f1987c0f671a2d533e311b8e380967 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
import XCTest | |
extension XCTestCase { | |
func waitForKeyboard() { | |
expectationForPredicate(Predicate.countEqual1, evaluatedWithObject: XCUIApplication().keyboards, handler: nil) | |
waitForExpectationsWithTimeout(10, handler: nil) | |
} | |
func waitForElementExist(element: XCUIElement, timeout: NSTimeInterval = 10) { | |
expectationForPredicate(Predicate.exists, evaluatedWithObject: element, handler: nil) | |
waitForExpectationsWithTimeout(timeout, handler: nil) | |
} | |
func waitForElementNotExist(element: XCUIElement, timeout: NSTimeInterval = 10) { | |
expectationForPredicate(Predicate.notExists, evaluatedWithObject: element, handler: nil) | |
waitForExpectationsWithTimeout(timeout, handler: nil) | |
} | |
} | |
struct Predicate { | |
static let countEqual1 = NSPredicate(format: "count == 1") | |
static let exists = NSPredicate(format: "exists == 1") | |
static let notExists = NSPredicate(format: "exists == 0") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment