diff --git a/.gitignore b/.gitignore index 61d62ed..0ca7ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -70,6 +70,7 @@ brakeman.html /app/assets/stylesheets/web-fonts/* /app/assets/stylesheets/translations/* /app/assets/stylesheets/editor/* +/app/assets/stylesheets/admin/* # Ignore test artifacts /config/locales/data/html_records/* diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index 0f231bb..a71c729 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -715,10 +715,39 @@ button, } } +ul.menu { + list-style: none; + margin-top: 0; + padding-left: 0; + + li { + display: inline; + padding: 0; + + @include after { + content: '|'; + margin: 0 0.333em 0 0.5em; + } + + &:last-child { + @include after { + display: none; + } + } + } +} + +.back-to { + float: left; + margin-right: 0.5em; + font-size: 1.2em; + @include font-family(secondary); +} + #action-message { display: none; text-align: center; - margin-bottom: 1em; + margin-bottom: 3em; &.error, &.complete, &.warning { display: block; diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 3b1ca95..841654b 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -79,14 +79,10 @@ class ConferencesController < ApplicationController end end - view_context.add_stylesheet 'quill.css' - view_context.add_javascript :quill - view_context.add_inline_script :editor - # get the current step @step = current_registration_step(@this_conference, current_user) - if @step == :payment_form && params[:token].present? + if @step == :payment_form && (params[:token].present? || @test_token.present?) result = paypal_payment_confirm(@this_conference, current_user, params) data_to_instance_variables(result) @confirm_payment = true @@ -101,7 +97,7 @@ class ConferencesController < ApplicationController if request.xhr? render json: [{ globalSelector: '#step-content', - html: render_to_string(partial: "registration_steps/#{@step}"), + html: view_context.step_message + render_to_string(partial: "registration_steps/#{@step}"), scrollTo: '#action-message .message, #step-content' }] end diff --git a/app/helpers/registration_helper.rb b/app/helpers/registration_helper.rb index 8feb741..8728010 100644 --- a/app/helpers/registration_helper.rb +++ b/app/helpers/registration_helper.rb @@ -129,22 +129,25 @@ module RegistrationHelper end end - message = if @update_message.present? && @update_status.present? - columns(medium: 12, class: @update_status, id: 'action-message') do - content_tag(:div, (_"articles.conference_registration.#{@update_status}.#{@update_message}", :s), class: :message).html_safe - end - else - '' - end actions = columns(medium: 12, class: [:actions, :center]) do content_tag(:div, actions.html_safe, class: :buttons).html_safe end - form_tag(register_path(conference.slug), class: 'js-xhr') do - message.html_safe + + form_tag(register_path(conference.slug), class: @no_ajax ? nil : 'js-xhr') do content.html_safe + (hidden_field_tag :step, step).html_safe + actions.html_safe end.html_safe end + + def step_message + if @update_message.present? && @update_status.present? + return row do + columns(medium: 12, class: @update_status, id: 'action-message') do + content_tag(:div, (_"articles.conference_registration.#{@update_status}.#{@update_message}", :s), class: :message).html_safe + end.html_safe + end.html_safe + end + return '' + end end diff --git a/app/views/conferences/_page_header.html.haml b/app/views/conferences/_page_header.html.haml index 23af1cb..5d0f5fd 100644 --- a/app/views/conferences/_page_header.html.haml +++ b/app/views/conferences/_page_header.html.haml @@ -1,3 +1,2 @@ -- @main_title_t ||= (@this_conference.title) --# @page_title ||= (@this_conference.title) +- @main_title_t ||= _!(@this_conference.title) = render partial: 'application/header', locals: { page_group: :conferences, page_key: page_key, image_file: @this_conference.poster_url } diff --git a/app/views/conferences/register.html.haml b/app/views/conferences/register.html.haml index 528da8b..5f0f11a 100644 --- a/app/views/conferences/register.html.haml +++ b/app/views/conferences/register.html.haml @@ -6,8 +6,20 @@ = warning %article - if logged_in? - #step-content= render "registration_steps/#{@step}" + - add_stylesheet 'quill.css' + - add_javascript :quill + - add_inline_script :editor + #step-content + = step_message + = render "registration_steps/#{@step}" - else + = row do + = columns(medium: 12) do + %h2=_'articles.conference_registration.headings.Registration_Details' + %p= _'articles.conference_registration.paragraphs.Registration_Details' + %h3=_'articles.conference_registration.headings.Verify_Account' + %p=_'articles.conference_registration.paragraphs.Verify_Account' + = row do = columns(medium: 12) do = render "application/login" diff --git a/app/views/registration_steps/_group_ride.html.haml b/app/views/registration_steps/_group_ride.html.haml new file mode 100644 index 0000000..dcc53e9 --- /dev/null +++ b/app/views/registration_steps/_group_ride.html.haml @@ -0,0 +1,16 @@ += row do + = columns(medium: 12) do + = registration_step_header_title + - if @info.present? + = @info + - else + = registration_step_header_description += row do + = columns(medium: 12) do + = save_registration_step do + .registration-step-options + .options + - [:yes, :maybe, :no].each do |option| + - class_name = [:unstyled] + - class_name << :selected if @will_attend == option + = button option, value: option, class: class_name diff --git a/app/views/registration_steps/_payment_form.html.haml b/app/views/registration_steps/_payment_form.html.haml index 79a9a27..deeff6a 100644 --- a/app/views/registration_steps/_payment_form.html.haml +++ b/app/views/registration_steps/_payment_form.html.haml @@ -15,7 +15,10 @@ = radiobuttons :currency, (@currencies.map { |c| [(_"currencies.#{c}.displayName-count-other"), c] }), @currency .options.graded-options{class: "option-count-#{@amounts.size}"} - @amounts.each_with_index do |option, i| - = button (number_to_currency option, unit: '$'), value: option, name: :value, class: [:unstyled, "option-#{i + 1}"], data: { noxhr: 1 } + = button (number_to_currency option, unit: '$'), value: option, name: :value, class: [:unstyled, "option-#{i + 1}"] .custom-option + -# if Rails.env.test? + =# text_field_tag :custom_value, nil + -# else = number_field_tag :custom_value, 50.0, step: 0.05, min: 0.05 - = button :custom_amount, name: :custom_amount, value: :custom, class: :unstyled, data: { noxhr: 1 } + = button :custom_amount, name: :custom_amount, value: :custom, class: :unstyled diff --git a/app/views/registration_steps/_review.html.haml b/app/views/registration_steps/_review.html.haml index a2f6a36..c232ee2 100644 --- a/app/views/registration_steps/_review.html.haml +++ b/app/views/registration_steps/_review.html.haml @@ -26,7 +26,10 @@ - when :html .scroller= richtext(data[:value].html_safe) - else - = data[:value] + - if data[:key].present? + =_"#{data[:key]}.#{data[:value]}" + - else + = data[:value] - else %p.centered=_'articles.conference_registration.paragraphs.registration_cancelled', :p - if @allow_cancel_attendance diff --git a/app/views/workshops/index.html.haml b/app/views/workshops/index.html.haml index 68fb1d1..94e07d9 100644 --- a/app/views/workshops/index.html.haml +++ b/app/views/workshops/index.html.haml @@ -1,6 +1,11 @@ = render 'conferences/page_header', page_key: 'Workshops' %article + = row do + = columns(medium: 12) do + .back-to=_'articles.conference_registration.headings.Back_to' + %ul.menu + %li=link_to (_'articles.conference_registration.headings.Your_Registration'), :register = row do = columns(medium: 12) do %h2=_'articles.workshops.headings.Workshops' diff --git a/app/views/workshops/show.html.haml b/app/views/workshops/show.html.haml index 67a1a45..6001f07 100644 --- a/app/views/workshops/show.html.haml +++ b/app/views/workshops/show.html.haml @@ -1,7 +1,13 @@ = render 'conferences/page_header', page_key: 'Conference_Registration' %article - = render 'workshops/show', :workshop => @workshop, :translations_available_for_editing => @translations_available_for_editing, :preview => false + = row do + = columns(medium: 12) do + .back-to=_'articles.conference_registration.headings.Back_to' + %ul.menu + %li=link_to (_'articles.conference_registration.headings.Workshops'), :workshops + %li=link_to (_'articles.conference_registration.headings.Your_Registration'), :register + = render 'workshops/show', workshop: @workshop, translations_available_for_editing: @translations_available_for_editing, preview: false = row do = columns(medium: 12) do .actions.next-prev diff --git a/config/locales/en.yml b/config/locales/en.yml index e4cb91e..4bb5277 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1572,19 +1572,39 @@ en: conference_registration: complete: payment_processed: Thank you for your payment! + companion_registered: Your companion has completed their registration, we will do our best to keep you together error: + generic: An unexpected error occurred payment_cancelled: Your payment was cancelled payment_error: An error occurred processing your payment - arrival_date_required: Please select a date - departure_date_required: Please select a date + arrival_date_required: Select a date + departure_date_required: Select a date phone_required: A valid phone number is required - bed_space_required: Please enter the amount of bed or couch space you have to offer - bed_floor_required: Please enter the amount of floor space you have to offer - bed_tent_required: Please enter the amount of tent space you have to offer - info_required: Please provide your guets with information about you and your home + bed_space_required: Enter the amount of bed or couch space you have to offer + floor_space_required: Enter the amount of floor space you have to offer + tent_space_required: Enter the amount of tent space you have to offer + info_required: Provide your guests with information about you and your home + policy_required: Read each statement carefully and check the box once to signify that you aggree to uphold the agreement + name_required: Provide us with a name that you identify with + language_required: Select at least one language that you can speak + location_required: Enter a location + city_not_found: We could not find a city or town that matches your query + org_name_required: Enter the name of your organization + address_required: Enter an address + email_required: An email address is required + org_email_matches_personal_email: This email address matches your personal email address, we ask that you enter your organization's email address instead + mailing_address_required: Enter your organization's mailing address + end_date_before_start: You have selected an end date that is before your start date + departure_date_before_arrival: You have selected a departure date that is before your arrival + companion_email_required: Enter an email address + companion_already_has_companion: This person already has a companion + amount_required: Enter a positive amount + payment_denied: Your payment was denied, please check your account and try again warning: - payment_pending: Thank you! Your payment is currently pending. + payment_pending: Thank you! Your payment is currently pending + companion_unregistered: Your companion has not yet registerred, please ensure that they do to guarantee you are housed together step_names: + group_ride: Group ride? hosting_other: Other hosting_info: House Info hosting_end_date: End Date @@ -1619,6 +1639,8 @@ en: name: Name languages: Languages spoken headings: + Back_to: 'Back to:' + group_ride: Do you plan to attend the group ride? hosting_other: Information for organizers hosting_info: House Info and Rules hosting_end_date: Housing End Date @@ -1716,8 +1738,9 @@ en: info: Info companion: Companion paragraphs: + group_ride: There will be a group ride before the conference, do you plan to attend? registration_cancelled: You have cancelled your registration. If you reconsider, please re-open your registration using the button below but keep in mind that you may lose out of your housing or bike if you wait too long. - hosting_other: Please enter ay information you would like organizers to consider when selecting guests. If you have restrictions on guests that you would lke to stay at your home or if you have pets or other factors that might cause guests to be uncomfortable or not able to stay at your home, please list them here. + hosting_other: Please enter any information you would like organizers to consider when selecting guests. If you have restrictions on guests that you would lke to stay at your home or if you have pets or other factors that might cause guests to be uncomfortable or not able to stay at your home, please list them here. hosting_info: Please fill out your house rules, contact instructions, and any other pertinent information about your home or neighbourhood. Your summary will only be visible to conference organizers and your guests. hosting_end_date: What is the latest date that you are will to have guests stay at you home? hosting_start_date: What is the earliest date that you are will to have guests stay at you home? @@ -1732,11 +1755,11 @@ en: confirm_payment: Thank you, please confirm your payment of %{amount} %{currency}. review: Your registration is complete, please review and modify your data as necessary. payment_form: Please select one of the predefined options below or enter a custom amount. - org_select: Please select the organization tat you will be representing. This information will be used to help us contact and invite your organization next year and to populate the list of known organizations that will be displayed on bikecollectives.org. If you are involved with multiple oganizations, please select one for now, you will be able to add more organizations at a later date. + org_select: Please select the organization that you will be representing. This information will be used to help us contact and invite your organization next year and to populate the list of known organizations that will be displayed on bikecollectives.org. If you are involved with multiple oganizations, please select one for now, you will be able to add more organizations at a later date. payment_type: Registration is by donation but it enables us to pay for spaces, food, equipment, and more. If you can, paying now via PayPal enables us to prepare for the conference without risk of paying out of pocket. Otherwise, pleging to pay on arrival will help us to get a rough idea of what we can and cannot afford. housing_other: Is there anything else that you would like to let us know? housing_allergies: Let us know if you have any allergies that we should be made aware of. - housing_food: Please let us know your eating habits by selecting the option that best describes te type of food tat you eat. We will use this to decide the best types of meals to prepare and how much food we will need. + housing_food: Please let us know your eating habits by selecting the option that best describes the type of food that you eat. We will use this to decide the best types of meals to prepare and how much food we will need. housing_bike: In order for us to get an idea of how many bikes we will need to prepare, please let us know if you would like to borrow a bike from us. housing_companion_email: What is your companion's email address? housing_companion_check: Are you coming with a significant other or someone who you absolutely must be housed with? Please note, your companion must also register if you want to be housed together. @@ -2073,6 +2096,7 @@ en: forms: labels: generic: + territory: State/Province payment_type: paypal: Online on_arrival: In person @@ -2150,13 +2174,14 @@ en: payment_on_arrival: I can pledge to pay on arrival payment_none: Not now food_meat: I eat meat and dairy - food_vegetarian: I am a vegetarian - food_vegan: I am a vegan + food_vegetarian: I am vegetarian + food_vegan: I am vegan housing_none: I don't need a place to stay housing_tent: I would like a place to tent housing_house: Yes, I would like to place to stay 'yes': 'Yes' 'no': 'No' + maybe: Maybe review: Complete back: Back upload: Upload diff --git a/db/schema.rb b/db/schema.rb index c1cf700..a15874c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170422222529) do +ActiveRecord::Schema.define(version: 20170602051457) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -183,6 +183,7 @@ ActiveRecord::Schema.define(version: 20170422222529) do t.boolean "is_public" t.boolean "is_featured" t.json "provider_conditions" + t.text "group_ride_info" end create_table "delayed_jobs", force: :cascade do |t| diff --git a/features/registration.feature b/features/registration.feature index 52441c1..c8d6ee7 100644 --- a/features/registration.feature +++ b/features/registration.feature @@ -1,7 +1,8 @@ Feature: Registration - Scenario: Registration can really happen + Scenario: Attendees can register as expected Given there is an upcoming conference in 'Brooklyn NY' And registration is open + And there is an organization named 'Bike Works' in Seattle And I am on the landing page Then I should see a 'Register' link @@ -16,74 +17,111 @@ Feature: Registration And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - But I should not see the 'Contact Info' link - And I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link - - When I click on the 'I Agree' button + Then I should see 'Policy' + And I should see 'The Agreement' + And see 'Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all' + + When I check commitment + And check respect + And check empowerment + And check accessible + And check peaceful + And check spaces + And check hearing + And check intent + And check open minds + And check learning + And click on the 'I Agree' button Then I should see 'What is your name?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - But I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link When I enter my name - And fill in my location with 'Seattle' - And click the 'Next' button - Then I should see 'Do you need a place to stay?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - But I should not see the 'Donation' link - And I should not see the 'Workshops' link - - And I should see 'Your location was corrected from "Seattle" to "Seattle, Washington, United States"' - - When I check 'Indoor Location' - And I check 'Yes' - And I check 'Omnivore' - And click the 'Register' button - Then I should see 'Propose a Workshop' - And I should get a 'Thank you for registering for Bike!Bike! 2025' email - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - - And I should not see 'Hosting' - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - And I should see the 'Workshops' link - But I should not see the 'Donation' link + And click the 'Next' button + Then I should see 'Which languages do you speak?' - Scenario: Housing providers can register + When I click the 'Next' button + Then I should see 'Are you representing a bicycle collective?' + + When I click the 'Yes' button + Then I should see 'In which city or town is your organization based?' + + When I fill in my location with 'Seattle' + And click the 'Next' button + Then I should see 'Did you mean Seattle, Washington, United States?' + + When I click the 'Yes' button + Then I should see 'Which organization are you a member of?' + And I should see 'Bike Works' + And see 'None of the above' + + When I click on the 'Bike Works' button + Then I should see 'Arrival Date' + + When I click on the '25' button + Then I should see 'Departure Date' + + When I click on the '11' button + Then I should see 'Housing' + And see 'Do you need a place to stay' + + When I click on the 'Yes, I would like to place to stay' button + Then I should see 'Housing Companion' + + When I click on the 'Yes' button + Then I should see 'Companion Email' + + When I fill in the email with 'my-friend@bikebike.org' + And click the 'Next' button + Then I should see 'What are your eating habits?' + + When I click on 'I eat meat and dairy' + Then I should see 'Would you like to borrow a bike?' + + When I click on the 'Yes' button + Then I should see 'Do you plan to attend the group ride?' + + When I click on the 'Yes' button + Then I should see 'Anything else?' + + When I fill in other with 'Thanks!' + And click the 'Next' button + Then I should see 'Registration Fee Method' + + When I click on 'pay on arrival' + Then I should see 'Registration Fee Amount' + + When I click on the '$25.00' button + Then I should get a 'Thank you for registering for Bike!Bike! 2025' email + And I should see 'Your registration is complete' + And I should see 'Seattle' + And see 'Bike Works' + And see 'Yes, I would like to place to stay' + And see 'I eat meat and dairy' + And see 'Thanks!' + And see 'In person' + And see '$25.00 USD' + + When I click on 'Cancel my registration' + Then I should see 'You have cancelled your registration' + And I should see 'Re-open my registration' + But I should not see 'Seattle' + And should not see 'Bike Works' + And should not see 'Yes, I would like to place to stay' + And should not see 'I eat meat and dairy' + And should not see 'Thanks!' + And should not see 'In person' + And should not see '$25.00 USD' + + When I click on 'Re-open my registration' + Then I should see 'Your registration is complete' + And I should see 'Seattle' + And see 'Bike Works' + And see 'Yes, I would like to place to stay' + And see 'I eat meat and dairy' + And see 'Thanks!' + And see 'In person' + And see '$25.00 USD' + + Scenario: Attendees can add a new organization Given there is an upcoming conference in 'Brooklyn NY' And registration is open And I am on the landing page @@ -100,74 +138,71 @@ Feature: Registration And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - But I should not see the 'Contact Info' link - And I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link - - When I click on the 'I Agree' button + Then I should see 'Policy' + And I should see 'The Agreement' + And see 'Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all' + + When I check commitment + And check respect + And check empowerment + And check accessible + And check peaceful + And check spaces + And check hearing + And check intent + And check open minds + And check learning + And click on the 'I Agree' button Then I should see 'What is your name?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - But I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link When I enter my name - And fill in my location with 'Brooklyn' - And click the 'Next' button - Then I should see 'Can you provide housing to attendees visiting the city?' - And I should not see 'Do you need a place to stay?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Hosting' - And see 'Workshops' - But I should not see 'Your Visit' - And I should not see 'Donation' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Hosting' link - But I should not see the 'Donation' link - And I should not see the 'Workshops' link - - And I should see 'Your location was corrected from "Brooklyn" to "Brooklyn, New York, United States"' - And I should see 'I can provide housing' - But I should not see 'Your address and phone number will be shared with your guests and conference organizers' - - When I check 'I can provide housing' - Then I should see 'Your address and phone number will be shared with your guests and conference organizers' + And click the 'Next' button + Then I should see 'Which languages do you speak?' - When I enter my address - And enter my phone - And enter my bed space as '2' - When I press the 'Next' button - Then I should get a 'Thank you for registering for Bike!Bike! 2025' email - And I should see 'Propose a Workshop' + When I click the 'Next' button + Then I should see 'Are you representing a bicycle collective?' + + When I click the 'Yes' button + Then I should see 'In which city or town is your organization based?' + + When I fill in my location with 'Moncton' + And click the 'Next' button + Then I should see 'Did you mean Moncton, New Brunswick, Canada?' + + When I click the 'Yes' button + Then I should see 'What is the name or your organization?' + + When I fill in the name with 'Coopérative La Bikery Cooperative' + And click the 'Next' button + Then I should see 'Organization Address' + + When I fill in the address with '120 Assomption Blvd' + And click the 'Next' button + Then I should see 'Organization Email' - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Hosting' link - And I should see the 'Workshops' link - But I should not see the 'Donation' link + When I fill in the email with 'labikery@bikebike.org' + And click the 'Next' button + Then I should see 'Organization Mailing Address' + + When I fill in the mailing address with '120 Assomption Blvd' + And click the 'Next' button + And click on the '25' button + And click on the '11' button + And click on the 'I don't need a place to stay' button + And click on 'I am vegan' + And click on the 'No' button + And click on the 'No' button + And click the 'Next' button + And click on 'pay now with PayPal' + And click on the '$25.00' button + And click the 'Confirm' button + Then I should get a 'Thank you for registering for Bike!Bike! 2025' email + And I should see 'Moncton' + And I should see 'Coopérative La Bikery Cooperative' + And I should see 'I don't need a place to stay' + And I should see 'I am vegan' - Scenario: Housing providers who are not intending to register can register + Scenario: Attendees can register without being a member of an organization Given there is an upcoming conference in 'Brooklyn NY' And registration is open And I am on the landing page @@ -184,76 +219,56 @@ Feature: Registration And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - But I should not see the 'Contact Info' link - And I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link - - When I click on the 'I Agree' button + Then I should see 'Policy' + And I should see 'The Agreement' + And see 'Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all' + + When I check commitment + And check respect + And check empowerment + And check accessible + And check peaceful + And check spaces + And check hearing + And check intent + And check open minds + And check learning + And click on the 'I Agree' button Then I should see 'What is your name?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - But I should not see 'Donation' - And I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - But I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link When I enter my name - And fill in my location with 'Brooklyn' - And click the 'Next' button - Then I should see 'Can you provide housing to attendees visiting the city?' - And I should not see 'Do you need a place to stay?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Hosting' - And see 'Workshops' - But I should not see 'Your Visit' - And I should not see 'Donation' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Hosting' link - But I should not see the 'Donation' link - And I should not see the 'Workshops' link - - And I should see 'Your location was corrected from "Brooklyn" to "Brooklyn, New York, United States"' - And I should see 'I can provide housing' - But I should not see 'Your address and phone number will be shared with your guests and conference organizers' - - When I check 'I can provide housing' - Then I should see 'Your address and phone number will be shared with your guests and conference organizers' + And click the 'Next' button + Then I should see 'Which languages do you speak?' - When I enter my address - And enter my phone - And enter my bed space as '2' - And check 'I will not be attending the conference' - When I press the 'Next' button - Then I should get a 'Thank you for registering for Bike!Bike! 2025' email - And I should not see 'Propose a Workshop' - But I should see 'Can you provide housing to attendees visiting the city?' + When I click the 'Next' button + Then I should see 'Are you representing a bicycle collective?' - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Hosting' link - And I should not see the 'Workshops' link - But I should not see the 'Donation' link + When I click the 'No' button + Then I should see 'In which city or town are you based?' + + When I fill in my location with 'Ecum Secum' + And click the 'Next' button + Then I should see 'Did you mean Ecum Secum, Nova Scotia, Canada?' + + When I click the 'Yes' button + Then I should see 'Why are you interested in attending Bike!Bike!?' + + When I fill in my interest with 'Because Reasons' + And click the 'Next' button + And click on the '25' button + And click on the '11' button + And click on the 'I would like a place to tent' button + And click on 'I am vegetarian' + And click on the 'Yes' button + And click on the 'No' button + And click the 'Next' button + And click on the 'Not now' button + Then I should get a 'Thank you for registering for Bike!Bike! 2025' email + And I should see 'Ecum Secum' + And I should see 'Because Reasons' + And I should see 'I am vegetarian' - Scenario: Users who live in neighbouring towns cannot be hosts by default + Scenario: Housing providers can register Given there is an upcoming conference in 'Brooklyn NY' And registration is open And I am on the landing page @@ -262,6 +277,7 @@ Feature: Registration When I click the 'Register' link Then I should be on the register page + And I should see 'Registration is now open' When I enter my email address And press confirm email @@ -269,48 +285,90 @@ Feature: Registration And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - - When I click on the 'I Agree' button + Then I should see 'Policy' + And I should see 'The Agreement' + And see 'Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all' + + When I check commitment + And check respect + And check empowerment + And check accessible + And check peaceful + And check spaces + And check hearing + And check intent + And check open minds + And check learning + And click on the 'I Agree' button Then I should see 'What is your name?' When I enter my name - And fill in my location with 'Newark NJ' And click the 'Next' button - Then I should not see 'Can you provide housing to attendees visiting the city?' + Then I should see 'Which languages do you speak?' - Scenario: Users who live in neighbouring towns can be housing providers if a radius is entered - Given there is an upcoming conference in 'Brooklyn NY' - And the conference accepts housing providers that live within 100km - And registration is open - And I am on the landing page + When I click the 'Next' button + Then I should see 'Are you representing a bicycle collective?' - Then I should see a 'Register' link + When I click the 'No' button + Then I should see 'In which city or town are you based?' + + When I fill in my location with 'Brooklyn' + And click the 'Next' button + Then I should see 'Did you mean Brooklyn, New York, United States?' + + When I click the 'Yes' button + Then I should see 'Are you willing to be a housing provider?' - When I click the 'Register' link - Then I should be on the register page - And I should see 'Registration is now open' + When I click the 'Yes' button + Then I should see 'Are you attending the conference?' - When I enter my email address - And press confirm email - Then I should see 'Confirm Email' - And I should get a 'confirmation' email + When I click the 'No' button + Then I should see 'What is your address?' - When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' + When I enter my address + And click the 'Next' button + Then I should see 'What is your phone number?' - When I click on the 'I Agree' button - Then I should see 'What is your name?' + When I enter my phone number + And click the 'Next' button + Then I should see 'Bed and Couch Space' - When I enter my name - And fill in my location with 'Newark' + When I fill in bed space with '2' And click the 'Next' button - Then I should see 'Can you provide housing to attendees visiting the city?' + Then I should see 'Floor Space' + + When I fill in floor space with '8' + And click the 'Next' button + Then I should see 'Tent Space' + + When I click the 'Yes' button + Then I should see 'Housing Start Date' + + When I click on the '25' button + Then I should see 'Housing End Date' + + When I click on the '11' button + Then I should see 'House Info and Rules' - Scenario: Users can pay for registration + When I enter some info + And click the 'Next' button + Then I should see 'Information for organizers' + + When I fill in other with 'We have children in our household' + And click the 'Next' button + + Then I should see 'Your registration is complete' + And I should see my address + And I should see 'We have children in our household' + + Scenario: Attendees can enter incorrect data and fix it Given there is an upcoming conference in 'Brooklyn NY' - And the conference accepts paypal And registration is open + And there is an organization named 'Coopérative La Bikery Cooperative' in Moncton + And 'joe@bikebike.org' is registered + And 'sally@bikebike.org' is registered + And 'Jesse@bikebike.org' is registered + And 'joe@bikebike.org' and 'sally@bikebike.org' are companions And I am on the landing page Then I should see a 'Register' link @@ -319,100 +377,161 @@ Feature: Registration Then I should be on the register page And I should see 'Registration is now open' - When I enter my email address + When I enter my email address as 'me@bikebike.org' And press confirm email Then I should see 'Confirm Email' And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - But I should not see the 'Contact Info' link - And I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link + Then I should see 'Policy' + And I should see 'The Agreement' + And see 'Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all' When I click on the 'I Agree' button + Then I should see 'Read each statement carefully' + + When I check commitment + And click the 'I Agree' button + Then I should see 'Read each statement carefully' + + When check respect + And check empowerment + And check accessible + And check peaceful + And check spaces + And check hearing + And check intent + And check open minds + And check learning + And click on the 'I Agree' button Then I should see 'What is your name?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - But I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link + + When I click the 'Next' button + Then I should see 'Provide us with a name' When I enter my name - And fill in my location with 'Seattle' - And click the 'Next' button - Then I should see 'Do you need a place to stay?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - But I should not see the 'Donation' link - And I should not see the 'Workshops' link - - And I should see 'Your location was corrected from "Seattle" to "Seattle, Washington, United States"' - - When I check 'Indoor Location' - And I check 'Yes' - And I check 'Omnivore' - And click the 'Register' button - Then I should see 'Registration Fees' - And I should get a 'Thank you for registering for Bike!Bike! 2025' email - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - - And I should not see 'Hosting' - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - And I should see the 'Donation' link - But I should not see the 'Workshops' link - - And I should see '$25.00' - And I should see '$50.00' - And I should see '$100.00' - And I should see 'Custom amount' - And I should see 'Skip' - - When I click the '$50.00' button - And finish with paypal - Then I should see 'Please confirm your payment' - And see 'You are about to confirm your payment of $50.00 for registration' - - When I click the 'Confirm' button - Then I should see 'You have made a payment of $50.00' - And see 'Thank you!' - - When I click the 'Skip' button - Then I should see 'Propose a Workshop' - - Scenario: Users can fail to pay for registration + And click the 'Next' button + Then I should see 'Which languages do you speak?' + + When I uncheck 'English' + And I click the 'Next' button + Then I should see 'Select at least one language' + + When I click the 'Next' button + Then I should see 'Are you representing a bicycle collective?' + + When I click the 'Yes' button + Then I should see 'In which city or town is your organization based?' + + When click the 'Next' button + Then I should see 'Enter a location' + + When I fill in my location with 'fhqwhgads' + And click the 'Next' button + Then I should see 'We could not find a city' + + When I fill in my location with 'Moncton' + And click the 'Next' button + And click the 'Yes' button + Then I should see 'Which organization are you a member of?' + + When I click the 'None of the above' button + Then I should see 'What is the name or your organization?' + + When I click the 'Next' button + Then I should see 'Enter the name of your organization' + + When I fill in the name with 'Coopérative La Bikery Cooperative' + And click the 'Next' button + Then I should see 'Organization Address' + + When click the 'Next' button + Then I should see 'Enter an address' + + When I fill in the address with '120 Assomption Blvd' + And click the 'Next' button + Then I should see 'Organization Email' + + When I click the 'Next' button + Then I should see 'email address is required' + + When I fill in the email with 'me@bikebike.org' + And I click the 'Next' button + Then I should see 'email address matches your personal email address' + + When I fill in the email with 'labikery@bikebike.org' + And click the 'Next' button + Then I should see 'Organization Mailing Address' + + When I fill in the mailing address with '' + And click the 'Next' button + Then I should see 'Enter your organization's mailing address' + + When I fill in the mailing address with '120 Assomption Blvd' + And click the 'Next' button + Then I should see 'Arrival Date' + + When I click the '31' button + And click the '30' button + Then I should see 'departure date that is before your arrival' + + When I click the '4' button + Then I should see 'Do you need a place to stay in Brooklyn?' + + When I click on the 'Yes, I would like to place to stay' button + Then I should see 'Housing Companion' + + When I click on the 'Yes' button + And click the 'Next' button + Then I should see 'Enter an email address' + + When I fill in the email with 'joe@bikebike.org' + And click the 'Next' button + Then I should see 'already has a companion' + + When I fill in the email with 'jesse@bikebike.org' + And click the 'Next' button + Then I should see 'Your companion has completed their registration' + And see 'What are your eating habits?' + + When click on 'I eat meat and dairy' + And I click on the 'Yes' button + And I click on the 'Yes' button + And click the 'Next' button + And I click on 'pay now with PayPal' + And fill in the custom value with '-1' + And click the 'Custom amount' button + Then I should see 'Enter a positive amount' + + When fill in the custom value with '1' + But my payment status will be 'Denied' + And click the 'Custom amount' button + And click the 'Confirm' button + Then I should see 'Your payment was denied' + And I should see 'Registration Fee Amount' + + When fill in the custom value with '1' + But my payment status will be 'Error' + And click the 'Custom amount' button + And click the 'Confirm' button + Then I should see 'An unexpected error occurred' + And I should see 'Registration Fee Amount' + + When fill in the custom value with '1' + And click the 'Custom amount' button + And click the 'Cancel' button + Then I should see 'Your payment was cancelled' + And I should see 'Registration Fee Amount' + + When fill in the custom value with '1' + And my payment status will be 'Pending' + And click the 'Custom amount' button + And click the 'Confirm' button + Then I should see 'Your payment is currently pending' + And I should see 'Your registration is complete' + +Scenario: Housing providers can enter incorrect data and fix it Given there is an upcoming conference in 'Brooklyn NY' - And the conference accepts paypal And registration is open And I am on the landing page @@ -428,179 +547,94 @@ Feature: Registration And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - But I should not see the 'Contact Info' link - And I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link - - When I click on the 'I Agree' button + Then I should see 'Policy' + And I should see 'The Agreement' + And see 'Ensuring that all attendees feel welcome, safe, and respected at all times is especially important to us all' + + When I check commitment + And check respect + And check empowerment + And check accessible + And check peaceful + And check spaces + And check hearing + And check intent + And check open minds + And check learning + And click on the 'I Agree' button Then I should see 'What is your name?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - But I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link When I enter my name - And fill in my location with 'Seattle' - And click the 'Next' button - Then I should see 'Do you need a place to stay?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - But I should not see the 'Donation' link - And I should not see the 'Workshops' link - - And I should see 'Your location was corrected from "Seattle" to "Seattle, Washington, United States"' - - When I check 'Indoor Location' - And I check 'Yes' - And I check 'Omnivore' - And click the 'Register' button - Then I should see 'Registration Fees' - And I should get a 'Thank you for registering for Bike!Bike! 2025' email - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - - And I should not see 'Hosting' - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - And I should see the 'Donation' link - But I should not see the 'Workshops' link - - And I should see '$25.00' - And I should see '$50.00' - And I should see '$100.00' - And I should see 'Custom amount' - And I should see 'Skip' - - When I click the '$50.00' button - But I don't finish with paypal - Then I should see 'Please confirm your payment' - Then I should see 'Registration Fees' - And see 'You are about to confirm your payment of $50.00 for registration' - - When I click the 'Confirm' button - Then I should not see 'You have made a payment of $50.00' - But I should see 'Your payment was not completed' - - Scenario: Users can decide not to pay for registration - Given there is an upcoming conference in 'Brooklyn NY' - And the conference accepts paypal - And registration is open - And I am on the landing page + And click the 'Next' button + Then I should see 'Which languages do you speak?' - Then I should see a 'Register' link + When I click the 'Next' button + Then I should see 'Are you representing a bicycle collective?' + + When I click the 'No' button + Then I should see 'In which city or town are you based?' + + When I fill in my location with 'Brooklyn' + And click the 'Next' button + Then I should see 'Did you mean Brooklyn, New York, United States?' + + When I click the 'Yes' button + Then I should see 'Are you willing to be a housing provider?' - When I click the 'Register' link - Then I should be on the register page - And I should see 'Registration is now open' + When I click the 'Yes' button + Then I should see 'Are you attending the conference?' - When I enter my email address - And press confirm email - Then I should see 'Confirm Email' - And I should get a 'confirmation' email + When I click the 'No' button + Then I should see 'What is your address?' - When I click on the 'Confirm' link in the email - Then I should see 'Safer Space Agreement' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' + When I fill in my address with '' + And click the 'Next' button + Then I should see 'Enter an address' - And I should see the 'Policy' link - But I should not see the 'Contact Info' link - And I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link + When I enter my address + And click the 'Next' button + Then I should see 'What is your phone number?' + + When I fill in my phone with '911' + And click the 'Next' button + Then I should see 'A valid phone number is required' - When I click on the 'I Agree' button - Then I should see 'What is your name?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - But I should not see the 'Your Visit' link - And I should not see the 'Donation' link - And I should not see the 'Workshops' link + When I enter my phone number + And click the 'Next' button + Then I should see 'Bed and Couch Space' - When I enter my name - And fill in my location with 'Seattle' - And click the 'Next' button - Then I should see 'Do you need a place to stay?' - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - But I should not see 'Hosting' - - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - But I should not see the 'Donation' link - And I should not see the 'Workshops' link - - And I should see 'Your location was corrected from "Seattle" to "Seattle, Washington, United States"' - - When I check 'Indoor Location' - And I check 'Yes' - And I check 'Omnivore' - And click the 'Register' button - Then I should see 'Registration Fees' - And I should get a 'Thank you for registering for Bike!Bike! 2025' email - And I should see 'Policy' - And see 'Contact Info' - And see 'Your Visit' - And see 'Workshops' - And see 'Donation' - - And I should not see 'Hosting' - And I should see the 'Policy' link - And I should see the 'Contact Info' link - And I should see the 'Your Visit' link - And I should see the 'Donation' link - But I should not see the 'Workshops' link - - And I should see '$25.00' - And I should see '$50.00' - And I should see '$100.00' - And I should see 'Custom amount' - And I should see 'Skip' - - When I click the 'Skip' button - Then I should see 'Propose a Workshop' + When I fill in bed space with '' + And click the 'Next' button + Then I should see 'Enter the amount of bed or couch space' + + When I fill in bed space with '2' + And click the 'Next' button + Then I should see 'Floor Space' + + When I fill in floor space with '' + And click the 'Next' button + Then I should see 'Enter the amount of floor space' + + When I fill in floor space with '8' + And click the 'Next' button + Then I should see 'Tent Space' + + When I click the 'Yes' button + Then I should see 'Housing Start Date' + + When I click the '31' button + And click the '30' button + Then I should see 'end date that is before your start date' + + When I click the '4' button + Then I should see 'House Info and Rules' + + When I click the 'Next' button + Then I should see 'Provide your guests with information' + + When I enter some info + And click the 'Next' button + Then I should see 'Information for organizers' + + When I click the 'Next' button + Then I should see 'Your registration is complete' diff --git a/features/step_definitions/conferences.rb b/features/step_definitions/conferences.rb index 7b0dc03..8b5f7f6 100644 --- a/features/step_definitions/conferences.rb +++ b/features/step_definitions/conferences.rb @@ -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 diff --git a/features/step_definitions/interface_steps.rb b/features/step_definitions/interface_steps.rb index 86b86cb..395bb74 100644 --- a/features/step_definitions/interface_steps.rb +++ b/features/step_definitions/interface_steps.rb @@ -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 diff --git a/features/step_definitions/registration.rb b/features/step_definitions/registration.rb index 129e8f4..e27821a 100644 --- a/features/step_definitions/registration.rb +++ b/features/step_definitions/registration.rb @@ -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)). diff --git a/features/support/factory_girl.rb b/features/support/factory_girl.rb index d348a4b..5efb5b9 100644 --- a/features/support/factory_girl.rb +++ b/features/support/factory_girl.rb @@ -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 diff --git a/features/support/helper.rb b/features/support/helper.rb index 822c437..3171da5 100644 --- a/features/support/helper.rb +++ b/features/support/helper.rb @@ -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 diff --git a/features/support/location_cache.yml b/features/support/location_cache.yml index 9badcd9..431cc5c 100644 --- a/features/support/location_cache.yml +++ b/features/support/location_cache.yml @@ -49,175 +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 - 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 - types: - - administrative_area_level_1 - - political - - long_name: United States - short_name: US - types: - - country - - political - formatted_address: New Orleans, LA, USA - geometry: - bounds: - northeast: - lat: 30.199332 - lng: -89.625053 - southwest: - lat: 29.8666609 - lng: -90.14007389999999 - location: - lat: 29.95106579999999 - lng: -90.0715323 - location_type: APPROXIMATE - viewport: - northeast: - lat: 30.1748625 - lng: -89.6269311 - 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 + - long_name: King County + short_name: King County types: - administrative_area_level_2 - political - - long_name: Oregon - short_name: OR + - long_name: Washington + short_name: WA types: - administrative_area_level_1 - political @@ -226,277 +72,27 @@ Portland OR: !ruby/object:Geocoder::Result::Google 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 + formatted_address: Seattle, WA, USA geometry: bounds: northeast: - lat: 24.3379838 - lng: -107.3476352 + lat: 47.734145 + lng: -122.2244331 southwest: - lat: 24.3108689 - lng: -107.3831387 + lat: 47.4919119 + lng: -122.4596959 location: - lat: 24.3240714 - lng: -107.3584174 + lat: 47.6062095 + lng: -122.3320708 location_type: APPROXIMATE viewport: northeast: - lat: 24.3379838 - lng: -107.3476352 + lat: 47.734145 + lng: -122.2359033 southwest: - lat: 24.3108689 - lng: -107.3831387 - place_id: ChIJv33Pqm0ho4YRUQ45wKAluZ4 + lat: 47.4955511 + lng: -122.4359086 + place_id: ChIJVTPokywQkFQRmtVEaUZlJRA types: - locality - political diff --git a/features/workshops.feature b/features/workshops.feature index 79c91ef..123ea7f 100644 --- a/features/workshops.feature +++ b/features/workshops.feature @@ -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