I'd like to debug some of my tests and see what's actually happening. An easy way to do that would be to watch them play out in front of me. Is it possible to force Capybara to use an actual browser instance to run the tests visibly in front of you?
Capybara is a Ruby library (also referred to as a gem) that is used with an underlying web-based driver. It consists of a user-friendly DSL (Domain Specific Language) which describe actions that are executed by the underlying web driver.
Capybara is a test automation framework commonly used for testing web applications in Ruby. Capybara simulates scenarios for user stories and automates web application testing for behavior-driven software development.
Capybara is an acceptance test framework for web applications. It's a common choice for end-to-end, acceptance, or integration testing in Rails applications. It allows developers to simulate a user on a web page and make assertions based on the content and environment of the page.
Of course it is possible! You can use selenium driver.
Add selenium-webdriver
to your Gemfile. Then, in your spec_helper.rb
you'll have to set
Capybara.javascript_driver = :selenium
When you'll launch your tests, a new Firefox window will open!
If you want Chrome to be opened, set the driver to :selenium_chrome
Remember to set :js => true
in your test:
describe 'some test', :js => true do
it "something" do
.
.
.
end
end
You can also learn more about drivers here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With