Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic feature test of survey creation and response #2969

Merged

Conversation

AndrewKvalheim
Copy link
Member

@AndrewKvalheim AndrewKvalheim commented Mar 11, 2022

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the upstream master branch.
  • The tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works (if appropriate).
  • I have added necessary documentation (if appropriate).

Short description of what this resolves

I tried using surveys for the first time and ran into a few issues:

  1. When I click Surveys → New I get a permissions error.
  2. When I click Create Survey I get an error about a missing view.
  3. When I click a date field the date picker doesn’t appear.
  4. When I click Type of Question the form control isn’t focused.
  5. When I view an undated survey I get an error about a failure to determine permissions.
  6. When I respond to a survey nothing appears to happen.

Changes proposed in this pull request

  1. Grant conference organizers permission to manage surveys.
  2. Add the missing view for survey question creation.
  3. Correct the markup of the date pickers.
  4. Associate the form label with its control.
  5. Correct an assumption that surveys always have start and end dates.
  6. Show feedback upon survey response.

@AndrewKvalheim
Copy link
Member Author

  1. When I respond to a survey nothing appears to happen.

I just found #2639 which reports the same problem. Here I chose to do just the minimum of displaying a notification but I agree a full solution would be to redirect to the appropriate list of surveys.

Removes optional attributes from default survey factory.
Resolves:

    Failures:

      1) Survey as an organizer create a survey
         Failure/Error: click_link 'New'

         Capybara::ElementNotFound:
           Unable to find link "New"
         # ./spec/features/surveys_spec.rb:18:in `block (3 levels) in <top (required)>'

    Failed examples:

    rspec ./spec/features/surveys_spec.rb:15 # Survey as an organizer create a survey
Resolves:

    Failures:

      1) Survey as an organizer create a survey
         Failure/Error: raise ActionController::MissingExactTemplate, message

         ActionController::MissingExactTemplate:
           Admin::SurveyQuestionsController#new is missing a template for request formats: text/html
         # <internal:kernel>:90:in `tap'

    Failed examples:

    rspec ./spec/features/surveys_spec.rb:15 # Survey as an organizer create a survey
Resolves:

    app/views/admin/surveys/_form.html.haml:25: warning: key :class is duplicated and overwritten on line 25
    app/views/admin/surveys/_form.html.haml:27: warning: key :class is duplicated and overwritten on line 27
Resolves:

    Failures:

      1) Survey as an organizer create a survey
         Failure/Error: select 'boolean', from: 'Type of Question:', visible: false # Hidden by bootstrap-select

         Capybara::ElementNotFound:
           Unable to find select box "Type of Question:" that is not disabled and Unable to find input box with datalist completion "Type of Question:" that is not disabled
         # ./spec/features/surveys_spec.rb:24:in `block (3 levels) in <top (required)>'
         # ------------------
         # --- Caused by: ---
         # Capybara::ElementNotFound:
         #   Unable to find select box "Type of Question:" that is not disabled
         #   ./spec/features/surveys_spec.rb:24:in `block (3 levels) in <top (required)>'

    Failed examples:

    rspec ./spec/features/surveys_spec.rb:15 # Survey as an organizer create a survey
The logic used for the `:reply` ability incompletely duplicated that of
`Survey#active?` and incorrectly assumed that surveys always have start
and end dates.

Resolves:

    Failures:

      1) Survey as an attendee respond to a survey during registration
         Failure/Error: survey.start_date > Time.current || survey.end_date < Time.current

         ActionView::Template::Error:
           undefined method `>' for nil:NilClass

                 survey.start_date > Time.current || survey.end_date < Time.current
                                   ^
         # ./app/models/ability.rb:126:in `block in signed_in'
         # ./app/views/surveys/show.html.haml:28:in `block in _app_views_surveys_show_html_haml___3404959267043700678_138180'
         # ./app/views/surveys/show.html.haml:19:in `_app_views_surveys_show_html_haml___3404959267043700678_138180'

    Failed examples:

    rspec ./spec/features/surveys_spec.rb:37 # Survey as an attendee respond to a survey during registration
Resolves:

    Failures:

      1) Survey as an attendee respond to a survey during registration
         Failure/Error: expect(flash).to eq('Successfully responded to survey.')

           expected: "Successfully responded to survey."
                got: "none"

           (compared using ==)
         # ./spec/features/surveys_spec.rb:49:in `block (3 levels) in <top (required)>'

    Failed examples:

    rspec ./spec/features/surveys_spec.rb:37 # Survey as an attendee respond to a survey during registration
@AndrewKvalheim
Copy link
Member Author

This now updates the RuboCop to-do list and includes another bug fix for the survey date pickers.

@hennevogel hennevogel merged commit db22aa2 into openSUSE:master Mar 29, 2022
@AndrewKvalheim AndrewKvalheim deleted the test-survey-create-and-respond branch March 30, 2022 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants