LitePage

Build Status Coverage Status

A gem providing a quick, clean, and concise means of implementing the Page Object Model pattern and defining a semantic DSL for automated acceptance tests using watir-webdriver.

Installation

Add this line to your application's Gemfile:

gem 'lite_page'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lite_page

Usage

If you are using cucumber, include the page initialization helper methods in the cucumber World instance.

World(LitePage::PageInitializers)

Include LightPage in your page objects, define a page_url (if you want to be able to use the PageInitializers), and define elements on the page.

Page elements are defined by calling a method corresponding to the appropriate element type and passing it the name by which you wish to access the element and the selectors used to locate it.

class LoginPage
  include LitePage
  page_url('http://www.example.com/login')

  text_field(:username, :label => 'Username')
  text_field(:password, :label => 'Password')
  button(:log_in_button, :text => 'Log In')

  def (username, password)
    self.username.set(username)
    self.password.set(password)
    self..click
  end
end

Visit and interact with your page objects.

visit(LoginPage).('afinch', 'pa55w0rd')

Contributing

  1. Fork it ( http://github.com/saclark/lite_page/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request