【发布时间】:2016-10-30 18:32:59
【问题描述】:
我正在尝试在我的 iOS 应用程序中进行简单的 UI 测试。我想用一些文字填写textfield,但总是出现错误。
第一次尝试:
let searchField = app.textFields.elementBoundByIndex(0);
searchField.tap()
searchField.typeText("Holy Grail")
该字段被突出显示,键盘出现,几秒钟后,随机出现以下之一:
- Timed out waiting for IDE barrier message to complete
- failed to get attributes within 15.0s ui test
- failed to get snaphots within 15.0s ui test
第二次尝试:
func setText(text: String, application: XCUIApplication) {
//Instead of typing the text, it pastes the given text.
UIPasteboard.generalPasteboard().string = text
doubleTap()
application.menuItems["Paste"].tap()
}
...
let searchField = app.textFields.elementBoundByIndex(0);
searchField.tap()
searchField.setText("Holy Grail")
同样的结果。
尝试打开和关闭Connect Hardware Keyboard。
尝试使用 iPhone 6s 模拟器、iPad Retina 模拟器、iPad 2 模拟器。
仅使用 Xcode 7 尝试过(8 会破坏项目)
想法?提前致谢!
【问题讨论】:
标签: ios xcode xcode7 xcode-ui-testing