diff --git a/lms/djangoapps/courseware/features/common.py b/lms/djangoapps/courseware/features/common.py index bf58cbc6fe..b69dd4c866 100644 --- a/lms/djangoapps/courseware/features/common.py +++ b/lms/djangoapps/courseware/features/common.py @@ -66,6 +66,13 @@ def add_tab_to_course(_step, course, extra_tab_name): display_name=str(extra_tab_name)) +@step(u'I am in a course$') +def go_into_course(step): + step.given('I am registered for the course "6.002x"') + step.given('And I am logged in') + step.given('And I click on View Courseware') + + def course_id(course_num): return "%s/%s/%s" % (world.scenario_dict['COURSE'].org, course_num, world.scenario_dict['COURSE'].display_name.replace(" ", "_")) diff --git a/lms/djangoapps/courseware/features/help.feature b/lms/djangoapps/courseware/features/help.feature new file mode 100644 index 0000000000..61305b7cfa --- /dev/null +++ b/lms/djangoapps/courseware/features/help.feature @@ -0,0 +1,31 @@ +Feature: The help module should work + In order to get help + As a student + I want to be able to report a problem + + + Scenario: I can submit a problem when I am not logged in + Given I visit the homepage + When I open the help form + And I report a "" + Then I should see confirmation that the issue was received + + Examples: + | FeedbackType | + | problem | + | suggestion | + | question | + + + Scenario: I can submit a problem when I am logged in + Given I am in a course + When I open the help form + And I report a "" without saying who I am + Then I should see confirmation that the issue was received + + Examples: + | FeedbackType | + | problem | + | suggestion | + | question | + diff --git a/lms/djangoapps/courseware/features/help.py b/lms/djangoapps/courseware/features/help.py new file mode 100644 index 0000000000..cf566ad95f --- /dev/null +++ b/lms/djangoapps/courseware/features/help.py @@ -0,0 +1,45 @@ +#pylint: disable=C0111 +#pylint: disable=W0621 + +from lettuce import world, step + + +@step(u'I open the help form') +def open_help_modal(step): + help_css = 'div.help-tab' + world.css_click(help_css) + + +@step(u'I report a "([^"]*)"$') +def submit_problem_type(step, submission_type): + type_css = '#feedback_link_{}'.format(submission_type) + world.css_click(type_css) + fill_field('name', 'Robot') + fill_field('email', 'robot@edx.org') + fill_field('subject', 'Test Issue') + fill_field('details', 'I am having a problem') + submit_css = 'div.submit' + world.css_click(submit_css) + + +@step(u'I report a "([^"]*)" without saying who I am$') +def submit_partial_problem_type(step, submission_type): + type_css = '#feedback_link_{}'.format(submission_type) + world.css_click(type_css) + fill_field('subject', 'Test Issue') + fill_field('details', 'I am having a problem') + submit_css = 'div.submit' + world.css_click(submit_css) + + +@step(u'I should see confirmation that the issue was received') +def see_confirmation(step): + assert world.browser.evaluate_script("$('input[value=\"Submit\"]').attr('disabled')") == 'disabled' + + +def fill_field(name, info): + def fill_info(): + form_css = 'form.feedback_form' + form = world.css_find(form_css) + form.find_by_name(name).fill(info) + world.retry_on_exception(fill_info) diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index f1132557cf..1e188d3b45 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -87,6 +87,9 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True # We do not yet understand why this occurs. Setting this to true is a stopgap measure USE_I18N = True +MITX_FEATURES['ENABLE_FEEDBACK_SUBMISSION'] = True +FEEDBACK_SUBMISSION_EMAIL = 'dummy@example.com' + # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',)