Using Capybara

Understanding Using Capybara

Using Capybara

Let’s start by using Capybara. This isn’t what actually interacts with the website — rather, it’s a layer that sits between you and the actual web driver. This could be Selenium, PhantomJS, or any of the other drivers that Capybara supports. It provides a common interface and a large number of helper methods for extracting information, inputting data, testing, or clicking around.

User-Registration Process: Using Capybara

So, here is an example of how user registration test is done by Capybara. Moreover, there is a test to see if the user can continue with the registration process or if there are any holds on him. However, if he has the requisite credentials, he will be registered and then redirected to the ‘Welcome’ page.

describe ‘UserRegistration’ do
it ‘allows a user to register’ do
visit new_user_registration_path
fill_in ‘First name’, :with => ‘New’
fill_in ‘Last name’, :with => ‘User’
fill_in ‘Email’, :with => ‘[email protected]
fill_in ‘Password’, :with => ‘userpassword’
fill_in ‘Password Confirmation’, :with => ‘userpassword’
click_button ‘Register’
page.should have_content ‘Welcome’
end
end

 

 

Make your resume stand out and become a Certified Capybara Testing Professional. So, Try free practice tests here!

A great career is just a certification away. So, practice and validate your skills to become Certified Capybara Testing Professional

Capybara Installation
Capybara Drivers

Get industry recognized certification – Contact us

keyboard_arrow_up