Created
January 2, 2019 21:13
-
-
Save thecb4/dc819ea06a7bb780b99c0ab44e76a76a to your computer and use it in GitHub Desktop.
Extend XCUIApplication with Application protocol
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
extension XCUIApplication: Application { | |
static var app: Application { | |
return XCUIApplication() | |
} | |
var movieTable: UIElement { | |
return self.tables.staticTexts["New Releases"] | |
} | |
var searchBar: UIElement { | |
return self.searchFields["Such sights to show you..."] | |
} | |
func movie(titled: String) -> UIElement { | |
let predicate = NSPredicate(format: "label CONTAINS[c] %@", titled) | |
return self.tables.staticTexts.containing(predicate).firstMatch as UIElement | |
} | |
func moviePoster(titled: String) -> UIElement { | |
return self.tables.staticTexts[titled] | |
} | |
func comments(containing text: String) -> [UIElement] { | |
let predicate = NSPredicate(format: "value CONTAINS[c] %@", text) | |
let textViews = self.tables.cells.textViews | |
let elementQuery = textViews.containing(predicate) | |
print(elementQuery.allElementsBoundByIndex.count) | |
return elementQuery.allElementsBoundByIndex | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment