Skip to content

Instantly share code, notes, and snippets.

@milanstevanovic
Last active September 28, 2018 14:18
Show Gist options
  • Select an option

  • Save milanstevanovic/305b4251835c7eaf0dd2d75f5af646b9 to your computer and use it in GitHub Desktop.

Select an option

Save milanstevanovic/305b4251835c7eaf0dd2d75f5af646b9 to your computer and use it in GitHub Desktop.
class UIElementPage<T: UIElement>: Page {
override init(element: XCUIElement) {
super.init(element: element)
}
init(root: T) {
super.init(element: Page.app.otherElements[root])
}
func label(_ element: T) -> XCUIElement {
return self.element.staticTexts[element]
}
func textField(_ element: T) -> XCUIElement {
return self.element.textFields[element]
}
func textView(_ element: T) -> XCUIElement {
return self.element.textViews[element]
}
func staticText(_ element: T) -> XCUIElement {
return self.element.staticTexts[element]
}
func button(_ element: T) -> XCUIElement {
return self.element.buttons[element]
}
func image(_ element: T) -> XCUIElement {
return self.element.images[element]
}
func table(_ element: T) -> XCUIElement {
return self.element.tables[element]
}
func collection(_ element: T) -> XCUIElement {
return self.element.collectionViews[element]
}
func otherElement(_ element: T) -> XCUIElement {
return self.element.otherElements[element]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment