Search code examples
ruby-on-railsseleniumwebrat

Switch between a headed and headless server when integration testing with capybara


Let's say I have web-rat and selenium installed. How do I test my rails app quickly with web-rat (using capybara) , and then, do one final integration test with selenium?


Solution

  • Open spec/spec_helper.rb

    Add this line:

    Capybara.current_driver = :selenium # This is capybara's default server anyway!
    

    Now simply change the symbol to reference whichever server you want. E.g.

    To use webkit:

    Capybara.current_driver = :webkit 
    

    Or to use Poltergesit:

    Capybara.current_driver = :poltergeist