ios - EarlgreyUI iOS 测试中的导航问题

标签 ios earlgrey

下面是我的 earlGrey 测试代码

EarlGrey.select(elementWithMatcher: grey_accessibilityID("userNameTextField"))
.atIndex(0).perform(grey_typeText("freshaccount@dayrep.com"))
EarlGrey.select(elementWithMatcher: grey_accessibilityID("passwordTextField"))
    .atIndex(1).perform(grey_typeText("Flower@123"))
EarlGrey.select(elementWithMatcher: grey_accessibilityID("signIn")).atIndex(2)
    .perform(grey_tap())

/////////////////This button on the other view controller i redirect after login////////////////////////////////       
EarlGrey.select(elementWithMatcher: grey_accessibilityID("menuButton"))
.perform(grey_tap())

View 层次结构不显示我的导航 View 。如何在 swift 中使用 Earl Gray ui 来实现

最佳答案

我自己找到了解决办法,需要是灰色状态,下面是代码

GREYCondition(name: "Wait for menu button to appear", block: { _ in
            let errorOrNil = UnsafeMutablePointer<NSError?>.allocate(capacity: 1)
            errorOrNil.initialize(to: nil)

            EarlGrey.select(elementWithMatcher: grey_accessibilityValue("menuButton")).assert(grey_notNil(), error: errorOrNil)

            let success = errorOrNil.pointee == nil
            errorOrNil.deinitialize()
            errorOrNil.deallocate(capacity: 1)

            return success
        }).wait(withTimeout: 10.0)
      EarlGrey.select(elementWithMatcher: grey_accessibilityValue("menuButton")).perform(grey_tap())

关于ios - EarlgreyUI iOS 测试中的导航问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45854735/

相关文章:

ios - 当模式对话框显示时,GREYAction 不起作用

ios - 从过滤关系为空的核心数据中获取对象

ios - 在 UICollectionViewCell 中引用 UITableView

ios - EarlGrey 尝试等待 5.0 秒让应用程序达到空闲状态

ios - 我真的可以在 EarlGrey Action 上设置断点吗?

ios - 在 UIWebView 中查找元素

iphone - 添加 Core Data 对象后 tableView 未更新

ios - 删除分组 UITableView 中各部分之间的垂直空间

ios - 使用 UISearchDisplayController 时 UITableViewCell 的 contentView 的内容不可见

xctest - grey_accessibilityLabel ("Login") 与 UI 层次结构中存在的具有相同辅助功能标签的元素不匹配