【问题标题】:UITests: How to test if label contains some text after changes?UITests:如何测试标签是否在更改后包含一些文本?
【发布时间】:2015-08-28 14:12:13
【问题描述】:

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

【问题讨论】:

    标签: swift ios9 xcode-ui-testing


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

    【讨论】:

    • 请考虑在您的答案中添加一些细节。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-07
    • 2012-03-26
    • 1970-01-01
    • 2019-08-07
    • 2023-04-09
    相关资源
    最近更新 更多