You do not need the DatabaseCleaner gem. Here’s a quick summary of steps you need:
- Remove
capybara-seleniumgem anddatabase_cleanergem - Add
selenium-webdrivergem - 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_helperfile, 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_configurefile as per this post by Noel Rappin. - Replace
RSpec.featurethroughout 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).