Skip to content

Instantly share code, notes, and snippets.

@evermeer
Created June 1, 2018 14:16
Show Gist options
  • Save evermeer/ac779703e09c2e09f50cb0c94ce5fa08 to your computer and use it in GitHub Desktop.
Save evermeer/ac779703e09c2e09f50cb0c94ce5fa08 to your computer and use it in GitHub Desktop.
Code block 4 for UITest medium blog
XCTAssert(HomeScreen.theLabel.waitUntilExists().exists, "label should exist")
HomeScreen.theLabel.waitUntilExistsAssert()
group("Testing the switch") { activity in
takeScreenshot(activity: activity, "First screenshot")
app.buttons["Second"].waitUntilExists().tap()
takeScreenshot()
app.buttons["Third"].waitUntilExists().tap()
takeScreenshot(groupName: "Screenshot group?")
HomeScreen.theButton.waitUntilExists().tap()
takeScreenshot("Last screenshot")
}
HomeScreen.theTextField.tapAndType("testing")
HomeScreen.theLabel.or(HomeScreen.theTextField).tap()
HomeScreen.theLabel.orAssert(HomeScreen.theTextField)
HomeScreen.theButton.ifExists { $0.tap() }
HomeScreen.hideButton.ifExists(2) { $0.tap() }
HomeScreen.hideButton.ifNotExist(2) {
app.buttons["Third"].waitUntilExists().tap()
}
HomeScreen.hideButton.ifNotExistwaitUntilExists(2) {
HomeScreen.showButton.waitUntilExists().tap()
}.tap()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment