Created
February 26, 2020 12:01
-
-
Save tieleman/ee2f9f1c049ad651a305830c2b69c3a6 to your computer and use it in GitHub Desktop.
SimpleGreeterUITests v2
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
import XCTest | |
class SimpleGreeterUITests: XCTestCase { | |
override func setUp() { | |
continueAfterFailure = false | |
} | |
func testInitialViewState() { | |
let app = XCUIApplication() | |
app.launch() | |
let textField = app.textFields.element | |
let enterNameLabel = app.staticTexts["enterNameLabel"] | |
let greeterLabel = app.staticTexts["greetingTextLabel"] | |
XCTAssert(enterNameLabel.exists) | |
XCTAssertEqual(enterNameLabel.label, "Please enter your name below") | |
XCTAssert(greeterLabel.exists) | |
XCTAssert(greeterLabel.label.isEmpty) | |
XCTAssert(textField.exists) | |
XCTAssertEqual(textField.placeholderValue, "Your name") | |
} | |
func testGreeter() { | |
let app = XCUIApplication() | |
app.launch() | |
let textLabel = app.staticTexts["greetingTextLabel"] | |
let textField = app.textFields.element | |
textField.tap() | |
textField.typeText("J") | |
textField.typeText("o") | |
textField.typeText("n") | |
textField.typeText("y") | |
XCTAssertEqual(textLabel.label, "Nice to meet you, Jony.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment