Created
January 31, 2011 17:49
-
-
Save comeara/804460 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require "spec_helper" | |
require "timeout" | |
require "watir-webdriver/extensions/wait" | |
describe "The registration feature" do | |
before(:each) do | |
@browser = Watir::Browser.new(:firefox) | |
authenticate_with_paypal | |
end | |
def authenticate_with_paypal | |
@browser.goto "https://developer.paypal.com/" | |
@browser.text_field(:name, "login_email").set("[email protected]") | |
@browser.text_field(:name, "login_password").set("testtest") | |
@browser.button(:name, "submit").click | |
end | |
after(:each) do | |
@browser.close | |
end | |
it "should allow runner to register hisself, paying with his PayPal account" do | |
@browser.goto "http://dev.chrisomeara.com:3000/" | |
@browser.button(:id, "register_individual").click | |
@browser.text_field(:name, "registration[name]").set("Joe Runner") | |
@browser.text_field(:name, "registration[email_address]").set("[email protected]") | |
@browser.select_list(:name, "registration[shirts_attributes][0][shirt_size_id]").select("Youth Small (6-8)") | |
@browser.button(:id, "pay_pal_submit").click | |
Watir::Wait.until(5) { @browser.url =~ %r|paypal.com| } | |
@browser.text.should =~ %r|Show Love Fun Run Individual Registration| | |
@browser.text.should =~ %r|\$40| | |
@browser.text_field(:id, "login_email").set("[email protected]") | |
@browser.text_field(:id, "login_password").set("fakefake") | |
@browser.button(:id, "login.x").click | |
@browser.button(:id, "continue").click | |
Watir::Wait.until(10) { @browser.url =~ %r|/registrations/\d| } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment