swift - UI测试: How to test if label contains some text after changes?

标签 swift ios9 xcode-ui-testing

enter image description here

如何编写 UITest 来检查我的标签(当前带有文本:2)是否已将其值更改为 3 或不是在我点击加号按钮之后。

最佳答案

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

关于swift - UI测试: How to test if label contains some text after changes?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32273107/

相关文章:

ios - 使用 segues 将 Parse 数组中的图像快速链接到 secondViewController

ios - 这可以从我的 WebView 中删除广告吗?

ios - 在 WKWebView 和 HTTPCookieStorage 之间复制 cookie - 找不到 302 cookie

ios - 代码 8 : UI tests can't find library being tested

ios - 在 Xcode UI 测试中等待 30 秒

ios - Xcode UI 测试 - 找不到刚刚记录的元素

ios - 如何在 WebView 中添加 Pull to Refresh?

objective-c - 在 Apple 的 NSObject 文档中, "receiver"的含义是什么?

ios - 刚好输入一个数字后移至下一个 UITextField

iOS 9 didRangeBeacons 调用了更多次。 iOS-8 每秒一次