In cases where your Cucumber tests rely on browser settings, for e.g., security certificates for trusted sites, you can do the following:

  • Go to the website
  • Accept the website as a trusted site
  • Edit features/support/env.rb with the following code
Before(‘@javascript’) do
  Capybara.register_driver :firefox_custom do |app|
    require ‘selenium/webdriver’
    profile_path = File.dirname(__FILE__) + ‘/profile’
 
    profile = Selenium::WebDriver::Firefox::Profile.new(profile_path)
    profile.assume_untrusted_certificate_issuer = false
 
    Capybara::Selenium::Driver.new(app, {:browser => :firefox, :profile =>profile})
  end
end
 
Before(‘@javascript’) do
   Capybara.current_driver=:firefox_custom 
end
 
  • Commit the profile (cert8.db and cert_override.txt) into “features/support”