Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61774

UITests: How to test if label contains some text after changes?

enter image description here

How do I write a UITest to check whether my label (currently with the text: 2) has changed its value to 3 or not after I tap my plus button.

Upvotes: 2

Views: 1877

Answers (1)

Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61774

let app = XCUIApplication()    
let textPredicate = NSPredicate(format: "label = %@", "3")
expectationForPredicate(textPredicate, evaluatedWithObject: app.staticTexts["numberOfItemsLabel"], handler: nil)
app.buttons["increaseNumberOfItemsButton"].tap()

Upvotes: 2

Related Questions