Skip to content

3zcurdia/capybara-pagemap

Repository files navigation

Capybara Pagemap

Build Status Maintainability Test Coverage Gem Version

Simple object mapper for page objects with capybara

Installation

Add this line to your application's Gemfile:

gem 'capybara-pagemap'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capybara-pagemap

Usage

Inherit from Capybara::Pagemap::Base and define the input fields as the following example

class LoginPage
  include Capybara::Pagemap
  define_input :email, '//*[@id="user_email"]'
  define_input :password, '//*[@id="user_password"]'
  define_button :log_in, '//*[@id="log_in"]'
end

Once you have define your input you will have access to the getters setters

login_page = LoginPage.new
login_page.email = "[email protected]"
login_page.email
# => "[email protected]"
login_page.email_input
# => Capybara::Node
login_page.log_in_button.click if login_page.valid?

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/3zcurdia/capybara-pagemap.

About

Simple object mapper for page objects with capybara

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published