0

Below is my code for earlGrey test

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())

The view hierarchy does not show my navigated view.How can in achieve i using earl grey ui in swift

gran_profaci
  • 8,087
  • 15
  • 66
  • 99
anfa hamid
  • 73
  • 1
  • 9

1 Answers1

1

i had found solution myself.Need to be grey condition.Below is the code

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())
anfa hamid
  • 73
  • 1
  • 9