我正在编写一个使用自动着色语法的文本编辑器。我想在UI测试中测试我的NSTextView行为,但我想知道如何检查内容是否更新得很好。
目前,我只能检查文本内容:
let app = XCUIApplication()
while app.windows.count > 0 {
app.typeKey("w", modifierFlags:.Command)
}
app.typeKey("n", modifierFlags:.Command)
let window = app.windows["Untitled"]
let textView = window.scrollViews.childrenMatchingType(.TextView)
textView.element.typeText("@Martin")
if let content = textView.element.value as? String {
XCTAssertEqual(content, "@Martin")
} else {
XCTFail()
}例如,如何检查我的"@“是否是蓝色的?
发布于 2016-08-24 10:07:27
删除最后一个断言。如果传递给typeText()的文本没有正确更新文本字段,UI测试框架将自动失败。
https://stackoverflow.com/questions/39054544
复制相似问题