Skip to content

Instantly share code, notes, and snippets.

@comeara
Created January 31, 2011 17:49
Show Gist options
  • Save comeara/804460 to your computer and use it in GitHub Desktop.
Save comeara/804460 to your computer and use it in GitHub Desktop.
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("funruntest@theomearas.net")
@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("joe.runner@example.com")
@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("funrun_1290062334_per@theomearas.net")
@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