Skip to content

Instantly share code, notes, and snippets.

@eyston
Created Feb 20, 2013
Embed
What would you like to do?
## 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