Splinter is a Capybara Ninja. It provides some helpers to aid with filling in Rails forms.
Bonus: Splinter also includes a few performance tweaks which can be used to speed up test suites. These are opt-in.
Splinter has been tested on MRI 2.1.8, 2.2.4 and 2.3.0.
gem 'splinter' bundle install
Capybara runs in a different thread when the driver is not
can cause issues with transactional fixtures as ActiveRecord normally creates a
new connection per-thread. If you need to force ActiveRecord to share the
connection between threads, add the following to
While not technically related to Capybara, the following GC tweak can increase
run time by 10% or more in some suites. To enable it, add the following to
To capture screenshots on failure, add the following to
Splinter.screenshot_directory = "/path/to/screenshots"
These are mostly borrowed from
They're useful for completing the multiple dropdowns required for a
date/time/datetime field in a Rails form.
# Select by CSS ID select_date Time.now, :id_prefix => :publish_at # Select by label text, label must have for="id_prefix" select_date Time.now, :from => "Publish at"
There are also
select_datetime variants with the same
Here's a little sugar to help complete Rails forms:
complete_form :post do |f| f.text_field :name, "I like turtles!" f.date :publish_at, 3.days.from_now f.select :category, "Blog Posts" f.checkbox :published, false end
After the block is evaluated, the form is completed and submitted.
Note on Patches/Pull Requests
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not bump version. (If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull).
- Send me a pull request. Bonus points for topic branches.
Copyright (c) 2012-2016 Site5.com. See LICENSE for details.