Search⌘ K

Setting Up Capybara

Explore how to set up Capybara for integration testing in Ruby on Rails applications using RSpec. Understand Capybara's role in simulating user interactions, configuring drivers for JavaScript testing, and leveraging tools like capybara-screenshot. Gain knowledge to effectively write and interpret integration tests to improve application quality.

Capybara and RSpec

Capybara allows an automated test to simulate user interaction with a browser. When simulating this interaction, Capybara works in conjunction with a driver, using the simple Capybara API to determine what elements to interact with and using the driver to manage the actual interaction. By default, Capybara uses a native Ruby library that doesn’t manage JavaScript interactions, but it can be configured to use a headless browser such as PhantomJS, headless Chrome, or Selenium to allow JavaScript interactions to be simulated.

Capybara Gemfile

Capybara is part of the default Rails Gemfile in Rails 5.1 and later. If ...