Simple object mapper for page objects with capybara
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib/capybara
test
.gitignore
.rubocop.yml
.rubocop_todo.yml
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
LICENSE
README.md
Rakefile
capybara-pagemap.gemspec
changelog.md

README.md

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 = "test@example.org"
login_page.email
# => "test@example.org"
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.