Added post-conference survey

This commit is contained in:
Godwin
2017-09-04 14:10:55 -07:00
parent 90448e059f
commit 611716bbd3
15 changed files with 481 additions and 99 deletions
+7
View File
@@ -640,3 +640,10 @@ Scenario: Housing providers can enter incorrect data and fix it
When I click the 'Next' button
Then I should see 'Your registration is complete'
Scenario: Registration is not accessible after registration is closed
Given there is an upcoming conference in 'Brooklyn NY'
And registration is closed
And I am on the registration page
Then I should see 'You may need to be signed in to access this page'
+8 -7
View File
@@ -67,6 +67,12 @@ Then /^(?:I )?(un)?check ([^']+)$/i do |uncheck, name|
find("input[type=\"checkbox\"][name$=\"[#{name.gsub(/\s/, '_')}]\"]").click
end
Then /^(?:I )?set ([^']+) to (.+?)(?: under (.+))?$/i do |name, value, under|
_name = ((under.present? ? "#{under.gsub(/\s/, '_')}_" : '') + name.gsub(/\s/, '_')).downcase
_value = value.gsub(/\s/, '_').downcase
find("input[type=\"radio\"][name=\"#{_name}\"][value=\"#{_value}\"]").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)
@@ -133,24 +139,19 @@ Then /^(?:my )?(.+)? should (not )?be set to (.+)$/i do |field, should, value|
page.find('[id$="' + field.gsub(/\s+/, '_') + '"]').value.send(should.nil? ? 'should' : 'should_not', eq(value))
end
Then /^(?:I )?set (.+?) to (.+)$/i 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$/i do |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
begin element ||= page.find('[id$="' + field.gsub(/\s+/, '_') + '"]', visible: false); rescue; end
sleep(1)
count += 1
end
end
Then /^(?:I )?select (.+?) from (.+)$/i do |value, field|
select(value, :from => locate(field))
select(value, from: locate(field))
end
Then /^in a new session$/i do
+8 -38
View File
@@ -3,6 +3,14 @@ Given /^(?:I am |'(.+)' is )?registered(?: for the conference)?$/i do |username|
create_registration(username.present? ? get_user(username) : TestState.my_account)
end
Given /^I am (not )?checked in?$/i do |do_not_check_in|
unless do_not_check_in
TestState.my_registration.data ||= {}
TestState.my_registration.data['checked_in'] ||= DateTime.now
TestState.my_registration.save!
end
end
Given /^(.+) and (.+) are companions$/i do |user1, user2|
u1 = get_user(user1.gsub(/'/, ''))
u2 = get_user(user2.gsub(/'/, ''))
@@ -54,44 +62,6 @@ When /^(?:I )?(finish|cancel|don't finish) (?:(?:with )?(?:paypal|the payment))$
visit send("register_paypal_#{action == 'cancel' ? 'cancel' : 'confirm'}_path".to_sym, TestState.last_conference.slug, :paypal_confirm, 'token', amount: YAML.load(TestState.my_registration.payment_info)[:amount])
end
# Then /^(?:I )?pay \$?([\d\.]+)$/i do |amount|
# button = nil
# paypal_info = YAML.load(File.read(Rails.root.join("config/paypal.yml")))['test'].symbolize_keys
# TestState.last_conference.paypal_username = paypal_info[:username]
# TestState.last_conference.paypal_password = paypal_info[:password]
# TestState.last_conference.paypal_signature = paypal_info[:signature]
# TestState.last_conference.save!
# TestState.my_registration.payment_info = {
# payer_id: '1234',
# token: '5678',
# amount: amount.to_f,
# status: 'Completed'
# }.to_yaml
# TestState.my_registration.save!
# control = page.all("[value^=\"#{amount}\"]")
# TestState.last_payment_amount = amount
# if control.length > 0
# control.first.trigger('click')
# else
# fill_in(locate('amount'), with: amount)
# click_link_or_button(locate('payment'))
# end
# end
# Then /^(?:I )?(don't )?have enough funds$/i do |status|
# if status.blank?
# info = YAML.load(TestState.my_registration.payment_info)
# info[:status] = 'Completed'
# TestState.my_registration.payment_info = info.to_yaml
# TestState.my_registration.save!
# end
# end
Given /^a workshop( titled .+)? exists?$/i do |title|
workshop = Workshop.new
workshop.conference_id = TestState.last_conference.id
+2 -2
View File
@@ -16,7 +16,7 @@ module NavigationHelpers
when /^registration$/i
path = :register
args << TestState.last_conference.slug
when /^(conference|register|workshops)$/i
when /^(conference(?:[_\s]survey)?|register|workshops)$/i
args << TestState.last_conference.slug
when /^confirm(ation)?$/
path = :confirm
@@ -26,7 +26,7 @@ module NavigationHelpers
end
if path.is_a?(Symbol)
path = Rails.application.routes.url_helpers.send("#{path}_path".to_sym, *args)
path = Rails.application.routes.url_helpers.send("#{path.to_s.gsub(/\s+/, '_')}_path".to_sym, *args)
end
raise "Can't find mapping from \"#{path}\" to a path." unless path.present?
+44
View File
@@ -0,0 +1,44 @@
Feature: Survey
Scenario: Take the post-conference survey
Given that there is a past conference
And registration is closed
And I am logged in
And registered
And I am checked in
And I am on the registration page
Then I should see 'Please share your feelings and experiences'
When I click on 'Take the survey now'
Then I should see 'Please share your feelings and experiences from this year's Bike!Bike!'
But I should not see 'Thank you for taking the post-conference survey'
When I click on 'This was my first time attending'
And click on 'Likely'
And set housing to satisfied under services
And set bike to NA under services
And set food to unsatisfied under services
And set schedule to neutral under services
And set events to very satisfied under services
And set website to very unsatisfied under services
And enter a services comment as 'The website sucks'
And enter an experience as 'Fun'
And enter improvement ideas as 'No idea'
And click 'Submit'
Then I should see 'Thank you for taking the post-conference survey'
Scenario: Try to take the post-conference survey when not checked in
Given that there is a past conference
And registration is closed
And I am logged in
And registered
And I am not checked in
And I am on the conference survey page
Then I should see 'you did not check in'
Then I should not see 'Please share your feelings and experiences from this year's Bike!Bike!'
But I should not see 'Thank you for taking the post-conference survey'
When I go to the registration page
Then I should not see 'Please share your feelings and experiences'