New registration completed and tested

This commit is contained in:
Godwin
2017-06-03 12:55:13 -07:00
parent 6eddbe0a69
commit eed9bd8b40
21 changed files with 763 additions and 1009 deletions
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -16,6 +16,10 @@ Given /^(?:(?:that )?there is )?an? (upcoming|past)( regional)? conference(?: in
TestState.last_conference.save!
end
Given /^there is an organization named '(.+)' in (.+)$/ do |org_name, location|
TestState.last_organization = create_org(org_name, location)
end
Given /^(?:the conference |it )has no (poster|date)$/i do |field|
if field == 'date'
TestState.last_conference.start_date = nil
@@ -33,7 +37,7 @@ Given /^(?:the conference |it )?is not (featured|public)$/i do |field|
end
Given /^the conference accepts housing providers that live within (\d+)(mi|km)$/i do |number, unit|
TestState.last_conference.provider_conditions = {'distance' => {'number' => number.to_i, 'unit' => unit}}
TestState.last_conference.provider_conditions = { 'distance' => {'number' => number.to_i, 'unit' => unit } }
TestState.last_conference.save!
end
+15 -6
View File
@@ -64,6 +64,10 @@ Then /^(?:I )?(un)?check '(.+)'$/i do |uncheck, text|
end
end
Then /^(?:I )?(un)?check ([^']+)$/i do |uncheck, name|
find("input[type=\"checkbox\"][name$=\"[#{name.gsub(/\s/, '_')}]\"]").click
end
Then /^(?:my )?'(.+)' should (not )?be checked$/i do |text, negate|
label = find('.check-box-field label', text: text)
find("##{label[:for]}", visible: false).send(negate ? :should_not : :should, be_checked)
@@ -74,8 +78,8 @@ Then /^(?:I )?(?:select|choose|want) (?:an? |the )?'(.+?)'$/i do |value|
option.first(:xpath, './/..').set(option.value)
end
Then /^(?:I )?fill in (.+?) with '(.+)'$/i do |field, value|
field = field.gsub(/^\s*(my|the)\s*(.+)$/, '\2')
Then /^(?:I )?fill in (.+?) with '(.*)'$/i do |field, value|
field = field.gsub(/^\s*(my|the)?\s*(.+)$/, '\2').gsub(/\s/, '_')
find(selector_for(field)).set value
if /email/ =~ field && !(/organization/ =~ field)
@@ -88,7 +92,12 @@ Then /^(?:I )?enter (?:my |an? |some |the )?(.+?)(?: as '(.+)')?$/i do |field, v
sel = selector_for(field)
element = first(sel, visible: true) || first(sel, visible: false)
element = element.first('[contenteditable]') if element.tag_name.to_s.downcase == 'div'
html = false
if element.tag_name.to_s.downcase == 'div'
element = element.first('[contenteditable]')
html = true
end
unless value.present?
value = case field
@@ -102,11 +111,11 @@ Then /^(?:I )?enter (?:my |an? |some |the )?(.+?)(?: as '(.+)')?$/i do |field, v
when 'subject', 'title'
Forgery::LoremIpsum.sentence(random: true).gsub(/\.$/, '').titlecase
when /(comment|reply)/
Forgery::LoremIpsum.paragraphs(2, sentences: 6, random: true)
Forgery::LoremIpsum.paragraphs(2, sentences: 6, random: true, html: html)
when 'message'
Forgery::LoremIpsum.paragraphs(2, sentences: 6, random: true)
Forgery::LoremIpsum.paragraphs(2, sentences: 6, random: true, html: html)
when 'info'
Forgery::LoremIpsum.paragraphs(rand(1..4), sentences: rand(3..8), random: true)
Forgery::LoremIpsum.paragraphs(rand(1..4), sentences: rand(3..8), random: true, html: html)
else
fail "Unknown selector '#{field}'"
end
+18
View File
@@ -3,11 +3,29 @@ Given /^(?:I am |'(.+)' is )?registered(?: for the conference)?$/i do |username|
create_registration(username.present? ? get_user(username) : TestState.my_account)
end
Given /^(.+) and (.+) are companions$/i do |user1, user2|
u1 = get_user(user1.gsub(/'/, ''))
u2 = get_user(user2.gsub(/'/, ''))
registration1 = ConferenceRegistration.find_by(user_id: u1.id, conference_id: TestState.last_conference.id)
registration1.housing_data['companion'] = { 'id' => u2.id }
registration1.save
registration2 = ConferenceRegistration.find_by(user_id: u2.id, conference_id: TestState.last_conference.id)
registration2.housing_data['companion'] = { 'id' => u1.id }
registration2.save
end
Given /^(?:I )?have paid( \$?\d+|\$?\d+\.\d+)? for registration$/i do |amount|
TestState.my_registration.registration_fees_paid = amount ? amount.to_f : 50.0
TestState.my_registration.save!
end
Given /^my payment status will be '(Completed|Pending|Denied|Error)'$/i do |status|
TestState.my_registration.data ||= {}
TestState.my_registration.data['payment_status'] = status
TestState.my_registration.save!
end
Then /^my registration should( not)? be (confirmed|completed?|paid)$/i do |state, field|
ConferenceRegistration.find_by!(email: TestState.last_email_entered).
send(field == 'confirmed' ? 'is_confirmed' : (field == 'paid' ? 'registration_fees_paid' : field)).
+18 -26
View File
@@ -95,6 +95,22 @@ def create_registration(user = TestState.my_account)
registration.housing = TestState::Sample[:conference_registration].all_housing_options
registration.bike = TestState::Sample[:conference_registration].all_bike_options
registration.food = TestState::Sample[:conference_registration].all_food_options
registration.data = {
'payment_method' => 'none',
'email_sent' => true,
'city_id' => 11,
'new_org' => {
'id' => 8,
'email' => 'example@bikebike.org',
'mailing_address' => "120 Assomption Blvd\r\nEdmundston, New Brunswick\r\nCanada E3V 2X4",
'name' => 'Bike Pulp',
'address' => '120 Assomption Blvd'
},
'current_step' => 'review',
'is_org_member' => true,
'group_ride' => true
}
registration.housing_data = { 'other' => '', 'companion' => false }
registration.save!
if user == TestState.my_account
@@ -110,37 +126,13 @@ def create_org(name = nil, location = nil)
org = FactoryGirl.create(:org)
found_location = nil
if location.present?
cache_file = File.join(File.dirname(__FILE__), 'location_cache.yml')
cache = {}
if File.exists?(cache_file)
begin
cache = YAML.load_file(cache_file)
rescue
# get rid of the cache if there's an error
end
end
l = cache[location]
if l.nil?
l = Geocoder.search(location).first
cache[location] = l
File.open(cache_file, 'w') { |f| f.write cache.to_yaml }
end
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?
# let it though, we might be offline
org.save!
return org
end
found_location = Location.create(city_id: City.search(location).id)
org.locations << found_location
end
if name.present?
org.name = name
org.slug = org.generate_slug(name, found_location)
end
if found_location.present?
org.locations << found_location
end
org.save!
org
end
+3 -3
View File
@@ -120,7 +120,7 @@ end
def email_address(user)
case user
when /(I|me)/
TestState.last_email_entered || TestState.my_account.email
TestState.my_account.present? ? TestState.my_account.email : TestState.last_email_entered
when /^(?:the )?site administrator$/i
'goodgodwin@hotmail.com'
when /^'(.+)'$/
@@ -149,9 +149,9 @@ end
def get_user(username)
return create_user unless username.present?
TestState::Users[username] = create_user({
TestState::Users[username] ||= create_user({
(username =~ /^[^\s]+@[^\s]+\.[^\s]+$/ ? :email : :firstname) => username
}) unless TestState::Users[username].present?
})
return TestState::Users[username]
end
+19 -423
View File
@@ -49,79 +49,21 @@ Brooklyn NY: !ruby/object:Geocoder::Result::Google
- sublocality
- sublocality_level_1
cache_hit:
Yellowknife: !ruby/object:Geocoder::Result::Google
Seattle: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Yellowknife
short_name: Yellowknife
- long_name: Seattle
short_name: Seattle
types:
- locality
- political
- long_name: Fort Smith, Unorganized
short_name: Fort Smith, Unorganized
types:
- administrative_area_level_3
- political
- long_name: Fort Smith Region
short_name: Fort Smith Region
- long_name: King County
short_name: King County
types:
- administrative_area_level_2
- political
- long_name: Northwest Territories
short_name: NT
types:
- administrative_area_level_1
- political
- long_name: Canada
short_name: CA
types:
- country
- political
- long_name: X0E
short_name: X0E
types:
- postal_code
- postal_code_prefix
formatted_address: Yellowknife, NT X0E, Canada
geometry:
bounds:
northeast:
lat: 62.5412576
lng: -114.299678
southwest:
lat: 62.4084661
lng: -114.518312
location:
lat: 62.4539717
lng: -114.3717886
location_type: APPROXIMATE
viewport:
northeast:
lat: 62.5412577
lng: -114.299678
southwest:
lat: 62.4084945
lng: -114.518312
place_id: ChIJyYJGoyzx0VMRge9xQyQ3wbQ
types:
- locality
- political
cache_hit:
New Orleans: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: New Orleans
short_name: New Orleans
types:
- locality
- political
- long_name: Orleans Parish
short_name: Orleans Parish
types:
- administrative_area_level_2
- political
- long_name: Louisiana
short_name: LA
- long_name: Washington
short_name: WA
types:
- administrative_area_level_1
- political
@@ -130,373 +72,27 @@ New Orleans: !ruby/object:Geocoder::Result::Google
types:
- country
- political
formatted_address: New Orleans, LA, USA
formatted_address: Seattle, WA, USA
geometry:
bounds:
northeast:
lat: 30.199332
lng: -89.625053
lat: 47.734145
lng: -122.2244331
southwest:
lat: 29.8666609
lng: -90.14007389999999
lat: 47.4919119
lng: -122.4596959
location:
lat: 29.95106579999999
lng: -90.0715323
lat: 47.6062095
lng: -122.3320708
location_type: APPROXIMATE
viewport:
northeast:
lat: 30.1748625
lng: -89.6269311
lat: 47.734145
lng: -122.2359033
southwest:
lat: 29.86842459999999
lng: -90.1380099
place_id: ChIJZYIRslSkIIYRtNMiXuhbBts
types:
- locality
- political
cache_hit:
Drumheller AB: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Drumheller
short_name: Drumheller
types:
- locality
- political
- long_name: Division No. 5
short_name: Division No. 5
types:
- administrative_area_level_2
- political
- long_name: Alberta
short_name: AB
types:
- administrative_area_level_1
- political
- long_name: Canada
short_name: CA
types:
- country
- political
formatted_address: Drumheller, AB, Canada
geometry:
bounds:
northeast:
lat: 51.488701
lng: -112.4530051
southwest:
lat: 51.3208389
lng: -112.806076
location:
lat: 51.4651847
lng: -112.7105343
location_type: APPROXIMATE
viewport:
northeast:
lat: 51.488701
lng: -112.4530051
southwest:
lat: 51.3208389
lng: -112.806076
place_id: ChIJHx_0B4ANc1MRWZCRwItZUUw
types:
- locality
- political
cache_hit:
Portland OR: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Portland
short_name: Portland
types:
- locality
- political
- long_name: Multnomah County
short_name: Multnomah County
types:
- administrative_area_level_2
- political
- long_name: Oregon
short_name: OR
types:
- administrative_area_level_1
- political
- long_name: United States
short_name: US
types:
- country
- political
formatted_address: Portland, OR, USA
geometry:
bounds:
northeast:
lat: 45.654424
lng: -122.4718489
southwest:
lat: 45.432393
lng: -122.8369952
location:
lat: 45.5230622
lng: -122.6764816
location_type: APPROXIMATE
viewport:
northeast:
lat: 45.6524799
lng: -122.4718489
southwest:
lat: 45.432393
lng: -122.8369952
place_id: ChIJJ3SpfQsLlVQRkYXR9ua5Nhw
types:
- locality
- political
cache_hit:
Prince Rupert BC: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Prince Rupert
short_name: Prince Rupert
types:
- locality
- political
- long_name: Skeena-Queen Charlotte
short_name: Skeena-Queen Charlotte
types:
- administrative_area_level_2
- political
- long_name: British Columbia
short_name: BC
types:
- administrative_area_level_1
- political
- long_name: Canada
short_name: CA
types:
- country
- political
formatted_address: Prince Rupert, BC, Canada
geometry:
bounds:
northeast:
lat: 54.338083
lng: -130.2437961
southwest:
lat: 54.19392
lng: -130.3634291
location:
lat: 54.3150367
lng: -130.3208187
location_type: APPROXIMATE
viewport:
northeast:
lat: 54.3343706
lng: -130.2478032
southwest:
lat: 54.202669
lng: -130.3608029
place_id: ChIJaUV_axPVclQRElbZTQ_jB3E
types:
- locality
- political
cache_hit:
Regina, SK: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Regina
short_name: Regina
types:
- locality
- political
- long_name: Sherwood No. 159
short_name: Sherwood No. 159
types:
- administrative_area_level_3
- political
- long_name: Division No. 6
short_name: Division No. 6
types:
- administrative_area_level_2
- political
- long_name: Saskatchewan
short_name: SK
types:
- administrative_area_level_1
- political
- long_name: Canada
short_name: CA
types:
- country
- political
formatted_address: Regina, SK, Canada
geometry:
bounds:
northeast:
lat: 50.5207396
lng: -104.4924259
southwest:
lat: 50.3964489
lng: -104.7783923
location:
lat: 50.4452112
lng: -104.6188944
location_type: APPROXIMATE
viewport:
northeast:
lat: 50.5207396
lng: -104.4924259
southwest:
lat: 50.3964489
lng: -104.7783923
place_id: ChIJ6z2l-0AeHFMRsVR7t5YySjU
types:
- locality
- political
cache_hit:
Edmundston, NB: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Edmundston
short_name: Edmundston
types:
- locality
- political
- long_name: Madawaska County
short_name: Madawaska County
types:
- administrative_area_level_2
- political
- long_name: New Brunswick
short_name: NB
types:
- administrative_area_level_1
- political
- long_name: Canada
short_name: CA
types:
- country
- political
formatted_address: Edmundston, NB, Canada
geometry:
bounds:
northeast:
lat: 47.456634
lng: -68.14554509999999
southwest:
lat: 47.3177789
lng: -68.44122399999999
location:
lat: 47.3690127
lng: -68.32667409999999
location_type: APPROXIMATE
viewport:
northeast:
lat: 47.456634
lng: -68.14554509999999
southwest:
lat: 47.3183866
lng: -68.44122399999999
place_id: ChIJuQPKxpipvUwRtNjzmeech34
types:
- locality
- political
cache_hit:
Souris, MB: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Souris
short_name: Souris
types:
- locality
- political
- long_name: Glenwood
short_name: Glenwood
types:
- administrative_area_level_3
- political
- long_name: Division No. 7
short_name: Division No. 7
types:
- administrative_area_level_2
- political
- long_name: Manitoba
short_name: MB
types:
- administrative_area_level_1
- political
- long_name: Canada
short_name: CA
types:
- country
- political
- long_name: R0K
short_name: R0K
types:
- postal_code
- postal_code_prefix
formatted_address: Souris, MB R0K, Canada
geometry:
bounds:
northeast:
lat: 49.6272052
lng: -100.2464522
southwest:
lat: 49.6061908
lng: -100.2774639
location:
lat: 49.6207985
lng: -100.2583026
location_type: APPROXIMATE
viewport:
northeast:
lat: 49.6272052
lng: -100.2464522
southwest:
lat: 49.6061908
lng: -100.2774639
place_id: ChIJjVrTVVh851IRLuGKzGdiUj8
types:
- locality
- political
cache_hit:
Eldorado, MX: !ruby/object:Geocoder::Result::Google
data:
address_components:
- long_name: Eldorado
short_name: Eldorado
types:
- locality
- political
- long_name: Sinaloa
short_name: Sin.
types:
- administrative_area_level_1
- political
- long_name: Mexico
short_name: MX
types:
- country
- political
formatted_address: Eldorado, Sin., Mexico
geometry:
bounds:
northeast:
lat: 24.3379838
lng: -107.3476352
southwest:
lat: 24.3108689
lng: -107.3831387
location:
lat: 24.3240714
lng: -107.3584174
location_type: APPROXIMATE
viewport:
northeast:
lat: 24.3379838
lng: -107.3476352
southwest:
lat: 24.3108689
lng: -107.3831387
place_id: ChIJv33Pqm0ho4YRUQ45wKAluZ4
lat: 47.4955511
lng: -122.4359086
place_id: ChIJVTPokywQkFQRmtVEaUZlJRA
types:
- locality
- political
+7 -5
View File
@@ -4,12 +4,14 @@ Feature: Workshops
And registration is open
And I am logged in
And registered for the conference
And on the registration page
And on the registration page
Then I should see 'Propose a Workshop'
Then I should see 'New Workshop'
And should see 'View Workshops'
Then I should see 'New Workshop'
But I should not see any workshops
When I click on 'Propose a Workshop'
When I click on 'New Workshop'
Then I should see 'Create a Workshop'
And see 'Describe your workshop in detail'
@@ -46,7 +48,7 @@ Feature: Workshops
And should see 'Education'
When I click the 'Workshops' link
Then I should see a workshop
Then I should see two workshops
When I click on the 'More info' link
Then I should see 'Tools'
@@ -61,7 +63,7 @@ Feature: Workshops
When I click the 'Delete Workshop' link
And click the 'Confirm' button
Then I should see 'Propose a Workshop'
Then I should see 'New Workshop'
But I should not see any workshops
Scenario: Users can comment on an translate their own workshops