Merge pull request #19585 from edx/zeeshan/remove_unwanted_lett_grading_tests
Remove unwanted lettuce grading files
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
@shard_1
|
||||
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
|
||||
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
|
||||
When I change assignment type "Homework" to ""
|
||||
Then the save notification button is disabled
|
||||
|
||||
# IE and Safari cannot type in grade range name
|
||||
@skip_internetexplorer
|
||||
@skip_safari
|
||||
Scenario: User can edit grading range names
|
||||
Given I have populated a new course in Studio
|
||||
And I am viewing the grading settings
|
||||
When I change the highest grade range to "Good"
|
||||
And I press the "Save" notification button
|
||||
And I reload the page
|
||||
Then I see the highest grade range is "Good"
|
||||
|
||||
Scenario: User cannot edit failing grade range name
|
||||
Given I have populated a new course in Studio
|
||||
And I am viewing the grading settings
|
||||
Then I cannot edit the "Fail" grade range
|
||||
|
||||
Scenario: User can set a grace period greater than one day
|
||||
Given I have populated a new course in Studio
|
||||
And I am viewing the grading settings
|
||||
When I change the grace period to "48:00"
|
||||
And I press the "Save" notification button
|
||||
And I reload the page
|
||||
Then I see the grace period is "48:00"
|
||||
|
||||
Scenario: Grace periods of more than 59 minutes are wrapped to the correct time
|
||||
Given I have populated a new course in Studio
|
||||
And I am viewing the grading settings
|
||||
When I change the grace period to "01:99"
|
||||
And I press the "Save" notification button
|
||||
And I reload the page
|
||||
Then I see the grace period is "02:39"
|
||||
@@ -1,209 +0,0 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# pylint: disable=no-member
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from lettuce import step, world
|
||||
from selenium.common.exceptions import InvalidElementStateException
|
||||
|
||||
from common import *
|
||||
from contentstore.utils import reverse_course_url
|
||||
from openedx.core.lib.tests.tools import assert_equal, assert_in, assert_not_equal # pylint: disable=no-name-in-module
|
||||
from terrain.steps import reload_the_page
|
||||
|
||||
|
||||
@step(u'I am viewing the grading settings')
|
||||
def view_grading_settings(_step):
|
||||
world.click_course_settings()
|
||||
link_css = 'li.nav-course-settings-grading a'
|
||||
world.css_click(link_css)
|
||||
|
||||
|
||||
@step(u'I add "([^"]*)" new grade')
|
||||
def add_grade(_step, many):
|
||||
grade_css = '.new-grade-button'
|
||||
for __ in range(int(many)):
|
||||
world.css_click(grade_css)
|
||||
|
||||
|
||||
@step(u'I delete a grade')
|
||||
def delete_grade(_step):
|
||||
#grade_css = 'li.grade-specific-bar > a.remove-button'
|
||||
#range_css = '.grade-specific-bar'
|
||||
#world.css_find(range_css)[1].mouseover()
|
||||
#world.css_click(grade_css)
|
||||
world.browser.execute_script('document.getElementsByClassName("remove-button")[0].click()')
|
||||
|
||||
|
||||
@step(u'I see I now have "([^"]*)" grades$')
|
||||
def view_grade_slider(_step, how_many):
|
||||
grade_slider_css = '.grade-specific-bar'
|
||||
all_grades = world.css_find(grade_slider_css)
|
||||
assert_equal(len(all_grades), int(how_many))
|
||||
|
||||
|
||||
@step(u'I move a grading section')
|
||||
def move_grade_slider(_step):
|
||||
moveable_css = '.ui-resizable-e'
|
||||
f = world.css_find(moveable_css).first
|
||||
f.action_chains.drag_and_drop_by_offset(f._element, 100, 0).perform() # pylint: disable=protected-access
|
||||
|
||||
|
||||
@step(u'I see that the grade range has changed')
|
||||
def confirm_change(_step):
|
||||
range_css = '.range'
|
||||
all_ranges = world.css_find(range_css)
|
||||
for i in range(len(all_ranges)):
|
||||
assert_not_equal(world.css_html(range_css, index=i), '0-50')
|
||||
|
||||
|
||||
@step(u'I change assignment type "([^"]*)" to "([^"]*)"$')
|
||||
def change_assignment_name(_step, old_name, new_name):
|
||||
name_id = '#course-grading-assignment-name'
|
||||
index = get_type_index(old_name)
|
||||
f = world.css_find(name_id)[index]
|
||||
assert_not_equal(index, -1)
|
||||
for __ in xrange(len(old_name)):
|
||||
f._element.send_keys(Keys.END, Keys.BACK_SPACE) # pylint: disable=protected-access
|
||||
f._element.send_keys(new_name) # pylint: disable=protected-access
|
||||
|
||||
|
||||
@step(u'I go back to the main course page')
|
||||
def main_course_page(_step):
|
||||
main_page_link = reverse_course_url('course_handler', world.scenario_dict['COURSE'].id)
|
||||
|
||||
world.visit(main_page_link)
|
||||
assert_in('Course Outline', world.css_text('h1.page-header'))
|
||||
|
||||
|
||||
@step(u'I do( not)? see the assignment name "([^"]*)"$')
|
||||
def see_assignment_name(_step, _do_not, _name):
|
||||
# TODO: rewrite this once grading has been added back to the course outline
|
||||
pass
|
||||
# assignment_menu_css = 'ul.menu > li > a'
|
||||
# # First assert that it is there, make take a bit to redraw
|
||||
# assert_true(
|
||||
# world.css_find(assignment_menu_css),
|
||||
# msg="Could not find assignment menu"
|
||||
# )
|
||||
#
|
||||
# assignment_menu = world.css_find(assignment_menu_css)
|
||||
# allnames = [item.html for item in assignment_menu]
|
||||
# if do_not:
|
||||
# assert_not_in(name, allnames)
|
||||
# else:
|
||||
# assert_in(name, allnames)
|
||||
|
||||
|
||||
@step(u'I delete the assignment type "([^"]*)"$')
|
||||
def delete_assignment_type(_step, to_delete):
|
||||
delete_css = '.remove-grading-data'
|
||||
world.css_click(delete_css, index=get_type_index(to_delete))
|
||||
|
||||
|
||||
@step(u'I add a new assignment type "([^"]*)"$')
|
||||
def add_assignment_type(_step, new_name):
|
||||
add_button_css = '.add-grading-data'
|
||||
world.css_click(add_button_css)
|
||||
name_id = '#course-grading-assignment-name'
|
||||
new_assignment = world.css_find(name_id)[-1]
|
||||
new_assignment._element.send_keys(new_name) # pylint: disable=protected-access
|
||||
|
||||
|
||||
@step(u'I set the assignment weight to "([^"]*)"$')
|
||||
def set_weight(_step, weight):
|
||||
weight_id = '#course-grading-assignment-gradeweight'
|
||||
weight_field = world.css_find(weight_id)[-1]
|
||||
old_weight = world.css_value(weight_id, -1)
|
||||
for __ in range(len(old_weight)):
|
||||
weight_field._element.send_keys(Keys.END, Keys.BACK_SPACE) # pylint: disable=protected-access
|
||||
weight_field._element.send_keys(weight) # pylint: disable=protected-access
|
||||
|
||||
|
||||
@step(u'the assignment weight is displayed as "([^"]*)"$')
|
||||
def verify_weight(_step, weight):
|
||||
weight_id = '#course-grading-assignment-gradeweight'
|
||||
assert_equal(world.css_value(weight_id, -1), weight)
|
||||
|
||||
|
||||
@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'
|
||||
assert_equal(world.css_value(name_id), 'Homework')
|
||||
|
||||
|
||||
@step(u'I see the assignment type "(.*)"$')
|
||||
def i_see_the_assignment_type(_step, name):
|
||||
assignment_css = '#course-grading-assignment-name'
|
||||
assignments = world.css_find(assignment_css)
|
||||
types = [ele['value'] for ele in assignments]
|
||||
assert_in(name, types)
|
||||
|
||||
|
||||
@step(u'I change the highest grade range to "(.*)"$')
|
||||
def change_grade_range(_step, range_name):
|
||||
range_css = 'span.letter-grade'
|
||||
grade = world.css_find(range_css).first
|
||||
grade.value = range_name
|
||||
|
||||
|
||||
@step(u'I see the highest grade range is "(.*)"$')
|
||||
def i_see_highest_grade_range(_step, range_name):
|
||||
range_css = 'span.letter-grade'
|
||||
grade = world.css_find(range_css).first
|
||||
assert_equal(grade.value, range_name)
|
||||
|
||||
|
||||
@step(u'I cannot edit the "Fail" grade range$')
|
||||
def cannot_edit_fail(_step):
|
||||
range_css = 'span.letter-grade'
|
||||
ranges = world.css_find(range_css)
|
||||
assert_equal(len(ranges), 2)
|
||||
assert_not_equal(ranges.last.value, 'Failure')
|
||||
|
||||
# try to change the grade range -- this should throw an exception
|
||||
try:
|
||||
ranges.last.value = 'Failure'
|
||||
except InvalidElementStateException:
|
||||
pass # We should get this exception on failing to edit the element
|
||||
|
||||
# check to be sure that nothing has changed
|
||||
ranges = world.css_find(range_css)
|
||||
assert_equal(len(ranges), 2)
|
||||
assert_not_equal(ranges.last.value, 'Failure')
|
||||
|
||||
|
||||
@step(u'I change the grace period to "(.*)"$')
|
||||
def i_change_grace_period(_step, grace_period):
|
||||
grace_period_css = '#course-grading-graceperiod'
|
||||
ele = world.css_find(grace_period_css).first
|
||||
|
||||
# Sometimes it takes a moment for the JavaScript
|
||||
# to populate the field. If we don't wait for
|
||||
# this to happen, then we can end up with
|
||||
# an invalid value (e.g. "00:0048:00")
|
||||
# which prevents us from saving.
|
||||
assert world.css_has_value(grace_period_css, "00:00")
|
||||
|
||||
# Set the new grace period
|
||||
ele.value = grace_period
|
||||
|
||||
|
||||
@step(u'I see the grace period is "(.*)"$')
|
||||
def the_grace_period_is(_step, grace_period):
|
||||
grace_period_css = '#course-grading-graceperiod'
|
||||
|
||||
# The default value is 00:00
|
||||
# so we need to wait for it to change
|
||||
world.wait_for(
|
||||
lambda _: world.css_has_value(grace_period_css, grace_period)
|
||||
)
|
||||
|
||||
|
||||
def get_type_index(name):
|
||||
name_id = '#course-grading-assignment-name'
|
||||
all_types = world.css_find(name_id)
|
||||
for index in range(len(all_types)):
|
||||
if world.css_value(name_id, index=index) == name:
|
||||
return index
|
||||
return -1
|
||||
Reference in New Issue
Block a user