Created
January 8, 2019 05:28
-
-
Save SunXiaoShan/e5dc5ede2c82d1dab08402c10ab04524 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
class LibraryPage: Page { | |
lazy var libraryTab = app.tabBars.buttons["Library"] | |
var selectIndex: Int = 0 | |
func switchToLibrary() -> Self { | |
libraryTab.tap() | |
snapshot("switch to library page") | |
return self | |
} | |
func getTableViewCell(_ index: Int) -> XCUIElement { | |
let table = app.tables.element(boundBy: 0) | |
let cell = table.cells.element(boundBy: index) | |
guard waitForElementToAppear(cell) else { | |
XCTFail() | |
return cell | |
} | |
return cell | |
} | |
func tapTableViewCell(_ index: Int) -> Self { | |
getTableViewCell(index).tap() | |
snapshot("tab cell:\(index)") | |
return self | |
} | |
@discardableResult func actionPlayButton(_ index: Int) -> Self { | |
let element = getTableViewCell(index).buttons["Button"] | |
guard waitForElementToAppear(element) else { | |
XCTFail() | |
return self | |
} | |
element.tap() | |
snapshot("switch to play video index:\(index)") | |
return self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment