moodle/grade/tests/behat/grade_item_validation.feature

94 lines
4.9 KiB
Gherkin
Raw Normal View History

@core_grades
Feature: Editing a grade item
In order to ensure validation is provided to the teacher
As a teacher
I need to know why I can not add/edit values on the grade item form
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And I navigate to "Scales" node in "Site administration > Grades"
And I press "Add a new scale"
And I set the following fields to these values:
| Name | ABCDEF |
| Scale | F,E,D,C,B,A |
And I press "Save changes"
And I press "Add a new scale"
And I set the following fields to these values:
| Name | Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
And I press "Save changes"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I press "Add grade item"
And I set the following fields to these values:
| Item name | MI 1 |
And I press "Save changes"
Scenario: Being able to change the grade type, scale and maximum grade for a manual grade item when there are no grades
Given I click on "Edit" "link" in the "MI 1" "table_row"
When I click on "Edit settings" "link" in the "MI 1" "table_row"
Then I should not see "Some grades have already been awarded, so the grade type"
And I set the field "Grade type" to "Scale"
And I press "Save changes"
And I should see "Scale must be selected"
And I set the field "Scale" to "ABCDEF"
And I press "Save changes"
And I should not see "You cannot change the type, as grades already exist for this item"
And I click on "Edit" "link" in the "MI 1" "table_row"
And I click on "Edit settings" "link" in the "MI 1" "table_row"
And I should not see "Some grades have already been awarded, so the grade type"
And I set the field "Scale" to "Letter scale"
And I press "Save changes"
And I should not see "You cannot change the scale, as grades already exist for this item"
Scenario: Attempting to change a manual item's grade type when grades already exist
Given I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20.00" to the user "Student 1" for the grade item "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Edit" "link" in the "MI 1" "table_row"
When I click on "Edit settings" "link" in the "MI 1" "table_row"
Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
MDL-55839 behat: Behat fixes for theme_noname This is a squash of many small fixes. The list of changes are: Initial set of behat selectors overrides required for new theme. set core behat selectors if not overridden by theme Remove pause Fix for checkboxes not saving properly Custom override for click in the user menu Fix for behat guessing the field type. Behat fix for guessing the correct field type. Fix for missing closeElementBefore mforms mess. Fix for textareas not displaying their contents. Fix availability form element Fix action menu selectors for activities in a course page Fix textareas not retaining their values Fix selector for blocks I had to change the single select template to use an input instead of a button because of a behat bug we have not tracked down yet. Fix for frozen attribute in form elements Use input instead of button while behat is still broken Fix for navigation selector override Behat selector fixes and multi-select fixes for templated select Fix for configure blocks selector + booleans for autocomplete Fixes for course_summary behat tests Allow optgroups in single_select Behat fixes for block_navigation Fixes for url form element and activity chooser selectors blocks_social - fix specific selector for behat Fix export_for_template for selectgroups element. Dont set empty id on the form Fix direct call to behat_navigation in backup context Checkbox empty value fix Fix for assign grading panel popouts file picker overrides to find a file manager in the page Fix chat tests to use element name Make selectors in mod_data behat less specific MDL-55839: recent activity behat test relies on time() SQUASH Honour mform element "class" attribute on the container SQUASH Fixes for behat in mod_forum SQUASH search form template showing value as text next to the button SQUASH undo double selectgroup fix SQUASH - The slightly different structure to action menus breaks course drag and drop SQUASH Wrap loading icon in a span so the selector still works. SQUASH Fix fragile javascript in report_loglive SQUASH Fix tabtree, and selectgroups for mod_feedback Also - do-not enhance the action menu - we are dropping support for this. SQUASH Fix filemanager selector and pix_icon template for mod_forum tests. SQUASH Fixes to breadcrumb and add formid to single select (fixes mod_glossary tests) SQUASH lesson behat fixes. 95% of lesson styles were rubbish so they were disgarded. SQUASH Fix lti behat tests - they were cheating and using a context step from quiz SQUASH Behat fixes for quiz with new theme SQUASH behat fixes for mod_wiki SQUASH Workshop behat fixes SQUASH Frozen form elements cannot use a readonly form element because it screws with the form JS "disabledIf" stuff. SQUASH Fixes for grades behat tests SQUASH behat fixes for groups SQUASH blacklist action menu tests SQUASH Fix for tag form element missing "manage standard tags" link SQUASH Incomplete fixes for course behat tests SQUASH behat fixes for badges SQUASH Tags fixes for behat SQUASH filepicker fixes for behat SQUASH Abort guessing field type when we hit 'html' SQUASH Fix for admin/tool/behat tests SQUASH fix for admin tool behat tests SQUASH fix for availabilty conditions hiding "aria-hidden" elements SQUASH give the blocks more room. We get behat files because nav tree nodes are not in view SQUASH Blocks fixed Fix behaviour of unchecked checkboxes SQUASH Remove incorrect step in user test SQUASH behat fixes for course tests Part of MDL-55071
2016-08-29 14:57:46 +08:00
And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist
Scenario: Attempting to change a manual item's scale when grades already exist
Given I click on "Edit" "link" in the "MI 1" "table_row"
And I click on "Edit settings" "link" in the "MI 1" "table_row"
And I set the field "Grade type" to "Scale"
And I set the field "Scale" to "ABCDEF"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "C" to the user "Student 1" for the grade item "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Edit" "link" in the "MI 1" "table_row"
When I click on "Edit settings" "link" in the "MI 1" "table_row"
Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed."
MDL-55839 behat: Behat fixes for theme_noname This is a squash of many small fixes. The list of changes are: Initial set of behat selectors overrides required for new theme. set core behat selectors if not overridden by theme Remove pause Fix for checkboxes not saving properly Custom override for click in the user menu Fix for behat guessing the field type. Behat fix for guessing the correct field type. Fix for missing closeElementBefore mforms mess. Fix for textareas not displaying their contents. Fix availability form element Fix action menu selectors for activities in a course page Fix textareas not retaining their values Fix selector for blocks I had to change the single select template to use an input instead of a button because of a behat bug we have not tracked down yet. Fix for frozen attribute in form elements Use input instead of button while behat is still broken Fix for navigation selector override Behat selector fixes and multi-select fixes for templated select Fix for configure blocks selector + booleans for autocomplete Fixes for course_summary behat tests Allow optgroups in single_select Behat fixes for block_navigation Fixes for url form element and activity chooser selectors blocks_social - fix specific selector for behat Fix export_for_template for selectgroups element. Dont set empty id on the form Fix direct call to behat_navigation in backup context Checkbox empty value fix Fix for assign grading panel popouts file picker overrides to find a file manager in the page Fix chat tests to use element name Make selectors in mod_data behat less specific MDL-55839: recent activity behat test relies on time() SQUASH Honour mform element "class" attribute on the container SQUASH Fixes for behat in mod_forum SQUASH search form template showing value as text next to the button SQUASH undo double selectgroup fix SQUASH - The slightly different structure to action menus breaks course drag and drop SQUASH Wrap loading icon in a span so the selector still works. SQUASH Fix fragile javascript in report_loglive SQUASH Fix tabtree, and selectgroups for mod_feedback Also - do-not enhance the action menu - we are dropping support for this. SQUASH Fix filemanager selector and pix_icon template for mod_forum tests. SQUASH Fixes to breadcrumb and add formid to single select (fixes mod_glossary tests) SQUASH lesson behat fixes. 95% of lesson styles were rubbish so they were disgarded. SQUASH Fix lti behat tests - they were cheating and using a context step from quiz SQUASH Behat fixes for quiz with new theme SQUASH behat fixes for mod_wiki SQUASH Workshop behat fixes SQUASH Frozen form elements cannot use a readonly form element because it screws with the form JS "disabledIf" stuff. SQUASH Fixes for grades behat tests SQUASH behat fixes for groups SQUASH blacklist action menu tests SQUASH Fix for tag form element missing "manage standard tags" link SQUASH Incomplete fixes for course behat tests SQUASH behat fixes for badges SQUASH Tags fixes for behat SQUASH filepicker fixes for behat SQUASH Abort guessing field type when we hit 'html' SQUASH Fix for admin/tool/behat tests SQUASH fix for admin tool behat tests SQUASH fix for availabilty conditions hiding "aria-hidden" elements SQUASH give the blocks more room. We get behat files because nav tree nodes are not in view SQUASH Blocks fixed Fix behaviour of unchecked checkboxes SQUASH Remove incorrect step in user test SQUASH behat fixes for course tests Part of MDL-55071
2016-08-29 14:57:46 +08:00
And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
Scenario: Attempting to change a manual item's maximum grade when no rescaling option has been chosen
Given I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20.00" to the user "Student 1" for the grade item "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Edit" "link" in the "MI 1" "table_row"
And I click on "Edit settings" "link" in the "MI 1" "table_row"
And I set the field "Maximum grade" to "50"
When I press "Save changes"
Then I should see "You must choose whether to rescale existing grades or not."