https://github.com/3zcurdia/capybara-pagemap
Simple object mapper for page objects with capybara
https://github.com/3zcurdia/capybara-pagemap
capybara gem pageobject pageobject-pattern ruby
Last synced: 11 months ago
JSON representation
Simple object mapper for page objects with capybara
- Host: GitHub
- URL: https://github.com/3zcurdia/capybara-pagemap
- Owner: 3zcurdia
- License: mit
- Created: 2016-07-01T21:00:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-03-23T18:15:17.000Z (over 6 years ago)
- Last Synced: 2025-08-21T21:35:37.036Z (11 months ago)
- Topics: capybara, gem, pageobject, pageobject-pattern, ruby
- Language: Ruby
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Capybara Pagemap
[](https://travis-ci.org/3zcurdia/capybara-pagemap)
[](https://codeclimate.com/github/3zcurdia/capybara-pagemap/maintainability)
[](https://codeclimate.com/github/3zcurdia/capybara-pagemap/test_coverage)
[](https://badge.fury.io/rb/capybara-pagemap)
Simple object mapper for page objects with capybara
## Installation
Add this line to your application's Gemfile:
```ruby
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
```ruby
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
```ruby
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.