Search code examples
ruby-on-railstestingrspeccapybaracapybara-webkit

Combine two drivers for Capybara


I'm currently using this configuration to hide qt messages in the console:

Capybara.register_driver :webkit_with_qt_plugin_messages_suppressed do |app|
 Capybara::Webkit::Driver.new(app,Capybara::Webkit::Configuration.to_hash.merge(stderr: WebkitStderrWithQtPluginMessagesSuppressed.new))
end

Capybara.javascript_driver = :webkit_with_qt_plugin_messages_suppressed

but I also need to ignore ssl errors:

Capybara::Driver::Webkit.new({ :ignore_ssl_errors => true})

The problem is that if i do

Capybara.register_driver :webkit_with_qt_plugin_messages_suppressed do |app|
 Capybara::Webkit::Driver.new(app,Capybara::Webkit::Configuration.to_hash.merge(stderr: WebkitStderrWithQtPluginMessagesSuppressed.new))
 Capybara::Webkit::Driver.new(app, :ignore_ssl_errors => true)
end

the test passes but I see qt messages.
Is there any way to do it?


Solution

  • I think this should do what you want

    Capybara.register_driver :webkit_with_qt_plugin_messages_suppressed do |app|
         Capybara::Webkit::Driver.new(app,
            Capybara::Webkit::Configuration.to_hash.merge(
              stderr: WebkitStderrWithQtPluginMessagesSuppressed.new,
              ignore_ssl_errors: true)
         )
    end