Created
January 2, 2019 21:15
-
-
Save thecb4/64f2cf3abefc4f889bd717a156e728b2 to your computer and use it in GitHub Desktop.
ApplicationState protocol for XCUITest
This file contains 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
typealias ApplicationState = XCTNSPredicateExpectation | |
protocol UIElement { | |
var existance: ApplicationState { get } | |
} | |
extension XCUIElement: UIElement { | |
var existance: ApplicationState { | |
let state = NSPredicate(format: "exists == true") | |
return ApplicationState(predicate: state, object: self) | |
} | |
} | |
extension Array: UIElement where Element == UIElement { | |
var existance: ApplicationState { | |
let state = NSPredicate(format: "@count > 0") | |
return ApplicationState(predicate: state, object: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment