ios - 如何在 XCode 7 中的 UITests 持续时间后执行 .tap()?

标签 ios swift xcode7 xcode-ui-testing

是否可以在一段时间后点击按钮

简单地说,我想在 2 秒后对 EXISTS 的按钮执行 logoutButton.tap()

最佳答案

很简单。只需使用 waitForExpectationsWithTimeout

let exists = NSPredicate(format: "exists == true")

expectationForPredicate(exists, evaluatedWithObject: view, handler: nil)
waitForExpectationsWithTimeout(5, handler: nil)

关于ios - 如何在 XCode 7 中的 UITests 持续时间后执行 .tap()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33362636/

相关文章:

ios - iOS 的 WebView 禁止类名?

ios - 如何获取函数抛出的错误列表?

arrays - 如何通过将数据保存为 NsUserDefaults 中的数组来记住游戏状态

ios - 实例化模态视图 Controller 会卡住应用程序 - Xcode 7 可能存在问题

swift - 保存当前 Storyboard watchKit

objective-c - 使用 OCUnit 的单元测试示例

ios - 我可以在 iOS 中绘制和动画矢量而不求助于位图图像吗?

swift - 如何修复自定义 UITableViewCell 动态高度?

ios - 使用 FSCalendar 的事件表

更新启用位码的框架后,IOS 应用程序大小翻了一番