Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run queries in console since upgrade: NoMethodError #1262

Closed
melsomebody opened this issue Jan 23, 2017 · 20 comments
Closed

Unable to run queries in console since upgrade: NoMethodError #1262

melsomebody opened this issue Jan 23, 2017 · 20 comments

Comments

@melsomebody
Copy link

I've upgraded to Xcode 8.2.1 and Calabash 0.20.4. I'm using a physical device and tests are running fine, but since the upgrade I've been unable to use the console.

When running a query in the console I'm getting a NoMethodError:

calabash-ios console
Running irb...
irb(main):001:0> query("view")
NoMethodError: undefined method query' for main:Object from (irb):1 from /usr/local/bin/irb:11:in <main>'

xcode installation location
/Applications/Xcode8.2.1.app/Contents/Developer

xcode version
Xcode 8.2.1
Build version 8C1002

calabash version
0.20.4

output of curl http://localhost:37265/version when running in simulator
{"device_family":"iPhone","outcome":"SUCCESS","server_port":37265,"simulator_device":"iPhone","simulator":"CoreSimulator 338.16 - Device: iPhone 6 - Runtime: iOS 9.3 (13E233) - DeviceType: iPhone 6","app_name":"","app_version":"2.6.4","screen_dimensions":{"native_scale":2,"sample":1,"height":1334,"width":750,"scale":2},"git":{"revision":"dc15597","remote_origin":"git@github.com:calabash/calabash-ios-server.git","branch":"master"},"device_name":"iPhone Simulator","4inch":false,"app_id":"xxxxxxxx","form_factor":"iphone 6","system":"x86_64","version":"0.20.4","iOS_version":"9.3","short_version_string":"1.0","ios_version":"9.3","iphone_app_emulated_on_ipad":false,"model_identifier":"iPhone7,2","app_base_sdk":"iphonesimulator10.2"}

Have I missed something?

Thanks.

@jmoody
Copy link
Contributor

jmoody commented Jan 24, 2017

irb(main):001:0> query("view")

Either you are not running calabash-cucumber >= 0.20, you have a custom .irbrc file in the directory you are running calabash-ios console in, or you are using rvm.

$ gem list calabash-cucumber

We recommend that you always using bundler + Gemfile so you can always know what gem versions you are using.

If there is a local .irbrc file, remove it or align its contents with the default .irbrc file.

If you are using rvm, the problem is that rvm _always reads from the ~/.irbrc file when opening an IRB. I don't have any definitive solution for you. Try copying the default gem file to a local .irbrc and then starting the console like this:

$ bundle exec CALABASH_IRBRC=.irbrc calabash-ios console

We recommend rbenv.

@melsomebody
Copy link
Author

Thank you.

$ gem list calabash-cucumber

*** LOCAL GEMS ***

calabash-cucumber (0.20.4)

I have aligned the contents of .irbrc to the default (although I did manually create this, I could not locate it before).

The output of $ bundle exec CALABASH_IRBRC=.irbrc calabash-ios console from the directory I was previously using the console is:

Could not locate Gemfile or .bundle/ directory

And the output from the project directory is:

bundler: command not found: CALABASH_IRBRC=.irbrc

Due to environmental issues I am not using either rvm or rbenv, gems have been manually installed. Do you think I need to try using rbenv?

Any other ideas? Thanks :)

@jmoody
Copy link
Contributor

jmoody commented Jan 26, 2017

Typo on my part:

$ CALABASH_IRBRC=.irbrc  bundle exec calabash-ios console

Apologies.

@melsomebody
Copy link
Author

That still gives me the same NoMethodError :(

Is the .irbrc file meant to be manually created? Because that's what I had to do, it didn't exist previously. Though you sound as though you may be a bit stumped too so I will just have to keep trying. Thanks for your help.

@jmoody
Copy link
Contributor

jmoody commented Jan 27, 2017

Try:

$ IRBRC=.irbrc bundle exec calabash-ios console

Is the .irbrc file meant to be manually created?

No. There is an .irbrc in the calabash-ios gem. However, rvm defines a global ~/.irbrc file that overrides any per-directory or custom .irbrc.

@melsomebody
Copy link
Author

Still the same problem, and I don't have rvm.

Maybe I should try re-installing the calabash-ios gem?

Can you confirm with directory the .irbrc file should be in and which directory I should be running console commands from? I seem to recall being able to run it from anywhere previously? Thanks :)

@nascimentorafael
Copy link

Same problem here. No solution so far.

@jmoody
Copy link
Contributor

jmoody commented Apr 3, 2017

