From 3afe74114312ad8e5a9e8d078361e36537d4413a Mon Sep 17 00:00:00 2001 From: Alex Dusenbery Date: Fri, 31 Aug 2018 10:28:06 -0400 Subject: [PATCH] Revert "studio grading bokchoy tests III" This reverts commit 9b9f7c26cdd75618cac7cda2d36fa8fe402b8ede. --- .../contentstore/features/grading.feature | 42 +++++++--- .../pages/studio/settings_graders.py | 77 ++++--------------- .../tests/studio/test_studio_grading.py | 40 ---------- 3 files changed, 44 insertions(+), 115 deletions(-) diff --git a/cms/djangoapps/contentstore/features/grading.feature b/cms/djangoapps/contentstore/features/grading.feature index b530ff8929..0def9df05c 100644 --- a/cms/djangoapps/contentstore/features/grading.feature +++ b/cms/djangoapps/contentstore/features/grading.feature @@ -2,17 +2,6 @@ Feature: CMS.Course Grading As a course author, I want to be able to configure how my course is graded - # Note that "7" is a special weight because it revealed rounding errors (STUD-826). - Scenario: Users can set weight to Assignment types - Given I have opened a new course in Studio - And I am viewing the grading settings - When I add a new assignment type "New Type" - And I set the assignment weight to "7" - And I press the "Save" notification button - Then the assignment weight is displayed as "7" - And I reload the page - Then the assignment weight is displayed as "7" - Scenario: Users can delete Assignment types Given I have populated a new course in Studio And I am viewing the grading settings @@ -29,6 +18,37 @@ Feature: CMS.Course Grading And I go back to the main course page Then I do see the assignment name "New Type" + # Note that "7" is a special weight because it revealed rounding errors (STUD-826). + Scenario: Users can set weight to Assignment types + Given I have opened a new course in Studio + And I am viewing the grading settings + When I add a new assignment type "New Type" + And I set the assignment weight to "7" + And I press the "Save" notification button + Then the assignment weight is displayed as "7" + And I reload the page + Then the assignment weight is displayed as "7" + + Scenario: Settings are only persisted when saved + Given I have populated a new course in Studio + And I am viewing the grading settings + When I change assignment type "Homework" to "New Type" + Then I do not see the changes persisted on refresh + + Scenario: Settings are reset on cancel + Given I have populated a new course in Studio + And I am viewing the grading settings + When I change assignment type "Homework" to "New Type" + And I press the "Cancel" notification button + Then I see the assignment type "Homework" + + Scenario: Confirmation is shown on save + Given I have populated a new course in Studio + And I am viewing the grading settings + When I change assignment type "Homework" to "New Type" + And I press the "Save" notification button + Then I see a confirmation that my changes have been saved + Scenario: User cannot save invalid settings Given I have populated a new course in Studio And I am viewing the grading settings diff --git a/common/test/acceptance/pages/studio/settings_graders.py b/common/test/acceptance/pages/studio/settings_graders.py index b1d9dd88c3..1cc8b767e7 100644 --- a/common/test/acceptance/pages/studio/settings_graders.py +++ b/common/test/acceptance/pages/studio/settings_graders.py @@ -16,7 +16,6 @@ class GradingPage(SettingsPage): url_path = "settings/grading" grade_ranges = '.grades .grade-specific-bar' - assignments = '.field-group.course-grading-assignment-list-item' def is_browser_on_page(self): return self.q(css='body.grading').present @@ -33,8 +32,7 @@ class GradingPage(SettingsPage): def total_number_of_grades(self): """ Gets total number of grades present in the grades bar - Returns: - int: Single number length of grades + returns: Single number length of grades """ self.wait_for_element_visibility(self.grade_ranges, 'Grades are visible') return len(self.q(css=self.grade_ranges)) @@ -84,36 +82,11 @@ class GradingPage(SettingsPage): moveable_css = self.q(css='.ui-resizable-e').results[0] action.drag_and_drop_by_offset(moveable_css, 0, 0).perform() - @property - def get_assignment_names(self): - """ - Get name of the all the assignment types. - Returns: - list: A list containing names of the assignment types. - """ - self.wait_for_element_visibility( - '#course-grading-assignment-name', - 'Grade Names not visible.' - ) - return self.q(css='#course-grading-assignment-name').attrs('value') - - def change_assignment_name(self, old_name, new_name): - """ - Changes the assignment name. - Arguments: - old_name (str): The assignment type name which is to be changed. - new_name (str): New name of the assignment. - """ - self.wait_for_element_visibility('#course-grading-assignment-name', 'Assignment Name field visible') - self.q(css='#course-grading-assignment-name').filter( - lambda el: el.get_attribute('value') == old_name).fill(new_name) - @property def grade_letters(self): """ Get names of grade ranges. - Returns: - list: A list containing names of the grade ranges. + Returns: A list containing names of the grade ranges. """ return self.q(css='.letter-grade').text @@ -126,9 +99,8 @@ class GradingPage(SettingsPage): def is_grade_added(self, length): """ Checks to see if grade is added by comparing number of grades after the addition - Returns: - bool: True if grade is added - bool: False if grade is not added + Returns: True if grade is added + Returns: False if grade is not added """ try: self.wait_for( @@ -140,12 +112,18 @@ class GradingPage(SettingsPage): except BrokenPromise: return False + def add_new_assignment_type(self): + """ + Add New Assignment type + """ + self.q(css='.add-grading-data').click() + self.save_changes() + @property def grades_range(self): """ Get ranges of all the grades. - Returns: - list: A list containing ranges of all the grades + Returns: A list containing ranges of all the grades """ self.wait_for_element_visibility('.range', 'Ranges are visible') return self.q(css='.range').text @@ -181,8 +159,7 @@ class GradingPage(SettingsPage): def assignment_name_field_value(self): """ - Returns: - list: Assignment type field value + Returns: Assignment type field value """ return self.q(css='#course-grading-assignment-name').attrs('value') @@ -200,40 +177,12 @@ class GradingPage(SettingsPage): while len(self.q(css='.remove-grading-data')) > 0: self.delete_assignment_type() - def get_confirmation_message(self): - """ - Get confirmation message received after saving settings. - """ - self.wait_for_element_visibility('#alert-confirmation-title', 'Confirmation text present') - return self.q(css='#alert-confirmation-title').text[0] - - def _get_type_index(self, name): - """ - Gets the index of assignment type. - Arguments: - name(str): name of the assignment - Returns: - int: index of the assignment type - """ - name_id = '#course-grading-assignment-name' - all_types = self.q(css=name_id).results - for index, element in enumerate(all_types): - if element.get_attribute('value') == name: - return index - return -1 - def save(self): """ Click on save settings button. """ press_the_notification_button(self, "Save") - def cancel(self): - """ - Click on cancel settings button. - """ - press_the_notification_button(self, "Cancel") - def refresh_and_wait_for_load(self): """ Refresh the page and wait for all resources to load. diff --git a/common/test/acceptance/tests/studio/test_studio_grading.py b/common/test/acceptance/tests/studio/test_studio_grading.py index db1a1d5461..b981ca34f2 100644 --- a/common/test/acceptance/tests/studio/test_studio_grading.py +++ b/common/test/acceptance/tests/studio/test_studio_grading.py @@ -130,43 +130,3 @@ class GradingPageTest(StudioCourseTest): grade_ranges, 'expected range: 0-3, not found in grade ranges:{}'.format(grade_ranges) ) - - def test_settings_are_persisted_on_save_only(self): - """ - Scenario: Settings are only persisted when saved - Given I have populated a new course in Studio - And I am viewing the grading settings - When I change assignment type "Homework" to "New Type" - Then I do not see the changes persisted on refresh - """ - self.grading_page.change_assignment_name('Homework', 'New Type') - self.grading_page.refresh_and_wait_for_load() - self.assertIn('Homework', self.grading_page.get_assignment_names) - - def test_settings_are_reset_on_cancel(self): - """ - Scenario: Settings are reset on cancel - Given I have populated a new course in Studio - And I am viewing the grading settings - When I change assignment type "Homework" to "New Type" - And I press the "Cancel" notification button - Then I see the assignment type "Homework" - """ - self.grading_page.change_assignment_name('Homework', 'New Type') - self.grading_page.cancel() - assignment_names = self.grading_page.get_assignment_names - self.assertIn('Homework', assignment_names) - - def test_confirmation_is_shown_on_save(self): - """ - Scenario: Confirmation is shown on save - Given I have populated a new course in Studio - And I am viewing the grading settings - When I change assignment type "Homework" to "New Type" - And I press the "Save" notification button - Then I see a confirmation that my changes have been saved - """ - self.grading_page.change_assignment_name('Homework', 'New Type') - self.grading_page.save() - confirmation_message = self.grading_page.get_confirmation_message() - self.assertEqual(confirmation_message, 'Your changes have been saved.')