0

I added EarlGrey to my iOS project via CocoaPods. I created new target, as explained here: https://github.com/google/EarlGrey/blob/master/docs/install-and-run.md.

My problem is, that following this instruction, simple EarlGrey swift test is miss-interpreted and it results in a build errorBuild error in PoC.swift

Has anyone encountered such issue? Is there anything I can do to fix it?

As I'm new to iOS/EarlGrey - feel free to suggest me on anything I could add to this question to make it more specific.

Edit after comments

After doing gem install earlgrey the pod install command results in following error:

RuntimeError - Test target group not found!
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/configure_earlgrey.rb:371:in `copy_swift_files'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:25:in `block (2 levels) in analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:24:in `each'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:24:in `block in analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:23:in `each'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:23:in `analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:236:in `analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:150:in `block in resolve_dependencies'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:149:in `resolve_dependencies'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:110:in `install!'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/command/install.rb:41:in `run'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:52:in `run'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
/Users/karolgil/.rvm/gems/ruby-2.1.10/bin/pod:23:in `load'
/Users/karolgil/.rvm/gems/ruby-2.1.10/bin/pod:23:in `<main>'
Karol Gil
  • 95
  • 3
  • 8
  • Are you importing EarlGrey.swift? – gran_profaci Jun 01 '17 at 16:00
  • How can I check that? I import that as in the screenshot, with `import EarlGrey` and Im not aware of any other option. – Karol Gil Jun 01 '17 at 16:18
  • Your syntax here is correct. The select(elementWithMatcher:) code comes from EarlGrey.swift which is a Swift wrapper added on top of EarlGrey for better API compatibility. Can you check in your sources that EarlGrey.swift is part of it? – gran_profaci Jun 01 '17 at 18:32
  • How are you integrating with EarlGrey? – gran_profaci Jun 01 '17 at 19:23
  • Are you using the pod flow? if so, can you please let us know your cocoapod version, the earlgrey pod version, and the earlgrey gem version as well as xcode version? – khandpur Jun 01 '17 at 21:05
  • 1
    @gran_profaci I found out that EarlGrey.swift is actually missing in my workspace. I am using CocoaPods (v 1.2.1) and EarlGrey (v 1.9.3) with XCode (v 8.3.2). Then after @khandpur comment I noticed that I didn't do `gem install earlgrey`, so I did that. Now `pod install` results in a RuntimeError - please see updates on question for stack trace. – Karol Gil Jun 02 '17 at 06:57
  • I just encoutered the same troubles as the one listed in your edit, did you manage to resolve you pod install error ? I tried to update pods to latests version, was in 1.2.0 and got it in 1.3.1, but the problem is still there, even after a lot of install/uninstall of earlgrey gem. – bbusseuil Oct 02 '17 at 15:46

1 Answers1

2

Looks like you haven't added EarlGrey.swift, it should be added to your test target automatically if you have earlgrey.gem installed and use Pod to manage your project. Also make sure you have latest earlgrey gem installed.

or Carthage.

or manually download this file.

Hao
  • 161
  • 2
  • 5
  • Im accepting this answer, as the problem was actually missing EarlGrey.swift file. After rerunning `gem install earlgrey` and `pod install` test did successfully run the app. – Karol Gil Jun 02 '17 at 12:53