UITests:如何测试标签在修改后是否包含一些文本?

时间:2022-04-11 05:56:17

UITests:如何测试标签在修改后是否包含一些文本?

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()