diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 41c171c52c..4d117a9c73 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -48,6 +48,8 @@ moved to be edited as metadata. XModule: Only write out assets files if the contents have changed. +Studio: Course settings are now saved explicitly. + XModule: Don't delete generated xmodule asset files when compiling (for instance, when XModule provides a coffeescript file, don't delete the associated javascript) diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index bdf07fc5ae..a65ad3a08f 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -55,6 +55,12 @@ def i_have_opened_a_new_course(_step): open_new_course() +@step('I (save|cancel) my changes$') +def save_changes(step, action): + button_css = '.action-%s' % action + world.css_click(button_css) + + ####### HELPER FUNCTIONS ############## def open_new_course(): world.clear_courses() diff --git a/cms/djangoapps/contentstore/features/course-settings.feature b/cms/djangoapps/contentstore/features/course-settings.feature index e869bfe47a..41ee99336d 100644 --- a/cms/djangoapps/contentstore/features/course-settings.feature +++ b/cms/djangoapps/contentstore/features/course-settings.feature @@ -5,15 +5,18 @@ Feature: Course Settings Given I have opened a new course in Studio When I select Schedule and Details And I set course dates + And I save my changes Then I see the set dates on refresh Scenario: User can clear previously set course dates (except start date) Given I have set course dates And I clear all the dates except start + And I save my changes Then I see cleared dates on refresh Scenario: User cannot clear the course start date Given I have set course dates + And I save my changes And I clear the course start date Then I receive a warning about course start date And The previously set start date is shown on refresh @@ -21,5 +24,13 @@ Feature: Course Settings Scenario: User can correct the course start date warning Given I have tried to clear the course start And I have entered a new course start date + And I save my changes Then The warning about course start date goes away And My new course start date is shown on refresh + + Scenario: Settings are only persisted when saved + Given I have set course dates + And I save my changes + When I change fields + And I cancel my changes + Then I do not see the new changes persisted on refresh diff --git a/cms/djangoapps/contentstore/features/course-settings.py b/cms/djangoapps/contentstore/features/course-settings.py index bd86fff9b7..bcf260de23 100644 --- a/cms/djangoapps/contentstore/features/course-settings.py +++ b/cms/djangoapps/contentstore/features/course-settings.py @@ -47,8 +47,6 @@ def test_and_i_set_course_dates(step): set_date_or_time(COURSE_START_TIME_CSS, DUMMY_TIME) set_date_or_time(ENROLLMENT_END_TIME_CSS, DUMMY_TIME) - pause() - @step('Then I see the set dates on refresh$') def test_then_i_see_the_set_dates_on_refresh(step): @@ -71,8 +69,6 @@ def test_and_i_clear_all_the_dates_except_start(step): set_date_or_time(ENROLLMENT_START_DATE_CSS, '') set_date_or_time(ENROLLMENT_END_DATE_CSS, '') - pause() - @step('Then I see cleared dates on refresh$') def test_then_i_see_cleared_dates_on_refresh(step): @@ -119,7 +115,6 @@ def test_i_have_tried_to_clear_the_course_start(step): @step('I have entered a new course start date$') def test_i_have_entered_a_new_course_start_date(step): set_date_or_time(COURSE_START_DATE_CSS, '12/22/2013') - pause() @step('The warning about course start date goes away$') @@ -137,6 +132,20 @@ def test_my_new_course_start_date_is_shown_on_refresh(step): verify_date_or_time(COURSE_START_TIME_CSS, DUMMY_TIME) +@step('I change fields$') +def test_i_change_fields(step): + set_date_or_time(COURSE_START_DATE_CSS, '7/7/7777') + set_date_or_time(COURSE_END_DATE_CSS, '7/7/7777') + set_date_or_time(ENROLLMENT_START_DATE_CSS, '7/7/7777') + set_date_or_time(ENROLLMENT_END_DATE_CSS, '7/7/7777') + + +@step('I do not see the new changes persisted on refresh$') +def test_changes_not_shown_on_refresh(step): + reload_the_page(step) + step.then('Then I see the set dates on refresh') + + ############### HELPER METHODS #################### def set_date_or_time(css, date_or_time): """ @@ -153,11 +162,3 @@ def verify_date_or_time(css, date_or_time): Verifies date or time field. """ assert_equal(date_or_time, world.css_find(css).first.value) - - -def pause(): - """ - Must sleep briefly to allow last time save to finish, - else refresh of browser will fail. - """ - time.sleep(float(1)) diff --git a/cms/djangoapps/contentstore/features/grading.feature b/cms/djangoapps/contentstore/features/grading.feature index 78634cb964..3736582f39 100644 --- a/cms/djangoapps/contentstore/features/grading.feature +++ b/cms/djangoapps/contentstore/features/grading.feature @@ -32,6 +32,7 @@ Feature: Course Grading And I have populated the course And I am viewing the grading settings When I change assignment type "Homework" to "New Type" + And I save my changes And I go back to the main course page Then I do see the assignment name "New Type" And I do not see the assignment name "Homework" @@ -49,5 +50,14 @@ Feature: Course Grading And I have populated the course And I am viewing the grading settings When I add a new assignment type "New Type" + And I save my changes And I go back to the main course page Then I do see the assignment name "New Type" + + Scenario: Settings are only persisted when saved + Given I have opened a new course in Studio + And I have populated the course + And I am viewing the grading settings + When I change assignment type "Homework" to "New Type" + And I cancel my changes + Then I do not see the changes persisted on refresh diff --git a/cms/djangoapps/contentstore/features/grading.py b/cms/djangoapps/contentstore/features/grading.py index dc41cda30f..ae672c78a4 100644 --- a/cms/djangoapps/contentstore/features/grading.py +++ b/cms/djangoapps/contentstore/features/grading.py @@ -3,6 +3,7 @@ from lettuce import world, step from common import * +from terrain.steps import reload_the_page @step(u'I am viewing the grading settings') @@ -59,6 +60,8 @@ def change_assignment_name(step, old_name, new_name): for count in range(len(old_name)): f._element.send_keys(Keys.END, Keys.BACK_SPACE) f._element.send_keys(new_name) + # Without this, the "you've made changes" notification won't pop up + f._element.send_keys(Keys.ENTER) @step(u'I go back to the main course page') @@ -91,6 +94,8 @@ def add_assignment_type(step, new_name): name_id = '#course-grading-assignment-name' f = world.css_find(name_id)[4] f._element.send_keys(new_name) + # Without this, the "you've made changes" notification won't pop up + f._element.send_keys(Keys.ENTER) @step(u'I have populated the course') @@ -99,6 +104,14 @@ def populate_course(step): step.given('I have added a new subsection') +@step(u'I do not see the changes persisted on refresh$') +def changes_not_persisted(step): + reload_the_page(step) + name_id = '#course-grading-assignment-name' + ele = world.css_find(name_id)[0] + assert(ele.value == 'Homework') + + def get_type_index(name): name_id = '#course-grading-assignment-name' f = world.css_find(name_id) diff --git a/cms/static/js/models/settings/course_details.js b/cms/static/js/models/settings/course_details.js index b71b4e2ab2..993832f830 100644 --- a/cms/static/js/models/settings/course_details.js +++ b/cms/static/js/models/settings/course_details.js @@ -63,13 +63,13 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({ }, _videokey_illegal_chars : /[^a-zA-Z0-9_-]/g, - save_videosource: function(newsource) { + set_videosource: function(newsource) { // newsource either is