Skip to content

Instantly share code, notes, and snippets.

@eyston
Created February 20, 2013 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyston/4997793 to your computer and use it in GitHub Desktop.
Save eyston/4997793 to your computer and use it in GitHub Desktop.
## env.rb ##
PageObject.javascript_framework = :jquery
## login.rb ##
class LoginPage
include PageObject
## stuff for every page ##
div(:loading_overlay, :id => 'loading-overlay')
def initialize_page
## this is for the first page you visit -- we deliver a static page and load javascript async
## static page has loading overlay that gets removed from dom when javascript executes
wait_until(10, "Page did not finish loading in 10 seconds") do
!loading_overlay?
end
## every page may or may not do ajax via jquery
wait_for_ajax
end
## end stuff ##
page_url "http://localhost:8080/login"
text_field(:email, :id => 'inputEmail')
text_field(:password, :id => 'inputPassword')
button(:login, :class => 'login')
def login_with(email, password)
self.email = email
self.password = password
login
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment