From fc67c2ee6b837a36750395f0825c580e10815359 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 10:36:12 -0400 Subject: [PATCH 1/6] Wrote preliminary help modal acceptance tests --- .../courseware/features/help.feature | 28 ++++++++++++++++ lms/djangoapps/courseware/features/help.py | 33 +++++++++++++++++++ lms/envs/acceptance.py | 3 ++ 3 files changed, 64 insertions(+) create mode 100644 lms/djangoapps/courseware/features/help.feature create mode 100644 lms/djangoapps/courseware/features/help.py diff --git a/lms/djangoapps/courseware/features/help.feature b/lms/djangoapps/courseware/features/help.feature new file mode 100644 index 0000000000..83dd50a3cf --- /dev/null +++ b/lms/djangoapps/courseware/features/help.feature @@ -0,0 +1,28 @@ +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 click the help modal + And I report a "problem" + And I fill "name" with "Robot" + And I fill "email" with "Robot@edx.org" + And I fill "subject" with "Test Issue" + And I fill "details" with "I am having a problem" + And I submit the issue + Then The submit button should be disabled + + Scenario: I can submit a problem when I am logged in + Given I am registered for the course "6.002x" + And I am logged in + And I click on View Courseware + When I click the help modal + And I report a "problem" + And I fill "subject" with "Test Issue" + And I fill "details" with "I am having a problem" + And I submit the issue + Then The submit button should be disabled + diff --git a/lms/djangoapps/courseware/features/help.py b/lms/djangoapps/courseware/features/help.py new file mode 100644 index 0000000000..66647644ac --- /dev/null +++ b/lms/djangoapps/courseware/features/help.py @@ -0,0 +1,33 @@ +#pylint: disable=C0111 +#pylint: disable=W0621 + +from lettuce import world, step + +@step(u'I click the help modal') +def open_help_modal(step): + help_css = 'div.help-tab' + world.css_click(help_css) + + +@step(u'I report a "([^"]*)"$') +def select_problem_type(step, submission_type): + type_css = '#feedback_link_{}'.format(submission_type) + world.css_click(type_css) + + +@step(u'I fill "([^"]*)" with "([^"]*)"$') +def fill_field(step, name, info): + form_css = 'form.feedback_form' + form = world.css_find(form_css) + form.find_by_name(name).fill(info) + + +@step(u'I submit the issue') +def submit_issue(step): + submit_css = 'div.submit' + world.css_click(submit_css) + + +@step(u'The submit button should be disabled') +def see_confirmation(step): + assert world.browser.evaluate_script("$('input[value=\"Submit\"]').attr('disabled')") == 'disabled' 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',) From 97f70e85988a684c42ee7386809e8e325bf334af Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 10:52:20 -0400 Subject: [PATCH 2/6] Fixed wording to better reflect BDD specs --- .../courseware/features/help.feature | 22 +++----- lms/djangoapps/courseware/features/help.py | 54 ++++++++++++------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/lms/djangoapps/courseware/features/help.feature b/lms/djangoapps/courseware/features/help.feature index 83dd50a3cf..beb69de7c0 100644 --- a/lms/djangoapps/courseware/features/help.feature +++ b/lms/djangoapps/courseware/features/help.feature @@ -6,23 +6,13 @@ Feature: The help module should work Scenario: I can submit a problem when I am not logged in Given I visit the homepage - When I click the help modal + When I open the help form And I report a "problem" - And I fill "name" with "Robot" - And I fill "email" with "Robot@edx.org" - And I fill "subject" with "Test Issue" - And I fill "details" with "I am having a problem" - And I submit the issue - Then The submit button should be disabled + Then I should see confirmation that the problem was received Scenario: I can submit a problem when I am logged in - Given I am registered for the course "6.002x" - And I am logged in - And I click on View Courseware - When I click the help modal - And I report a "problem" - And I fill "subject" with "Test Issue" - And I fill "details" with "I am having a problem" - And I submit the issue - Then The submit button should be disabled + Given I am in a course + When I open the help form + And I report a "problem" without saying who I am + Then I should see confirmation that the problem was received diff --git a/lms/djangoapps/courseware/features/help.py b/lms/djangoapps/courseware/features/help.py index 66647644ac..6cf1b852b1 100644 --- a/lms/djangoapps/courseware/features/help.py +++ b/lms/djangoapps/courseware/features/help.py @@ -3,31 +3,47 @@ from lettuce import world, step -@step(u'I click the help modal') +@step(u'I open the help form') def open_help_modal(step): - help_css = 'div.help-tab' - world.css_click(help_css) + help_css = 'div.help-tab' + world.css_click(help_css) @step(u'I report a "([^"]*)"$') -def select_problem_type(step, submission_type): - type_css = '#feedback_link_{}'.format(submission_type) - world.css_click(type_css) +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 fill "([^"]*)" with "([^"]*)"$') -def fill_field(step, name, info): - form_css = 'form.feedback_form' - form = world.css_find(form_css) - form.find_by_name(name).fill(info) +@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 submit the issue') -def submit_issue(step): - submit_css = 'div.submit' - world.css_click(submit_css) - - -@step(u'The submit button should be disabled') +@step(u'I should see confirmation that the problem was received') def see_confirmation(step): - assert world.browser.evaluate_script("$('input[value=\"Submit\"]').attr('disabled')") == 'disabled' + assert world.browser.evaluate_script("$('input[value=\"Submit\"]').attr('disabled')") == 'disabled' + + +@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 fill_field(name, info): + form_css = 'form.feedback_form' + form = world.css_find(form_css) + form.find_by_name(name).fill(info) From 967fdee6bc8b428136ea9d1e568ffbe0dd46445f Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 10:55:14 -0400 Subject: [PATCH 3/6] Made filling field a bit safer --- lms/djangoapps/courseware/features/help.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/features/help.py b/lms/djangoapps/courseware/features/help.py index 6cf1b852b1..87397f5bc8 100644 --- a/lms/djangoapps/courseware/features/help.py +++ b/lms/djangoapps/courseware/features/help.py @@ -44,6 +44,8 @@ def go_into_course(step): def fill_field(name, info): - form_css = 'form.feedback_form' - form = world.css_find(form_css) - form.find_by_name(name).fill(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) From 43bee8607403b4a6bf11353e2174f19c8060c8b1 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 11:08:05 -0400 Subject: [PATCH 4/6] Tightened up wording --- lms/djangoapps/courseware/features/help.feature | 4 ++-- lms/djangoapps/courseware/features/help.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/features/help.feature b/lms/djangoapps/courseware/features/help.feature index beb69de7c0..ff381c666b 100644 --- a/lms/djangoapps/courseware/features/help.feature +++ b/lms/djangoapps/courseware/features/help.feature @@ -8,11 +8,11 @@ Feature: The help module should work Given I visit the homepage When I open the help form And I report a "problem" - Then I should see confirmation that the problem was received + Then I should see confirmation that the issue was received 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 "problem" without saying who I am - Then I should see confirmation that the problem was received + Then I should see confirmation that the issue was received diff --git a/lms/djangoapps/courseware/features/help.py b/lms/djangoapps/courseware/features/help.py index 87397f5bc8..a426caa910 100644 --- a/lms/djangoapps/courseware/features/help.py +++ b/lms/djangoapps/courseware/features/help.py @@ -31,7 +31,7 @@ def submit_partial_problem_type(step, submission_type): world.css_click(submit_css) -@step(u'I should see confirmation that the problem was received') +@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' From fc899ab116206ad64381f2abefb88bc99dbb4999 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 15:30:35 -0400 Subject: [PATCH 5/6] Stylistic change and factored out method to common --- lms/djangoapps/courseware/features/common.py | 7 +++++++ lms/djangoapps/courseware/features/help.py | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) 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.py b/lms/djangoapps/courseware/features/help.py index a426caa910..7691328f00 100644 --- a/lms/djangoapps/courseware/features/help.py +++ b/lms/djangoapps/courseware/features/help.py @@ -36,13 +36,6 @@ def see_confirmation(step): assert world.browser.evaluate_script("$('input[value=\"Submit\"]').attr('disabled')") == 'disabled' -@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 fill_field(name, info): def fill_info(): form_css = 'form.feedback_form' From ce5d9b93b1180b216c92a97b37cf19a4ab0dc4b3 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 19 Aug 2013 08:56:55 -0400 Subject: [PATCH 6/6] Added the full range of help modal options Fixed pylint violations --- lms/djangoapps/courseware/features/help.feature | 17 +++++++++++++++-- lms/djangoapps/courseware/features/help.py | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/courseware/features/help.feature b/lms/djangoapps/courseware/features/help.feature index ff381c666b..61305b7cfa 100644 --- a/lms/djangoapps/courseware/features/help.feature +++ b/lms/djangoapps/courseware/features/help.feature @@ -7,12 +7,25 @@ Feature: The help module should work 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 "problem" + 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 "problem" without saying who I am + 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 index 7691328f00..cf566ad95f 100644 --- a/lms/djangoapps/courseware/features/help.py +++ b/lms/djangoapps/courseware/features/help.py @@ -3,6 +3,7 @@ from lettuce import world, step + @step(u'I open the help form') def open_help_modal(step): help_css = 'div.help-tab'