I'm running some tests with Cucumber/Capybara. I've got one scenario where the user goes to the homepage, fills his/her username and password and clicks "Enter". This should log in the user. When using the default Capybara driver, rack_test, this works: the user gets logged in and moved to other page. When using the Selenium driver, this does not work at all. The user submits his/her username and password, but doesn't get logged in.
I'm talking about the very same test. The only thing that changes is the Capybara Driver. I also think it's important to know that I'm using Authlogic for my authentication logic.
Can you help me with this? Thanks!
This is my Capybara configuration file (support/env.rb):
require 'cucumber/rails'
require 'capybara/session'
require 'capybara/dsl'
Capybara.default_selector = :css
Capybara.run_server = false
ActionController::Base.allow_rescue = false
Capybara.javascript_driver = :selenium
Capybara.server_port = 3000
Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
Cucumber::Rails::World.use_transactional_fixtures = false
Capybara.reset_sessions!
DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
DatabaseCleaner.start
activate_authlogic
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
end
After('@no-txn,@selenium,@culerity,@celerity,@javascript') do
DatabaseCleaner.clean
end
Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
DatabaseCleaner.strategy = :transaction
end