Component - UI testing with XCUITest
This UI test uses XCUITest to check if a button tap changes a label's text on the screen. It simulates a user tapping the button and verifies the app updates the label correctly.
This UI test uses XCUITest to check if a button tap changes a label's text on the screen. It simulates a user tapping the button and verifies the app updates the label correctly.
App > Window > ViewControllerView > [Label, Button]
let app = XCUIApplication()
app.launch()
let button = app.buttons["submitButton"]
if button.exists {
button.tap()
print("Tapped")
} else {
print("Button not found")
}let app = XCUIApplication()
app.launch()
let textField = app.textFields["username"]
textField.typeText("user123")
app.buttons["login"].tap()let app = XCUIApplication() app.launch() let button = app.buttons["updateButton"] let label = app.staticTexts["statusLabel"] button.tap() // What code waits for label text to change to "Done"?
Pass the test and this pattern moves unknown