Configuration: Integration tests for Rails project using RSpec, Capybara, Selemium driver, SQLite database.
Situation: I had few integration tests with Capybara and default rack_test driver. They create a user registration (for Devise gem) directly in database. Then they login and test a scenario using Capybara DSL like a user would do.
Problem: I tried to change a driver to Selenium to test JavaScript code as well. Now the tests fail because application does not see a user registration that the tests created.
Investigation: It looks like Selenium driver works differently with transations, so changes made in a test are invisible in the web application. Possible solution make involve:
config.use_transactional_fixtures = false
DatabaseCleaner.strategy = :truncation
For me worked solution from here and here:
gem database_cleaner
spec/support/javascript.rb
with content`
`
though it caused small penalti to my contoller & model specs execution time (from 40 to 43 seconds).