teampoltergeist / poltergeist

A PhantomJS driver for Capybara
MIT License
2.5k stars 415 forks source link

Pry and save_and_open_screenshot #888

Closed atanych closed 7 years ago

atanych commented 7 years ago

Hi there!

Caught weird lock when run test with binding.pry and try to create screen save_and_open_screenshot

poltergeist (1.15.0) phantomjs (2.1.1) ruby (2.3.3)

config

  Capybara.register_driver :poltergeist do |app|
    options = {
        js_errors: false,
        timeout: 80,
        debug: true,
        inspector: true,
        window_size: [1366, 768]
    }
    Capybara::Poltergeist::Driver.new(app, options)
  end

error message:

[1] pry(#<RSpec::ExampleGroups::CopyDimension>)> save_and_open_screenshot
{"id":"d0453476-13fa-45f3-8668-a59f07fa28ff","name":"render","args":["/Users/atanych/Applications/rails/psychometrics/tmp/capybara/capybara-20170509140419656036337.png",{"full":false}]}
Capybara::Poltergeist::TimeoutError: Timed out waiting for response to {"id":"d0453476-13fa-45f3-8668-a59f07fa28ff","name":"render","args":["/Users/atanych/Applications/rails/psychometrics/tmp/capybara/capybara-20170509140419656036337.png",{"full":false}]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker.
from /Users/atanych/.rvm/gems/ruby-2.3.3/gems/poltergeist-1.15.0/lib/capybara/poltergeist/web_socket_server.rb:100:in `rescue in send'

PS. When I change javascript_driver on chrome I can create screenshots after binding.pry

Also I tried this solution https://github.com/pry/pry/wiki/FAQ#threads-dont-work-whats-wrong. It is not helped me

twalpole commented 7 years ago

Which solution exactly did you try from the linked wiki?

atanych commented 7 years ago

@twalpole https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X#option-2-build-ruby-with-gnu-readline-using-rvm-and-homebrew

twalpole commented 7 years ago

@atanych And you're 100% sure you did that correctly, it rebuilt the ruby version successfully and that you're actually using the version of ruby you rebuilt? If so maybe try option 4 instead. This is a pry issue and not actually a Poltergeist issue.

atanych commented 7 years ago

@twalpole The main reason why Im not sure that pry issue, it works with another capybara driver. I will try today option 4 and will send result here.

twalpole commented 7 years ago

@atanych The fact it works with selenium doesn't mean anything. selenium-webdriver doesn't start threads to talk to the browser, everything is synchronous. Poltergeist works differently by using a separate thread to handle the output of PhantomJS. If pry is blocking all threads from running (when it shouldn't be) or not providing a way to start those threads again, then it's a pry issue.

ignaciojonas commented 7 years ago

Hi @atanych Did you fix this issue? I'm having the same issue in my box, tried to follow solution #2 and #4 from the guard link, but no luck. Thanks!

atanych commented 7 years ago

@gnaciojonas Hi! Nope, I have replaced poltergeist with chomedriver.

But question is actual.