Created
May 31, 2012 18:32
-
-
Save natritmeyer/2845288 to your computer and use it in GitHub Desktop.
Page Object Management blog post material
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
visit LoginPage do |page| | |
page.login_with('foo', 'badpass') | |
page.text.should include "Login error" | |
page.text.should include "Secure your account" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App | |
def home | |
HomePage.new #returns an instance of the HomePage class | |
end | |
def login_page | |
LoginPage.new | |
end | |
def account_page | |
AccountPage.new | |
end | |
def account_history_page | |
AccountHistoryPage.new | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I log in as the administrator$/ do | |
@app.home.expand_user_section | |
@app.home.sign_in.click | |
@app.login.username.set "admin" | |
@app.login.password.set "p4ssword" | |
@app.login.login_button.click | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@login_page = LoginPage.new # <= dirt | |
@login_page.login_with "bob", "p4ssword" | |
@account_page = AccountPage.new # <= more dirt | |
@account_page.username.text.should == "bob" | |
@account_page.view_account_history.click | |
@account_history_page = AccountHistoryPage.new # <= yet more dirt | |
@account_history_page.purchased_items.size.should == 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment