Created
September 24, 2019 06:29
-
-
Save mpahuja/aeb265d44160221893364162fd4e098f to your computer and use it in GitHub Desktop.
Pages - TableView.swift
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
import XCTest | |
public final class TableViewPage: BasePage { | |
// Mark: - Page UI elements | |
private var entireTable: XCUIElement { | |
return app.tables.allElementsBoundByAccessibilityElement[0] | |
} | |
private var countTableRow: XCUIElementQuery { | |
return app.tables.cells | |
} | |
// Mark: Page UI element interation | |
public func isRandomTableDisplayed() -> Bool { | |
return self.entireTable.waitForExistence(timeout: 10.0) | |
} | |
public func countTableRows() -> Int { | |
return self.countTableRow.count | |
} | |
public func tapDesiredRow(desiredIndex: Int) { | |
return self.countTableRow.allElementsBoundByIndex[desiredIndex].tap() | |
} | |
public func getValueAtDesiredRow(desiredIndex: Int) -> String { | |
let currentValueAtIndex = self.countTableRow.allElementsBoundByIndex[desiredIndex].title | |
return currentValueAtIndex | |
} | |
public func isCorrectAlertDisplayed(rowTitle: String) -> Bool { | |
return app.alerts[rowTitle].isEnabled | |
} | |
public func tapOkOnAlert() -> Bool { | |
if app.alerts.buttons["OK"].exists { | |
app.alerts.buttons["OK"].tap() | |
} | |
return true | |
} | |
} | |
extension BaseTest { | |
public var tableViewPage: TableViewPage { | |
return getPage() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment