Paypal Registration
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
Feature: Landing Page
|
||||
As a person interested in bikebike
|
||||
I want to find out about the current bikebike
|
||||
In order to attend the conference
|
||||
In order to learn about Bike!Bike!
|
||||
As a visitor
|
||||
|
||||
Scenario: Read landing page content
|
||||
Given I am on the landing page
|
||||
Then I can read about the current bikebike
|
||||
And I can register for the conference
|
||||
Scenario: See a more info link
|
||||
Given There is an upcoming conference in Halifax NS
|
||||
And I am on the landing page
|
||||
Then I see the Bike!Bike! logo
|
||||
And I see the Conferences menu item
|
||||
And I see the Organizations menu item
|
||||
And I see the Resources menu item
|
||||
And I see Halifax
|
||||
And I see More Info
|
||||
|
||||
Scenario: See a register link
|
||||
Given There is an upcoming conference in Halifax NS
|
||||
And Registration is open
|
||||
And I am on the landing page
|
||||
Then I see the Bike!Bike! logo
|
||||
And I see the Conferences menu item
|
||||
And I see the Organizations menu item
|
||||
And I see the Resources menu item
|
||||
And I see Halifax
|
||||
And I see a Register Now link
|
||||
|
||||
@@ -0,0 +1,593 @@
|
||||
Feature: Registration
|
||||
In order to register for the latest Bike!Bike!
|
||||
As a visitor
|
||||
|
||||
@javascript
|
||||
Scenario: Register as participant with some second thoughts
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named The Bike Bush exists in Musquodoboit Harbour NS
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with shout@me.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Joe
|
||||
And I fill in my lastname with Smith
|
||||
And I fill in my username with Joey
|
||||
And I check is_participant
|
||||
And I press cancel
|
||||
|
||||
Then I should see you will lose the infomation you have submitted
|
||||
Then I press no
|
||||
And I should see Attending as
|
||||
And firstname should be set to Joe
|
||||
And lastname should be set to Smith
|
||||
And username should be set to Joey
|
||||
And is_participant should be checked
|
||||
And is_volunteer should not be checked
|
||||
|
||||
Then I press cancel
|
||||
And press yes
|
||||
Then I should see Your registration has been cancelled
|
||||
|
||||
@javascript
|
||||
Scenario: Register as participant
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named The Bike Bush exists in Musquodoboit Harbour NS
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with shout@me.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Joe
|
||||
And I fill in my lastname with Smith
|
||||
And I fill in my username with Joey
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select couch from housing
|
||||
And I fill in housing extra with I'm easy
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select Yes, from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select No from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with Nope
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
But my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And I should see Who do you Represent
|
||||
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I click on The Bike Bush
|
||||
And press next
|
||||
And my registration is completed
|
||||
|
||||
Then in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link registration
|
||||
And I am not a user
|
||||
|
||||
When I go to the confirmation page
|
||||
And I should see Thanks for completing your registration
|
||||
And my registration is confirmed
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
And I am a user
|
||||
And I am a member of The Bike Bush
|
||||
|
||||
@javascript
|
||||
Scenario: Register as eager participant
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with goodgodwin@hotmail.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Michael
|
||||
And I fill in my lastname with Godwin
|
||||
And I fill in my username with Godwin
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select bed from housing
|
||||
And I fill in housing extra with I have a bad back
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select large from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select No from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with I'm coming two months early
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
And my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link
|
||||
And I see Who do you Represent
|
||||
|
||||
When I go to the confirmation page
|
||||
Then I see Thanks for confirming
|
||||
And I see Who do you Represent
|
||||
And my registration is confirmed
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I click on Cool Cats Bikes
|
||||
And press next
|
||||
|
||||
Then I should see Thanks for completing your registration
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
But my registration is not paid
|
||||
|
||||
Then I should get a Thanks email
|
||||
And in the email I should see pay the registration donation
|
||||
And in the email I should see a pay registration link
|
||||
|
||||
When I go to the pay registration page
|
||||
Then I see Thanks for completing your registration
|
||||
And I see we ask that you pay
|
||||
And I see payment amount
|
||||
And I see submit payment
|
||||
|
||||
Then I fill in payment amount with 12.34
|
||||
And press submit payment
|
||||
Then I should see Your order summary
|
||||
|
||||
When I finish paying
|
||||
Then I should see We'll see you in Moncton
|
||||
And my registration is paid
|
||||
|
||||
@javascript
|
||||
Scenario: Register as really eager participant
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with goodgodwin@hotmail.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Michael
|
||||
And I fill in my lastname with Godwin
|
||||
And I fill in my username with Godwin
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select bed from housing
|
||||
And I fill in housing extra with I have a bad back
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select large from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select No from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with I'm coming two months early
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
And my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link
|
||||
And I see Who do you Represent
|
||||
|
||||
When I go to the confirmation page
|
||||
Then I see Thanks for confirming
|
||||
And I see Who do you Represent
|
||||
And my registration is confirmed
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I click on Cool Cats Bikes
|
||||
And press next
|
||||
|
||||
Then I should see Thanks for completing your registration
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
But my registration is not paid
|
||||
|
||||
Then I should get a Thanks email
|
||||
And in the email I should see pay the registration donation
|
||||
And in the email I should see a pay registration link
|
||||
|
||||
Then I should see Thanks for completing your registration
|
||||
And I see we ask that you pay
|
||||
And I see payment amount
|
||||
And I see submit payment
|
||||
|
||||
Then I fill in payment amount with 12.34
|
||||
And press submit payment
|
||||
Then I should see Your order summary
|
||||
|
||||
When I finish paying
|
||||
Then I should see We'll see you in Moncton
|
||||
And my registration is paid
|
||||
|
||||
@javascript
|
||||
Scenario: Register as eager with second thoughts
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with goodgodwin@hotmail.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Michael
|
||||
And I fill in my lastname with Godwin
|
||||
And I fill in my username with Godwin
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select bed from housing
|
||||
And I fill in housing extra with I have a bad back
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select large from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select No from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with I'm coming two months early
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
And my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link
|
||||
And I see Who do you Represent
|
||||
|
||||
When I go to the confirmation page
|
||||
Then I see Thanks for confirming
|
||||
And I see Who do you Represent
|
||||
And my registration is confirmed
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I click on Cool Cats Bikes
|
||||
And press next
|
||||
|
||||
Then I should see Thanks for completing your registration
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
But my registration is not paid
|
||||
|
||||
Then I should get a Thanks email
|
||||
And in the email I should see pay the registration donation
|
||||
And in the email I should see a pay registration link
|
||||
|
||||
Then I should see Thanks for completing your registration
|
||||
And I see we ask that you pay
|
||||
And I see payment amount
|
||||
And I see submit payment
|
||||
|
||||
Then I fill in payment amount with 12.34
|
||||
And press submit payment
|
||||
Then I should see Your order summary
|
||||
|
||||
When I cancel the payment
|
||||
Then I should see Thanks for completing your registration
|
||||
And I see we ask that you pay
|
||||
And my registration is not paid
|
||||
|
||||
@javascript
|
||||
Scenario: Register as workshop host
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named The Bike Bush exists in Musquodoboit Harbour NS
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with scream@me.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Joe
|
||||
And I fill in my lastname with Smith
|
||||
And I fill in my username with Joey
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select couch from housing
|
||||
And I fill in housing extra with I'm easy
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select Yes, from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select Yes from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with Nope
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
But my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And I should see Who do you Represent
|
||||
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I click on The Bike Bush
|
||||
And press next
|
||||
|
||||
Then I should see Workshop Information
|
||||
Then I fill in title with How make your shop more Capitalist
|
||||
Then I set info to Lorem Ipsum and Stuff
|
||||
Then I select organization management from stream
|
||||
Then I select presentation from presentation style
|
||||
Then I fill in notes with Down with all the anarchists
|
||||
Then press next
|
||||
|
||||
Then in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link registration
|
||||
|
||||
When I go to the confirmation page
|
||||
And I should see Thanks for completing your registration
|
||||
And my registration is confirmed
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
|
||||
@javascript
|
||||
Scenario: Register with new organization
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named The Bike Bush exists in Musquodoboit Harbour NS
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with example@example.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Emma
|
||||
And I fill in my lastname with Smith
|
||||
And I fill in my username with Em
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select couch from housing
|
||||
And I fill in housing extra with I'm easy
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select small from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select No from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with Nope
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
But my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And I should see Who do you Represent
|
||||
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I check add new org
|
||||
And I press next
|
||||
|
||||
Then I should see Your Organization Information
|
||||
Then I fill in name with The Bike Fridge
|
||||
Then I set info to Lorem Ipsum and Stuff
|
||||
Then I fill in organization email with info@bikefridge.org
|
||||
Then I fill in street with 1044 Mushaboom Road
|
||||
Then I fill in city with Mushaboom
|
||||
Then I select ca from country
|
||||
Then I select ns from territory
|
||||
Then press next
|
||||
|
||||
Then in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link registration
|
||||
|
||||
When I go to the confirmation page
|
||||
And I should see Thanks for completing your registration
|
||||
And my registration is confirmed
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
And I am a member of The Bike Fridge
|
||||
|
||||
@javascript
|
||||
Scenario: Register with new organization in usa
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And I am in San Francisco, California, USA
|
||||
And an organization named The Bike Bush exists in Musquodoboit Harbour NS
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with example@example.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Emma
|
||||
And I fill in my lastname with Smith
|
||||
And I fill in my username with Em
|
||||
And I check is_participant
|
||||
And I press next
|
||||
|
||||
And I see Do you require housing?
|
||||
And I select couch from housing
|
||||
And I fill in housing extra with I'm easy
|
||||
|
||||
And I see Do you want to borrow a bike?
|
||||
And I select small from loaner bike
|
||||
|
||||
And I see Would you like to host a workshop?
|
||||
And I select No from workshop host
|
||||
|
||||
And I see Anything else
|
||||
And I fill in other with Nope
|
||||
And I should not be registered for the conference
|
||||
|
||||
And I press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
But my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And I should see Who do you Represent
|
||||
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I check add new org
|
||||
And I press next
|
||||
|
||||
Then I should see Your Organization Information
|
||||
Then I fill in name with The Bike Fridge
|
||||
Then I set info to Lorem Ipsum and Stuff
|
||||
Then I fill in organization email with info@bikefridge.org
|
||||
Then I fill in street with 1044 Mushaboom Road
|
||||
Then I fill in city with Mushaboom
|
||||
Then I select us from country
|
||||
Then I select ny from territory
|
||||
Then press next
|
||||
|
||||
Then in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link registration
|
||||
|
||||
When I go to the confirmation page
|
||||
And I should see Thanks for completing your registration
|
||||
And my registration is confirmed
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
And I am a member of The Bike Fridge
|
||||
|
||||
@javascript
|
||||
Scenario: Lazy participant
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
And an organization named The Bike Bush exists in Musquodoboit Harbour NS
|
||||
And an organization named Cool Cats Bikes exists in Sackville NB
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with example@example.com
|
||||
And I press register
|
||||
|
||||
And I press next
|
||||
But I see please tell us your name
|
||||
|
||||
Then I fill in my firstname with Emma
|
||||
And I press next
|
||||
But I see please tell us your name
|
||||
|
||||
Then I fill in my lastname with Smith
|
||||
And I press next
|
||||
But I see attending the conference or volunteering
|
||||
|
||||
Then I check is_participant
|
||||
And I press next
|
||||
|
||||
Then I select Yes from workshop host
|
||||
And press submit
|
||||
|
||||
Then I should be registered for the conference
|
||||
But my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And I should see Who do you Represent
|
||||
|
||||
But my registration is not complete
|
||||
And my registration is not completed
|
||||
|
||||
Then I press next
|
||||
But I see Please select an organization
|
||||
|
||||
Then I click on The Bike Bush
|
||||
And press next
|
||||
|
||||
Then I should see Workshop Information
|
||||
But press next
|
||||
|
||||
But I should see Please give your workshop a title
|
||||
Then I fill in title with Why do I have to give all this info right now?
|
||||
And press next
|
||||
|
||||
But I should see Please describe your workshop
|
||||
Then I set info to Lorem Ipsum and Stuff
|
||||
|
||||
Then I select organization management from stream
|
||||
And I select presentation from presentation style
|
||||
And press next
|
||||
|
||||
Then I should see Thanks for submitting your registration
|
||||
|
||||
Then in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link registration
|
||||
|
||||
When I go to the confirmation page
|
||||
And I should see Thanks for completing your registration
|
||||
And my registration is confirmed
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
And I am a member of The Bike Bush
|
||||
And My firstname should be Emma
|
||||
And My lastname should be Smith
|
||||
And My username should be Emma Smith
|
||||
@@ -1,13 +1,215 @@
|
||||
Given(/^I am on the (.+) page$/) do |page_name|
|
||||
visit path_to(page_name)
|
||||
visit path_to(page_name.to_sym)
|
||||
end
|
||||
|
||||
Then(/^I can read about the current bikebike$/) do
|
||||
within('#conference-name') { expect(page).to have_text 'Bike!Bike!' }
|
||||
within('#conference-location') { expect(page).to have_text 'Columbus, Ohio' }
|
||||
within('#conference-date') { expect(page).to have_text 'August 30 - September 1' }
|
||||
Given(/^I am on the (.+) site$/) do |language|
|
||||
ApplicationController::set_host (get_language_code(language) + '.bikebike.org')
|
||||
end
|
||||
|
||||
Then(/^I can register for the conference$/) do
|
||||
expect(page).to have_link 'Register'
|
||||
Given(/^I am in (.+)$/) do |location|
|
||||
ApplicationController::set_location (location)
|
||||
end
|
||||
|
||||
When(/^I go to the (.+) page$/) do |page_name|
|
||||
visit path_to(page_name.to_sym)
|
||||
end
|
||||
|
||||
When(/^(I )?(finish|cancel) (paying|(the )?payment)$/) do |a, action, b, c|
|
||||
visit path_to((action == 'finish' ? 'confirm' : action) + ' payment')
|
||||
end
|
||||
|
||||
Given(/^There is an upcoming conference( in .+)?$/) do |location|
|
||||
@last_conference = FactoryGirl.create(:upcoming_conference)
|
||||
if location
|
||||
@org = create_org(nil, location)
|
||||
@last_conference.organizations << @org
|
||||
@last_conference.save!
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^an organization( named .+)? exists( in .+)?$/) do |name, location|
|
||||
if location =~ /every country/i
|
||||
Carmen::World.instance.subregions.each { |country|
|
||||
#puts "#{country.code}"
|
||||
|
||||
if country.subregions?
|
||||
country.subregions.each { |region|
|
||||
org = Organization.new(name: rand(36**16).to_s(36), slug: rand(36**16).to_s(36))#create_org#(Forgery::LoremIpsum.sentence)
|
||||
org.locations << Location.new(city: 'City', country: country.code, territory: region.code)
|
||||
org.save!
|
||||
}
|
||||
else
|
||||
org = Organization.new(name: rand(36**16).to_s(36), slug: rand(36**16).to_s(36))#create_org#(Forgery::LoremIpsum.sentence)
|
||||
org.locations << Location.new(city: 'City', country: country.code)
|
||||
org.save!
|
||||
end
|
||||
}
|
||||
else
|
||||
create_org(name ? name.gsub(/^\s*named\s+(.*?)\s*$/, '\1') : nil, location ? location.gsub(/^\s*in\s+(.*?)\s*$/, '\1') : nil)
|
||||
end
|
||||
end
|
||||
|
||||
Given(/^Registration is (open|closed)$/) do |status|
|
||||
@last_conference.registration_open = (status == 'open')
|
||||
@last_conference.save!
|
||||
end
|
||||
|
||||
Then(/^I (should )?see (.+)$/) do | a, item |
|
||||
if /(the )?Bike!Bike! logo$/ =~ item
|
||||
expect(page).to have_selector('svg.logo')
|
||||
elsif /(the|a)?\s?(.+) menu item$/ =~ item
|
||||
within('#main-nav') { expect(page).to have_link Regexp.last_match(2) }
|
||||
elsif /(the|a)?\s?(.+) image$/ =~ item
|
||||
expect(page).to have_selector('#'+Regexp.last_match(2)+' img')
|
||||
elsif /(the|a)?\s?(.+) link$/ =~ item
|
||||
expect(page).to have_link Regexp.last_match(2)
|
||||
else
|
||||
expect(page).to have_text item
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
## ======= Forms ======= ##
|
||||
|
||||
Then(/^(I )?click on (.+?)( button| link| which is hidden)?$/) do | a, item, type |
|
||||
item = item.gsub(/^\s*(a|the)\s*(.*)$/, '\2')
|
||||
if type && type.strip == 'button'
|
||||
click_button(item)
|
||||
elsif type && type.strip == 'link'
|
||||
click_link(item)
|
||||
elsif type && type =~ /hidden/
|
||||
find('[id$="' + item.gsub(/\s+/, '_') + '"]', :visible => false).click
|
||||
else
|
||||
page.find_link(item).trigger('click')
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^(I )?press (.+)$/) do | a, item |
|
||||
click_link_or_button(locate(item))
|
||||
end
|
||||
|
||||
Then(/^I (un)?check (.+)$/) do | state, item |
|
||||
if state == 'un'
|
||||
uncheck(locate(item))
|
||||
else
|
||||
check(locate(item))
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I fill in (.+?) with (.+)$/) do | field, value |
|
||||
field = field.gsub(/^\s*(my|the)\s*(.+)$/, '\2')
|
||||
fill_in(locate(field), :with => value)
|
||||
|
||||
if /email/ =~ field && !(/organization/ =~ field)
|
||||
@last_email_entered = value
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^(my )?(.+)? should (not )?be set to (.+)$/) do | a, field, should, value |
|
||||
field = field.gsub(/^\s*(my|the)\s*(.+)$/, '\2')
|
||||
page.find('[id$="' + field.gsub(/\s+/, '_') + '"]').value.send(should.nil? ? 'should' : 'should_not', eq(value))
|
||||
end
|
||||
|
||||
Then(/^(my )?(.+)? should (not )?be checked$/) do | a, field, should |
|
||||
field = field.gsub(/^\s*(my|the)\s*(.+)$/, '\2')
|
||||
page.find('[id$="' + field.gsub(/\s+/, '_') + '"]').send(should.nil? ? 'should' : 'should_not', be_checked)
|
||||
end
|
||||
|
||||
Then(/^I set (.+?) to (.+)$/) do | field, value |
|
||||
field = field.gsub(/^\s*(my|the)\s*(.+)$/, '\2')
|
||||
page.find('[id$="' + field.gsub(/\s+/, '_') + '"]', :visible => false).set value
|
||||
end
|
||||
|
||||
Then(/^(I )wait for (.+?) to appear$/) do | a, field |
|
||||
count = 0
|
||||
element = nil
|
||||
while element.nil? && count < 120
|
||||
begin element = page.find('[id$="' + field.gsub(/\s+/, '_') + '"]'); rescue; end
|
||||
begin element ||= page.find('[id$="' + field.gsub(/\s+/, '_') + '"]', :visible => false); rescue; end
|
||||
sleep(1)
|
||||
count += 1
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^show the page$/) do
|
||||
print page.html
|
||||
save_and_open_page
|
||||
end
|
||||
|
||||
Then(/^I select (.+?) from (.+)$/) do | value, field |
|
||||
select(value, :from => locate(field))
|
||||
end
|
||||
|
||||
## ======= Emails ======= ##
|
||||
|
||||
Then(/^I should not get an email$/) do
|
||||
ActionMailer::Base.deliveries.size.should eq 0
|
||||
end
|
||||
|
||||
Then (/^I should get an? (.+) email$/) do |subject|
|
||||
@last_email = ActionMailer::Base.deliveries.last
|
||||
if @last_email_entered
|
||||
@last_email.to.should include @last_email_entered
|
||||
end
|
||||
@last_email.subject.should include(subject)
|
||||
end
|
||||
|
||||
Then (/^the email should contain (.+)$/) do |value|
|
||||
@last_email.parts.first.body.raw_source.should include(value)
|
||||
@last_email.parts.last.body.raw_source.should include(value)
|
||||
end
|
||||
|
||||
Then (/^in the email I should see (.+)$/) do |value|
|
||||
if /(an?|the|my) (.+) link/ =~ value
|
||||
test = path_to Regexp.last_match(2)
|
||||
@last_email.parts.first.body.raw_source.should include(test)
|
||||
@last_email.parts.last.body.raw_source.should include(test)
|
||||
else
|
||||
@last_email.parts.first.body.raw_source.should include(value)
|
||||
@last_email.parts.last.body.raw_source.should include(value)
|
||||
end
|
||||
end
|
||||
|
||||
Then (/^I should (not )?be registered for the conference$/) do |state|
|
||||
@last_registration = ConferenceRegistration.find_by(:email => @last_email_entered)
|
||||
if state && state.strip == 'not'
|
||||
@last_registration.should be_nil
|
||||
else
|
||||
@last_registration.should_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
Then (/^my registration (should( not)? be|is( not)?) (confirmed|completed?|paid)$/) do |state, x, y, field|
|
||||
ConferenceRegistration.find_by!(:email => @last_email_entered).
|
||||
send(field == 'confirmed' ? 'is_confirmed' : (field == 'paid' ? 'payment_info' : field)).
|
||||
send(state =~ / not/ ? 'should_not' : 'should', be)
|
||||
end
|
||||
|
||||
Then (/^I am( not)? a user$/) do |state|
|
||||
User.find_by(:email => @last_email_entered).
|
||||
send(state =~ / not/ ? 'should_not' : 'should', be)
|
||||
end
|
||||
|
||||
Then (/^I am( not)? a member of (.+)$/) do |state, org_name|
|
||||
user = nil
|
||||
should_be = !(state =~ / not/)
|
||||
org = Organization.find_by(:name => org_name)
|
||||
if should_be
|
||||
org.should be
|
||||
org.users.should be
|
||||
elsif org.nil? || org.users.nil?
|
||||
return
|
||||
end
|
||||
org.users.each { |u|
|
||||
if u.email == @last_email_entered
|
||||
user = u
|
||||
end
|
||||
}
|
||||
user.send(should_be ? 'should' : 'should_not', be)
|
||||
end
|
||||
|
||||
Then (/^My (.+) should(not )? be (.+)$/) do |field, state, value|
|
||||
User.find_by(:email => @last_email_entered).
|
||||
send(field.gsub(/\s/, '_')).
|
||||
send(state =~ / not/ ? 'should_not' : 'should', eq(value))
|
||||
end
|
||||
|
||||
+87
-3
@@ -5,6 +5,7 @@
|
||||
# files.
|
||||
|
||||
require 'cucumber/rails'
|
||||
require 'capybara/poltergeist'
|
||||
|
||||
# Capybara defaults to CSS3 selectors rather than XPath.
|
||||
# If you'd prefer to use XPath, just uncomment this line and adjust any
|
||||
@@ -31,11 +32,53 @@ ActionController::Base.allow_rescue = false
|
||||
# Remove/comment out the lines below if your app doesn't have a database.
|
||||
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
||||
begin
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
#DatabaseCleaner.clean_with(:truncation)
|
||||
rescue NameError
|
||||
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
||||
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
||||
end
|
||||
|
||||
add_translations = Array.new
|
||||
Carmen::World.instance.subregions.each { |country|
|
||||
add_translations << "world.#{country.code.downcase}.name"
|
||||
if country.subregions?
|
||||
country.subregions.each { |region| add_translations << "world.#{country.code.downcase}.#{region.code.downcase}.name" }
|
||||
end
|
||||
}
|
||||
|
||||
I18n::Backend::BikeBike::init_tests!# add_translations
|
||||
|
||||
#at_exit do
|
||||
# I18n::Backend::BikeBike::end_tests!
|
||||
#end
|
||||
|
||||
Before('@javascript') do
|
||||
ActiveRecord::Base.shared_connection = nil
|
||||
ActiveRecord::Base.descendants.each do |model|
|
||||
model.shared_connection = nil
|
||||
end
|
||||
end
|
||||
|
||||
Before do
|
||||
#DatabaseCleaner.start
|
||||
Translation.connection.execute("INSERT INTO translations (locale, key, value) VALUES('en', 'time.formats.date', '%B %d, %Y');")
|
||||
Translation.connection.execute("INSERT INTO translations (locale, key, value, is_proc) VALUES('en', 'date.month_names', '[\"~\", \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]', TRUE);")
|
||||
ConferenceType.connection.execute("INSERT INTO conference_types (slug) VALUES ('bikebike'), ('regional'), ('bici-congreso')")
|
||||
WorkshopStream.connection.execute("INSERT INTO workshop_streams (slug) VALUES ('mechanics'), ('leisure'), ('interorganizational_relations'), ('ethics_public_relations'), ('organization_management')")
|
||||
WorkshopPresentationStyle.connection.execute("INSERT INTO workshop_presentation_styles (slug) VALUES ('discussion'), ('panel'), ('presentation'), ('hands-on'), ('other')")
|
||||
#host! 'en.bikebike.org'
|
||||
ApplicationController::set_host 'en.bikebike.org'
|
||||
ApplicationController::set_location nil
|
||||
end
|
||||
|
||||
After do |scenario|
|
||||
save_and_open_page if scenario.failed?
|
||||
end
|
||||
|
||||
#After do
|
||||
# DatabaseCleaner.clean
|
||||
#end
|
||||
|
||||
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
|
||||
# See the DatabaseCleaner documentation for details. Example:
|
||||
#
|
||||
@@ -54,5 +97,46 @@ end
|
||||
# Possible values are :truncation and :transaction
|
||||
# The :transaction strategy is faster, but might give you threading problems.
|
||||
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
|
||||
Cucumber::Rails::Database.javascript_strategy = :truncation
|
||||
Cucumber::Rails::Database.javascript_strategy = :transaction
|
||||
Capybara.register_driver :poltergeist_debug do |app|
|
||||
Capybara::Poltergeist::Driver.new(app, :timeout => 120, inspector: true)
|
||||
end
|
||||
Capybara.javascript_driver = :poltergeist_debug
|
||||
Geocoder.configure(:timeout => 60)
|
||||
|
||||
def locate(id)
|
||||
page.find('[id$="' + id.gsub(/\s+/, '_') + '"]')[:id]
|
||||
end
|
||||
|
||||
def create_org(name = nil, location = nil)
|
||||
org = FactoryGirl.create(:org)
|
||||
found_location = nil
|
||||
if !location.nil?
|
||||
l = Geocoder.search(location).first
|
||||
begin
|
||||
found_location = Location.new(city: l.city, territory: l.province_code, country: l.country_code, latitude: l.latitude, longitude: l.longitude)
|
||||
rescue; end
|
||||
if found_location.nil?
|
||||
return
|
||||
end
|
||||
end
|
||||
if !name.nil?
|
||||
org.name = name
|
||||
org.slug = org.generate_slug(name, found_location)
|
||||
end
|
||||
if !found_location.nil?
|
||||
org.locations << found_location
|
||||
end
|
||||
org.save!
|
||||
org
|
||||
end
|
||||
|
||||
def get_language_code(language)
|
||||
languages = {
|
||||
'english' => 'en',
|
||||
'french' => 'fr',
|
||||
'spanish' => 'es',
|
||||
'german' => 'de'
|
||||
}
|
||||
languages[language.downcase]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
FactoryGirl.define do
|
||||
factory :upcoming_conference, :class => 'Conference' do
|
||||
title 'My Bike!Bike!'
|
||||
slug 'MyBikeBike'
|
||||
info 'Curabitur non nulla sit amet nisl tempus convallis quis ac lectus.'
|
||||
poster 'poster.jpg'
|
||||
cover 'cover.jpg'
|
||||
registration_open false
|
||||
start_date Date.today - 30.days
|
||||
end_date Date.today - 26.days
|
||||
conference_type_id (ConferenceType.find_by(:slug => 'bikebike') || ConferenceType.create(:slug => 'bikebike')).id
|
||||
end
|
||||
|
||||
factory :org, :class => 'Organization' do
|
||||
name 'My Organization'
|
||||
info 'Curabitur non nulla sit amet nisl tempus convallis quis ac lectus.'
|
||||
avatar 'avatar.jpg'
|
||||
cover 'cover.jpg'
|
||||
end
|
||||
end
|
||||
|
||||
World(FactoryGirl::Syntax::Methods)
|
||||
+31
-13
@@ -1,18 +1,36 @@
|
||||
module NavigationHelpers
|
||||
def path_to(page_name)
|
||||
case page_name
|
||||
when /^landing$/i
|
||||
path = 'root'
|
||||
end
|
||||
def path_to(page_name)
|
||||
append_root = false
|
||||
case page_name
|
||||
when /^landing$/i
|
||||
path = :root
|
||||
when /^confirmation$/i
|
||||
path = "/conferences/bikebike/#{@last_conference.slug}/register/confirm/#{@last_registration.confirmation_token}"
|
||||
when /^pay registration$/i
|
||||
path = "/conferences/bikebike/#{@last_conference.slug}/register/pay-registration/#{@last_registration.confirmation_token}"
|
||||
when /^confirm payment$/i
|
||||
path = "/conferences/bikebike/#{@last_conference.slug}/register/confirm-payment/#{@last_registration.payment_confirmation_token}"
|
||||
when /^cancel payment$/i
|
||||
path = "/conferences/bikebike/#{@last_conference.slug}/register/cancel-payment/#{@last_registration.confirmation_token}"
|
||||
when /^translation list$/i
|
||||
path = '/translations/'
|
||||
when /^(.+) translations?$/i
|
||||
path = '/translations/' + get_language_code(Regexp.last_match(1))
|
||||
when /^organization list$/i
|
||||
path = '/organizations/'
|
||||
end
|
||||
|
||||
begin
|
||||
self.send((path + '_url').to_sym)
|
||||
rescue Object => e
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
||||
"#{path}_url\n" +
|
||||
"Now, go and add a mapping in #{__FILE__}"
|
||||
end
|
||||
end
|
||||
if path.is_a?(Symbol)
|
||||
begin
|
||||
path = self.send((path.to_s + '_url').to_sym).gsub(/^http:\/\/.+?(\/.*)$/, '\1')
|
||||
rescue Object => e
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
||||
"#{path}_url\n" +
|
||||
"Now, go and add a mapping in #{__FILE__}"
|
||||
end
|
||||
end
|
||||
path
|
||||
end
|
||||
end
|
||||
|
||||
World(NavigationHelpers)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Feature: Translation Pages
|
||||
In order to Translate Bike!Bike!
|
||||
As a visitor
|
||||
|
||||
Scenario: Visit Translation List Page
|
||||
Given I am on the English site
|
||||
And I am on the translation list page
|
||||
Then I see Translations
|
||||
And I see list
|
||||
And I see active
|
||||
And I see inactive
|
||||
|
||||
Scenario: Visit English Translation Page
|
||||
Given I am on the English site
|
||||
And I am on the english translations page
|
||||
Then I see language translations
|
||||
@@ -0,0 +1,46 @@
|
||||
Feature: Volunteer Registration
|
||||
In order to register to volunteer at the latest Bike!Bike!
|
||||
As a visitor
|
||||
|
||||
@javascript
|
||||
Scenario: Register as volunteer
|
||||
Given There is an upcoming conference in Moncton NB
|
||||
And Registration is open
|
||||
|
||||
When I go to the landing page
|
||||
Then I see a Register Now link
|
||||
And I click on the Register Now link
|
||||
|
||||
And I fill in my email with example@example.com
|
||||
And I press register
|
||||
|
||||
And I fill in my firstname with Francis
|
||||
And I fill in my lastname with Bacon
|
||||
And I fill in my username with Bacon
|
||||
And I check is_volunteer
|
||||
And I press next
|
||||
|
||||
Then I see Contact Information
|
||||
And I fill in address with 1234 Some St.
|
||||
And I fill in phone number with 555-555-5555
|
||||
|
||||
Then I see Do you have housing
|
||||
And I fill in beds with 0
|
||||
And I fill in couch_space with 5
|
||||
And I fill in tents with 2
|
||||
|
||||
Then I see Anything else
|
||||
And I fill in other with So excited!
|
||||
|
||||
And I press next
|
||||
|
||||
Then I should be registered for the conference
|
||||
And my registration should not be confirmed
|
||||
And I should get a confirm email
|
||||
And in the email I should see please confirm your registration
|
||||
And in the email I should see a confirmation link registration
|
||||
|
||||
When I go to the confirmation page
|
||||
Then I should see Thanks for completing your registration
|
||||
And my registration is complete
|
||||
And my registration is completed
|
||||
Reference in New Issue
Block a user