ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Capybara::Poltergeist::DeadClient errors!


#1

If you’re getting the Capybara::Poltergeist::DeadClient error, then consider trying this fix:

 config.after :each do |example|
      page.driver.restart if defined?(page.driver.restart)
 end

I added that right after I required “capybara/poltergeist” in my rails_helper.rb

Here’s the full error this fixed:

  5) 2 react components, 1 store, server side, controller setup /server_side_hello_world_shared_store_controller Type in one component changes the other component
     Failure/Error: background { visit url }

     Capybara::Poltergeist::DeadClient:
       PhantomJS client died while processing {"id":"a1b6de79-25a8-4d18-af5d-23528b4c3cb5","name":"visit","args":["http://127.0.0.1:51777/server_side_hello_world_shared_store_controller",30]}
     Shared Example Group: "React Component Shared Store" called from ./spec/features/integration_spec.rb:230
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/poltergeist-1.13.0/lib/capybara/poltergeist/server.rb:38:in `send'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/poltergeist-1.13.0/lib/capybara/poltergeist/browser.rb:369:in `command'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/poltergeist-1.13.0/lib/capybara/poltergeist/browser.rb:35:in `visit'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/poltergeist-1.13.0/lib/capybara/poltergeist/driver.rb:97:in `visit'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/capybara-2.12.1/lib/capybara/session.rb:252:in `visit'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/capybara-2.12.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
     # ./spec/features/integration_spec.rb:190:in `block (2 levels) in <top (required)>'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/rspec-retry-0.5.3/lib/rspec/retry.rb:112:in `block in run'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/rspec-retry-0.5.3/lib/rspec/retry.rb:101:in `loop'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/rspec-retry-0.5.3/lib/rspec/retry.rb:101:in `run'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/rspec-retry-0.5.3/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # /Users/justin/.rvm/gems/ruby-2.3.1@react_on_rails/gems/rspec-retry-0.5.3/lib/rspec/retry.rb:30:in `block (2 levels) in setup'