You do not need the DatabaseCleaner gem. Here’s a quick summary of steps you need:
- Remove
capybara-selenium
gem anddatabase_cleaner
gem - Add
selenium-webdriver
gem - Make sure you are using Rails 5.1.5 or later. Earlier versions of Rails 5.1 had a defect in ActionDispatch::SystemTesting::Server that caused problems (fixed here).
- In your
rails_helper
file, setconfig.use_transactional_fixtures = true
- If you are using Devise for auth, in your rails_helper file, set
config.include Devise::Test::IntegrationHelpers, type: :system
- Set up a
basic_configure
file as per this post by Noel Rappin. - Replace
RSpec.feature
throughout withRSpec.describe
.
See this commit for more details as to how I managed the switch. It was a hassle, but hopefully easier now that 5.1.5 has fixed the ActionDispatch::SystemTesting::Server issue (I had to monkey patch the file in 5.1.4, but you won’t have to now).