Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
WIP: Capybara Integration with Rails (AKA System Tests) #26703
Update: This PR changed a lot over the course of being open. Please refer to the documentation or code in master / 5-1-stable to use system tests
I'm really excited to open this initial PR for bringing system/acceptance test support to Rails through Capybara.
The goal of this PR is for Rails to take on all the setup that is needed in applications to allow Capybara and make system testing default in Rails applications.
The test framework has been moved it it's own gem under the Rails name and is now ActionSystemTest
How do I add System tests to my application?
Capybara's selenium driver requires some setup by the programmer, so I've added a layer between Capybara and Rails so that Rails' takes on that work called
The reason I have chosen Chrome as the default browser is because Firefox doesn't work out of the box. Selenium and the current version of Firefox don't play nicely together so I've set up the driver to default to Chrome, but it can easily be switched to using Firefox. I'd also like to provide support for Safari.
Instead of requiring the programmer to set up the port, browser, server, etc Rails handles that setup and frees up the programmer to work on writing their tests.
The Rails drivers allow the default configuration to be changed by initializing a new driver:
# config/environments/test.rb config.system_testing.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new( browser: :firefox )
What if I don't want to use Selenium?
# config/environments/test.rb config.system_testing.driver = :poltergeist
Each of the Capybara default drivers that requires a server defaults to Puma. Any of the settings can be changed by initializing a new
# config/environments/test.rb config.system_testing.driver = SystemTesting::DriverAdapters::CapybaraDriver.new( name: :poltergeist, server: :webrick )
What if I'm making a new application and don't want system testing at all?
What if I already use Capybara and don't want to use Rails?
I want to try it out!
Cool! What's next?
Below is a list of what is done and what's left to do. Once we sort out naming and other issues I'll finish up the items below.