Skip to content

Instantly share code, notes, and snippets.

@HelloCore
Created February 7, 2017 15:14
Show Gist options
  • Save HelloCore/1b4d7d26fd709d9099672a7a232730dc to your computer and use it in GitHub Desktop.
Save HelloCore/1b4d7d26fd709d9099672a7a232730dc to your computer and use it in GitHub Desktop.
func testTabButtonNumberButtonIncreased() {
let app = XCUIApplication()
let numberBtn = app.buttons["numberBtn"]
numberBtn.tap()
XCTAssertEqual(numberBtn.label, "1", "Score on button should increase")
}
func testPlayToGameOverFirstTime() {
let app = XCUIApplication()
let numberBtn = app.buttons["numberBtn"]
let fizzBtn = app.buttons["fizzBtn"]
let scoreLabel = app.staticTexts["scoreLabel"]
numberBtn.tap()
numberBtn.tap()
fizzBtn.tap()
fizzBtn.tap()
let isLabelExists = app.alerts["Game Over"].staticTexts["Your score is 3 and high score is 0"].exists
XCTAssertEqual(isLabelExists, true, "Label on alert shoule be updated")
app.alerts["Game Over"].buttons["Play Again"].tap()
XCTAssertEqual(scoreLabel.label, "Score: 0 | High Score: 3", "High score should be recorded")
XCTAssertEqual(numberBtn.label, "0", "Score on button should be reset after game over")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment