From 97f70e85988a684c42ee7386809e8e325bf334af Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 10:52:20 -0400 Subject: [PATCH] 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)