Search code examples
javascriptrspeccapybaracapybara-webkit

Avoid capybaras webkit console.log output


I am using rspec with the capybara-webkit driver for javascript tests.

While having javascripts console.log output is a great feature, for automatic and parallel tests I dont want console.log messing the output. I tried creating the driver with

Capybara.register_driver :webkit_silent do |app|
  Capybara::Driver::Webkit.new(app, :stdout => nil)
end

and using it with either with

Capybara.javascript_driver = :webkit_silent

for all in spec_helper or

Capybara.current_driver = :webkit_silent

for one test, the output is still there. I looked a little into the code and verified stdout was set to null in the connection class.

Is there any other method to stop the output?


Solution

  • shame on me. there was some puts output which confused me, everything is fine and works as expected.