Ema*_*lho 1 testing xcode ios swift xcode-ui-testing
我想检查tableViewCell.detailTextLabel我的UITest中是否有一个给定的字符串.问题是,当我搜索app.tables.cells.children(matching: .staticText)它时,它只会查找标签tableViewCell.textLabel.关于如何查询的任何想法detailTextLabel?
您可以尝试更通用的查询来确定文本是否存在.例如,如果您尝试断言单元格包含"123 Main St.",则可以使用以下内容:
let app = XCUIApplication()
XCTAssert(app.staticTexts["123 Main St."]).exists)
Run Code Online (Sandbox Code Playgroud)
当然,如果该文本出现在textLabel测试中仍然会通过.
| 归档时间: |
|
| 查看次数: |
1573 次 |
| 最近记录: |