[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/form/tests/behat/ -> modgrade_validation.feature (source)

   1  @core_form
   2  Feature: Using the activity grade form element
   3    In order to ensure validation is provided to the teacher
   4    As a teacher
   5    I need to know why I can not add/edit values in the form element
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | student1 | Student | 1 | student1@example.com |
  11        | teacher1 | Teacher | 1 | teacher1@example.com |
  12      And the following "courses" exist:
  13        | fullname | shortname | category | groupmode |
  14        | Course 1 | C1 | 0 | 1 |
  15      And the following "course enrolments" exist:
  16        | user | course | role |
  17        | teacher1 | C1 | editingteacher |
  18        | student1 | C1 | student |
  19  
  20    Scenario: Being able to change the grade type, scale and maximum grade when there are no grades
  21      Given I log in as "admin"
  22      And I navigate to "Scales" node in "Site administration > Grades"
  23      And I press "Add a new scale"
  24      And I set the following fields to these values:
  25        | Name  | ABCDEF |
  26        | Scale | F,E,D,C,B,A |
  27      And I press "Save changes"
  28      And I press "Add a new scale"
  29      And I set the following fields to these values:
  30        | Name  | Letter scale |
  31        | Scale | Disappointing, Good, Very good, Excellent |
  32      And I press "Save changes"
  33      And I log out
  34      And I log in as "teacher1"
  35      And I follow "Course 1"
  36      And I turn editing mode on
  37      And I add a "Forum" to section "1" and I fill the form with:
  38        | Forum name | Test forum name |
  39        | Forum type | Standard forum for general use |
  40        | Description | Test forum description |
  41        | Aggregate type | Average of ratings  |
  42        | scale[modgrade_type] | Point |
  43        | scale[modgrade_point] | 100 |
  44        | Group mode | No groups |
  45      And I follow "Test forum name"
  46      And I click on "Edit settings" "link" in the "Administration" "block"
  47      When I expand all fieldsets
  48      Then I should not see "Some grades have already been awarded, so the grade type"
  49      And I set the field "scale[modgrade_type]" to "Scale"
  50      And I set the field "scale[modgrade_scale]" to "ABCDEF"
  51      And I press "Save and display"
  52      And I should not see "You cannot change the type, as grades already exist for this item"
  53      And I click on "Edit settings" "link" in the "Administration" "block"
  54      And I expand all fieldsets
  55      And I should not see "Some grades have already been awarded, so the grade type"
  56      And I set the field "scale[modgrade_scale]" to "Letter scale"
  57      And I press "Save and display"
  58      And I should not see "You cannot change the scale, as grades already exist for this item"
  59      And I click on "Edit settings" "link" in the "Administration" "block"
  60      And I expand all fieldsets
  61      And I should not see "Some grades have already been awarded, so the grade type"
  62      And I set the field "scale[modgrade_type]" to "Point"
  63      And I set the field "Maximum grade" to "50"
  64      And I press "Save and display"
  65      And I should not see "You must choose whether to rescale existing grades or not"
  66  
  67    @javascript
  68    Scenario: Attempting to change the scale when grades already exist in rating activity
  69      Given I log in as "admin"
  70      And I navigate to "Scales" node in "Site administration > Grades"
  71      And I press "Add a new scale"
  72      And I set the following fields to these values:
  73        | Name  | ABCDEF |
  74        | Scale | F,E,D,C,B,A |
  75      And I press "Save changes"
  76      And I press "Add a new scale"
  77      And I set the following fields to these values:
  78        | Name  | Letter scale |
  79        | Scale | Disappointing, Good, Very good, Excellent |
  80      And I press "Save changes"
  81      And I log out
  82      And I log in as "teacher1"
  83      And I follow "Course 1"
  84      And I turn editing mode on
  85      And I add a "Forum" to section "1" and I fill the form with:
  86        | Forum name | Test forum name |
  87        | Forum type | Standard forum for general use |
  88        | Description | Test forum description |
  89        | Aggregate type | Average of ratings  |
  90        | scale[modgrade_type] | Scale |
  91        | scale[modgrade_scale] | ABCDEF |
  92        | Group mode | No groups |
  93      And I log out
  94      And I log in as "student1"
  95      And I follow "Course 1"
  96      And I follow "Test forum name"
  97      And I press "Add a new discussion topic"
  98      And I set the following fields to these values:
  99        | Subject  | Discussion subject |
 100        | Message | Discussion message |
 101      And I press "Post to forum"
 102      And I log out
 103      And I log in as "teacher1"
 104      And I follow "Course 1"
 105      And I follow "Test forum name"
 106      And I follow "Discussion subject"
 107      And I set the field "rating" to "D"
 108      And I click on "Edit settings" "link" in the "Administration" "block"
 109      When I expand all fieldsets
 110      Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed"
 111      # Try saving the form and visiting it back to verify that everything is working ok.
 112      And I press "Save and display"
 113      And I should not see "When selecting a ratings aggregate type you must also select"
 114      And I click on "Edit settings" "link"
 115      And I expand all fieldsets
 116      And the field "Aggregate type" matches value "Average of ratings"
 117      And the field "scale[modgrade_type]" matches value "Scale"
 118      And the field "scale[modgrade_scale]" matches value "ABCDEF"
 119  
 120    @javascript
 121    Scenario: Attempting to change the scale when grades already exist in non-rating activity
 122      Given I log in as "admin"
 123      And I navigate to "Scales" node in "Site administration > Grades"
 124      And I press "Add a new scale"
 125      And I set the following fields to these values:
 126        | Name  | ABCDEF |
 127        | Scale | F,E,D,C,B,A |
 128      And I press "Save changes"
 129      And I press "Add a new scale"
 130      And I set the following fields to these values:
 131        | Name  | Letter scale |
 132        | Scale | Disappointing, Good, Very good, Excellent |
 133      And I press "Save changes"
 134      And I log out
 135      And I log in as "teacher1"
 136      And I follow "Course 1"
 137      And I turn editing mode on
 138      And I add a "Assignment" to section "1" and I fill the form with:
 139        | Assignment name | Test assignment name |
 140        | Description | Test assignment description |
 141        | grade[modgrade_type] | Scale |
 142        | grade[modgrade_scale] | ABCDEF |
 143      And I follow "Course 1"
 144      And I follow "Test assignment name"
 145      And I follow "View all submissions"
 146      And I click on "Grade" "link" in the "Student 1" "table_row"
 147      And I set the field "Grade" to "C"
 148      And I press "Save changes"
 149      And I press "Ok"
 150      And I click on "Edit settings" "link"
 151      When I expand all fieldsets
 152      Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed"
 153      # Try saving the form and visiting it back to verify everything is working ok.
 154      And I press "Save and display"
 155      And I click on "Edit settings" "link"
 156      And I expand all fieldsets
 157      And the field "grade[modgrade_type]" matches value "Scale"
 158      And the field "grade[modgrade_scale]" matches value "ABCDEF"
 159  
 160    Scenario: Attempting to change the maximum grade when ratings exist
 161      Given I log in as "teacher1"
 162      And I follow "Course 1"
 163      And I turn editing mode on
 164      And I add a "Forum" to section "1" and I fill the form with:
 165        | Forum name | Test forum name |
 166        | Forum type | Standard forum for general use |
 167        | Description | Test forum description |
 168        | Aggregate type | Average of ratings  |
 169        | scale[modgrade_type] | Point |
 170        | scale[modgrade_point] | 100 |
 171        | Group mode | No groups |
 172      And I log out
 173      And I log in as "student1"
 174      And I follow "Course 1"
 175      And I follow "Test forum name"
 176      And I press "Add a new discussion topic"
 177      And I set the following fields to these values:
 178        | Subject  | Discussion subject |
 179        | Message | Discussion message |
 180      And I press "Post to forum"
 181      And I log out
 182      And I log in as "teacher1"
 183      And I follow "Course 1"
 184      And I follow "Test forum name"
 185      And I follow "Discussion subject"
 186      And I set the field "rating" to "100"
 187      And I press "Rate"
 188      And I click on "Edit settings" "link" in the "Administration" "block"
 189      When I expand all fieldsets
 190      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."
 191      And I set the field "Maximum grade" to "50"
 192      And I press "Save and display"
 193      And I should see "You cannot change the maximum grade when grades already exist for an activity with ratings"
 194  
 195    @javascript
 196    Scenario: Attempting to change the maximum grade when no rescaling option has been chosen
 197      Given I log in as "teacher1"
 198      And I follow "Course 1"
 199      And I turn editing mode on
 200      And I add a "Assignment" to section "1" and I fill the form with:
 201        | Assignment name | Test assignment name |
 202        | Description | Test assignment description |
 203      And I follow "Course 1"
 204      And I follow "Test assignment name"
 205      And I follow "View all submissions"
 206      And I click on "Grade" "link" in the "Student 1" "table_row"
 207      And I set the field "Grade out of 100" to "50"
 208      And I press "Save changes"
 209      And I press "Ok"
 210      And I click on "Edit settings" "link"
 211      When I expand all fieldsets
 212      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."


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1