diff --git a/lms/djangoapps/courseware/features/openended.feature b/lms/djangoapps/courseware/features/openended.feature new file mode 100644 index 0000000000..4b6b684349 --- /dev/null +++ b/lms/djangoapps/courseware/features/openended.feature @@ -0,0 +1,21 @@ +Feature: Open ended grading + As a student in an edX course + In order to complete the courseware questions + I want the machine learning grading to be functional + + Scenario: I can submit an answer for instructor grading + Given I am registered for course "MITx/3.091x/2012_Fall" + And I log in + And I navigate to an openended question + When I enter the answer "I have no idea." + And I press the "Check" button + Then I see the grader status "Submitted for grading" + And I see the grader message "Feedback not yet available." + + Scenario: I can submit an answer for instructor grading + Given I am staff for course "MITx/3.091x/2012_Fall" + And I log in + And I navigate to an openended question + When I submit the answer "I love Chemistry." + And I visit the staff grading page + Then my answer is queued for instructor grading \ No newline at end of file diff --git a/lms/djangoapps/courseware/features/openended.py b/lms/djangoapps/courseware/features/openended.py new file mode 100644 index 0000000000..629318fc40 --- /dev/null +++ b/lms/djangoapps/courseware/features/openended.py @@ -0,0 +1,43 @@ +from lettuce import world, step +from lettuce.django import django_url +from nose.tools import assert_equals, assert_in + +@step('I navigate to an openended question$') +def navigate_to_an_openended_question(step): + problem = '/courses/MITx/3.091x/2012_Fall/courseware/Week_10/Polymer_Synthesis/' + world.browser.visit(django_url(problem)) + tab_css = 'ol#sequence-list > li > a[data-element="5"]' + world.browser.find_by_css(tab_css).click() + +@step(u'I enter the answer "([^"]*)"') +def enter_the_answer_text(step, text): + textarea_css = 'textarea' + world.browser.find_by_css(textarea_css).first.fill(text) + +@step(u'I see the grader message "([^"]*)"$') +def see_grader_message(step, msg): + message_css = 'div.external-grader-message' + grader_msg = world.browser.find_by_css(message_css).text + assert_in(msg, grader_msg) + +@step(u'I see the grader status "([^"]*)"') +def see_the_grader_status(step, status): + status_css = 'div.grader-status' + grader_status = world.browser.find_by_css(status_css).text + assert_equals(status, grader_status) + +@step(u'I submit the answer "([^"]*)"$') +def i_submit_the_answer_text(step, text): + textarea_css = 'textarea' + world.browser.find_by_css(textarea_css).first.fill(text) + check_css = 'input.check' + world.browser.find_by_css(check_css).click() + +@step(u'I visit the staff grading page$') +def i_visit_the_staff_grading_page(step): + course_u = '/courses/MITx/3.091x/2012_Fall' + world.browser.visit(django_url('%s/staff_grading' % course_u)) + +@step(u'my answer is queued for instructor grading') +def answer_is_queued_for_instructor_grading(step): + assert False, 'This step must be implemented' \ No newline at end of file diff --git a/lms/djangoapps/terrain/common.py b/lms/djangoapps/terrain/common.py index 2224bb1b9e..f7393da471 100644 --- a/lms/djangoapps/terrain/common.py +++ b/lms/djangoapps/terrain/common.py @@ -40,6 +40,11 @@ def i_am_on_the_courses_page(step): world.browser.visit(django_url('/courses')) assert world.browser.is_element_present_by_css('section.courses') +@step(u'I press the "([^"]*)" button$') +def and_i_press_the_button(step, value): + button_css = 'input[value="%s"]' % value + world.browser.find_by_css(button_css).first.click() + @step('I should see that the path is "([^"]*)"$') def i_should_see_that_the_path_is(step, path): assert world.browser.url == django_url(path) @@ -69,6 +74,14 @@ def i_am_registered_for_course_by_id(step, course_id): u = User.objects.get(username='robot') CourseEnrollment.objects.get_or_create(user=u, course_id=course_id) +@step('I am staff for course "([^"]*)"$') +def i_am_staff_for_course_by_id(step, course_id): + create_user('robot') + u = User.objects.get(username='robot') + u.is_staff=True + u.save() + CourseEnrollment.objects.get_or_create(user=u, course_id=course_id) + @step('I log in$') def i_log_in(step): log_in('robot@edx.org','test') diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index bfcc1faaa3..73d380528f 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -11,6 +11,16 @@ INSTALLED_APPS = tuple(e for e in INSTALLED_APPS if e != 'debug_toolbar') MIDDLEWARE_CLASSES = tuple(e for e in MIDDLEWARE_CLASSES \ if e != 'debug_toolbar.middleware.DebugToolbarMiddleware') +########################### OPEN GRADING TESTING ########################## +XQUEUE_INTERFACE = { + "url": 'http://127.0.0.1:3032', + "django_auth": { + "username": "lms", + "password": "abcd" + }, + "basic_auth": ('anant', 'agarwal'), +} + ########################### LETTUCE TESTING ########################## MITX_FEATURES['DISPLAY_TOY_COURSES'] = True