google/EarlGrey

Cannot find in scope error

ken4ward opened this issue · 1 comments

I followed the tutorial to setup Earlgrey in Xcode, things seems to be fine until I pasted the Earlgrey.swift and tried to run the sample code, Xcode threw the error of Cannot find in scope error for all the lines of code in the Earlgrey.swift ascwell for the sample code I tried running.

Please, what's the way forward. Thanks.

Swift Compiler Error Group
Cannot find 'grey_keyWindow' in scope
Cannot find 'grey_tap' in scope
Cannot find 'grey_sufficientlyVisible' in scope

The simple test code

func testExample() throws {
        // UI tests must launch the application that they test.
        let app = XCUIApplication()
        app.launch()
        EarlGrey.selectElement(with: grey_keyWindow()).perform(grey_tap())
            .assert(grey_sufficientlyVisible())

        // Use recording to get started writing UI tests.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }

Screen Shot 2021-05-20 at 11 52 14 AM

I am facing the same issue, I am on Xcode 12.4/macOS Catalina. Can someone please advise on how to proceed?

  • I followed the Cocopods setup,
  • Added the EarlGreySwiftBridgingHeader.h and Earlgrey.swift wrapper
  • Also added the User Header Search Paths: ${PODS_ROOT}/EarlGreyTest & ${PODS_ROOT}/eDistantObject as recursive

The app target builds successfully but I still see those errors in the EarlGrey.swift (and anywhere where I tried to use the EarlGrey API):

Screen Shot 2021-06-11 at 4 02 05 PM