To debug this problem, copy the contents of the default .irbrc file to a local file .irbrc and insert puts statements to figure out where execution is stopping.

@jmoody
Copy link
Contributor

jmoody commented Apr 7, 2017

I need someone who is having this problem to pair with me via tmate.

@nascimentorafael
Copy link

nascimentorafael commented Apr 7, 2017

I was having a similar issue. Here is how I solved it.

When running the console, if instead of Calabash's it loads irb console, you should do the following:

  • Preferentially use rbenv over rvm. And make sure to remove rvm completely.
  • Make sure you are using at Ruby version >= 2.0. I am using ruby 2.5.0.
  • Install the bundler gem (if not found by Calabash console)
  • Reinstalling Calabash might help

If you are running the Calabash console and you are having something similar to the following error when trying to run some command:

calabash-ios 0.20.4> ids
RunLoop::HTTP::Error: Timeout exceeded
	from /Users/user/.calabash/gems/run_loop-2.2.4/lib/run_loop/http/retriable_client.rb:157:in `block in request'
...
	from (irb):5
	from /Users/user/.rbenv/versions/2.4.0-dev/bin/irb:11:in `<main>'

You should run (on the Calabash console):

start_test_server_in_background

I hope it can help someone.

@jmoody
Copy link
Contributor

jmoody commented Apr 7, 2017

Make sure you are using Ruby version 2.4

ruby 2.4 is not supported. You must use 2.3.x.

@nascimentorafael
Copy link

nascimentorafael commented Apr 7, 2017

I just edited my comment to:

Make sure you are using at Ruby version >= 2.0. I am using ruby 2.5.0.

What do you mean by that?

ruby 2.4 is not supported. You must use 2.3.x.

@pvinothit
Copy link

@jmoody I have same problem and can able to do tmate. Let me know the details please. Thanks

@jmoody
Copy link
Contributor

jmoody commented Apr 10, 2017

@Vinoth7 Please contact me by email to set up a time to pair. My email address is in my GitHub profile. Thanks.

@jmoody
Copy link
Contributor

jmoody commented Apr 10, 2017

Here is a simple test to run.

Reproduce

  1. Create a .irbrc file with the following:
begin                                                                                                                             
  require "irb/completion"
rescue LoadError => e                                                                                   
  puts %Q[                                                                                                                          
Caught a LoadError: could not load 'irb/completion'"
#{e}                                                                                                                              
]                                                                                                                                 
end

puts "Here!"

                                                                                                                          
$ CALABASH_IRBRC=.irbrc calabash-ios console

Expected

Here!

Found

Caught a LoadError: could not load 'irb/completion'" dlopen(/usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle,
9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Reason: image not found -
/usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/x86_64darwin14/readline.bundle

The problem is that readline 7 installed and the ruby install is expecting readline 6.

This is a broken ruby installation.

@jmoody
Copy link
Contributor

jmoody commented Apr 10, 2017

Thanks @Vinoth7 for the tmate session.

@melsomebody
Copy link
Author

Brilliant thanks, this is working for me now. I solved the readline issue by running:

ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib

jmoody added a commit that referenced this issue Apr 19, 2017
Catches bad ruby installations.

#1262
@jmoody
Copy link
Contributor

jmoody commented Apr 19, 2017

Fixed in develop

@vinamelody
Copy link

Hi, I'm having the same issue. Before having this, I was trying to run calabash-ios on iPad device and not simulator by upgrading run_loop gem to version 2.4.1. Shortly after that this error occurs inside console.

RunLoop::HTTP::Error: Timeout exceeded
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.4.1/lib/run_loop/http/retriable_client.rb:157:in `block in request'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.4.1/lib/run_loop/http/retriable_client.rb:150:in `times'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.4.1/lib/run_loop/http/retriable_client.rb:150:in `request'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.4.1/lib/run_loop/http/retriable_client.rb:93:in `post'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.4.1/lib/run_loop/device_agent/client.rb:1598:in `_dismiss_springboard_alerts'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/http_helpers.rb:118:in `_private_dismiss_springboard_alerts'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/http_helpers.rb:22:in `http'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/map.rb:88:in `raw_map'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/map.rb:58:in `map'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/core.rb:149:in `query'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/console_helpers.rb:190:in `accessibility_marks'
	from /Users/vina/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/console_helpers.rb:20:in `labels'
	from (irb):1
	from /Users/vina/.rbenv/versions/2.3.1/bin/irb:11:in `<main>'

Question is ... if i do this ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib how will it affect future upgrade?

@vinamelody
Copy link

Sorry, I'll just proceed with ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib and it doesn't solve the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants