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