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.
我如何写一个UITest来检查我的标签(当前是否带有文本:2)是否在我点击了我的+按钮之后将其值改为3。
1 个解决方案
#1
1
let app = XCUIApplication()
let textPredicate = NSPredicate(format: "label = %@", "3")
expectationForPredicate(textPredicate, evaluatedWithObject: app.staticTexts["numberOfItemsLabel"], handler: nil)
app.buttons["increaseNumberOfItemsButton"].tap()
#1
1
let app = XCUIApplication()
let textPredicate = NSPredicate(format: "label = %@", "3")
expectationForPredicate(textPredicate, evaluatedWithObject: app.staticTexts["numberOfItemsLabel"], handler: nil)
app.buttons["increaseNumberOfItemsButton"].tap()