Skip to content
Snippets Groups Projects
Commit 3afe7411 authored by Alex Dusenbery's avatar Alex Dusenbery
Browse files

Revert "studio grading bokchoy tests III"

This reverts commit 9b9f7c26.
parent ccccc1bf
No related merge requests found
......@@ -2,6 +2,22 @@
Feature: CMS.Course Grading
As a course author, I want to be able to configure how my course is graded
Scenario: Users can delete Assignment types
Given I have populated a new course in Studio
And I am viewing the grading settings
When I delete the assignment type "Homework"
And I press the "Save" notification button
And I go back to the main course page
Then I do not see the assignment name "Homework"
Scenario: Users can add Assignment types
Given I have populated a new course in Studio
And I am viewing the grading settings
When I add a new assignment type "New Type"
And I press the "Save" notification button
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
......@@ -13,21 +29,25 @@ Feature: CMS.Course Grading
And I reload the page
Then the assignment weight is displayed as "7"
Scenario: Users can delete Assignment types
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 delete the assignment type "Homework"
And I press the "Save" notification button
And I go back to the main course page
Then I do not see the assignment name "Homework"
When I change assignment type "Homework" to "New Type"
Then I do not see the changes persisted on refresh
Scenario: Users can add Assignment types
Scenario: Settings are reset on cancel
Given I have populated a new course in Studio
And I am viewing the grading settings
When I add a new assignment type "New Type"
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
And I go back to the main course page
Then I do see the assignment name "New Type"
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
......
......@@ -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.
......
......@@ -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.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment