Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
@gradereport @gradereport_user
2
Feature: We don't show hidden grades for users without the 'moodle/grade:viewhidden' capability on user report
3
  In order to show user report in secure way
4
  As a teacher without the 'moodle/grade:viewhidden' capability
5
  I should not see hidden grades in the user report
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | format |
10
      | Course 1 | C1        | topics |
11
    And the following "users" exist:
12
      | username | firstname | lastname | email                |
13
      | teacher1 | Teacher   | 1        | teacher1@example.com |
14
      | student1 | Student1   | 1        | student1@example.com |
15
      | student2 | Student2   | 2        | student2@example.com |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | teacher1 | C1     | editingteacher |
19
      | student1 | C1     | student        |
20
      | student2 | C1     | student        |
21
    And the following "activities" exist:
22
      | activity | course | section | name                   | intro                   | assignsubmission_onlinetext_enabled | submissiondrafts |
23
      | assign   | C1     | 1       | Test assignment name 1 | Submit your online text | 1                                   | 0                |
24
      | assign   | C1     | 1       | Test assignment name 2 | submit your online text | 1                                   | 0                |
25
      | assign   | C1     | 1       | Test assignment name 3 | submit your online text | 1                                   | 0                |
26
    # Hidden manual grade item.
27
    And the following "grade items" exist:
28
      | itemname     | grademin | grademax | course | hidden |
29
      | Manual grade | 20       | 40       | C1     | 1      |
30
    And the following "grade grades" exist:
31
      | gradeitem              | user     | grade |
32
      | Test assignment name 1 | student1 | 80    |
33
      | Test assignment name 1 | student2 | 70    |
34
      | Test assignment name 2 | student1 | 90    |
35
      | Test assignment name 2 | student2 | 60    |
36
      | Test assignment name 3 | student1 | 10    |
37
      | Test assignment name 3 | student2 | 50    |
38
      | Manual grade           | student1 | 30    |
39
      | Manual grade           | student2 | 40    |
40
    And I log in as "admin"
41
    # Need to show hidden items in order to check hidden grades. Also lets show totals if they contain hidden items.
42
    And the following config values are set as admin:
43
      | grade_report_user_showhiddenitems           | 2 |
44
      | grade_report_user_showtotalsifcontainhidden | 2 |
45
    And I am on "Course 1" course homepage with editing mode on
46
    # Hide assignment 2 activity.
47
    And I open "Test assignment name 2" actions menu
48
    And I choose "Hide" in the open action menu
49
    And I navigate to "View > Grader report" in the course gradebook
50
    # Hide grade.
51
    And I click on grade menu "Test assignment name 1" for user "student1"
52
    And I choose "Hide" in the open action menu
53
    # Hide assignment 3 grade item.
54
    And I set the following settings for grade item "Test assignment name 3" of type "gradeitem" on "grader" page:
55
      | Hidden          | 1 |
56
 
57
  @javascript
58
  Scenario: View user report containing hidden activities or grade items or grades with capabilities with student view
59
    Given I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
60
    When I set the field "Search users" to "Student1"
61
    And I click on "Student1 1" "list_item"
62
    And I wait until the page is ready
63
 
64
    # Student View.
65
    And the following should exist in the "user-grade" table:
66
      | Grade item                 | Grade    |
67
      | Test assignment name 1     | -        |
68
      | Test assignment name 3     | -        |
69
      | Manual grade               | -        |
70
      | Course total               | 210      |
71
    And the following should not exist in the "user-grade" table:
72
      | Grade item                 |
73
      | Test assignment name 2     |
74
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
75
    And "Hidden" "icon" should not exist in the "Test assignment name 3" "table_row"
76
    And "Hidden" "icon" should not exist in the "Manual grade" "table_row"
77
    And "Hidden" "icon" should not exist in the "Course total" "table_row"
78
 
79
    And I set the field "Search users" to "Student2"
80
    And I click on "Student2 2" "list_item"
81
    And I wait until the page is ready
82
    And the following should exist in the "user-grade" table:
83
      | Grade item                 | Grade    |
84
      | Test assignment name 1     | 70       |
85
      | Test assignment name 3     | -        |
86
      | Manual grade               | -        |
87
      | Course total               | 220      |
88
    And the following should not exist in the "user-grade" table:
89
      | Grade item                 |
90
      | Test assignment name 2     |
91
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
92
    And "Hidden" "icon" should not exist in the "Test assignment name 3" "table_row"
93
    And "Hidden" "icon" should not exist in the "Manual grade" "table_row"
94
    Then "Hidden" "icon" should not exist in the "Course total" "table_row"
95
 
96
  @javascript
97
  Scenario: View user report containing hidden activities or grade items or grades with capabilities with teacher view
98
    Given I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
99
    When I set the field "Search users" to "Student2"
100
    And I click on "Student2 2" "list_item"
101
    And I wait until the page is ready
102
    And I set the field "View report as" to "Myself"
103
    And the following should exist in the "user-grade" table:
104
      | Grade item                 | Grade  |
105
      | Test assignment name 1     | 70     |
106
      | Test assignment name 2     | 60     |
107
      | Test assignment name 3     | 50     |
108
      | Manual grade               | 40     |
109
      | Course total               | 220    |
110
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
111
    And "Hidden" "icon" should exist in the "Test assignment name 2" "table_row"
112
    And "Hidden" "icon" should exist in the "Test assignment name 3" "table_row"
113
    And "Hidden" "icon" should exist in the "Manual grade" "table_row"
114
    And "Hidden" "icon" should not exist in the "Course total" "table_row"
115
 
116
    And I set the field "Search users" to "Student1"
117
    And I click on "Student1 1" "list_item"
118
    And I wait until the page is ready
119
    And the following should exist in the "user-grade" table:
120
      | Grade item                 | Grade  |
121
      | Test assignment name 1     | 80     |
122
      | Test assignment name 2     | 90     |
123
      | Test assignment name 3     | 10     |
124
      | Manual grade               | 30     |
125
      | Course total               | 210    |
126
    And "Hidden" "icon" should exist in the "Test assignment name 1" "table_row"
127
    And "Hidden" "icon" should exist in the "Test assignment name 2" "table_row"
128
    And "Hidden" "icon" should exist in the "Test assignment name 3" "table_row"
129
    And "Hidden" "icon" should exist in the "Manual grade" "table_row"
130
    Then "Hidden" "icon" should not exist in the "Course total" "table_row"
131
 
132
  @javascript
133
  Scenario: View user report containing hidden activities or grade items or grades without capabilities with teacher view
134
    Given I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
135
    And the following "role capability" exists:
136
      | role                    | editingteacher  |
137
      | moodle/grade:viewhidden | prohibit        |
138
    When I set the field "Search users" to "Student1"
139
    And I click on "Student1 1" "list_item"
140
    And I wait until the page is ready
141
    And I set the field "View report as" to "Myself"
142
    And the following should exist in the "user-grade" table:
143
      | Grade item                 | Grade  |
144
      | Test assignment name 1     | -      |
145
      | Test assignment name 2     | -      |
146
      | Test assignment name 3     | -      |
147
      | Manual grade               | -      |
148
      | Course total               | 210    |
149
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
150
    And "Hidden" "icon" should not exist in the "Test assignment name 2" "table_row"
151
    And "Hidden" "icon" should not exist in the "Test assignment name 3" "table_row"
152
    And "Hidden" "icon" should not exist in the "Manual grade" "table_row"
153
    And "Hidden" "icon" should not exist in the "Course total" "table_row"
154
 
155
    And I set the field "Search users" to "Student2"
156
    And I click on "Student2 2" "list_item"
157
    And I wait until the page is ready
158
    And the following should exist in the "user-grade" table:
159
      | Grade item                 | Grade  |
160
      | Test assignment name 1     | 70     |
161
      | Test assignment name 2     | -      |
162
      | Test assignment name 3     | -      |
163
      | Manual grade               | -      |
164
      | Course total               | 220    |
165
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
166
    And "Hidden" "icon" should not exist in the "Test assignment name 2" "table_row"
167
    And "Hidden" "icon" should not exist in the "Test assignment name 3" "table_row"
168
    And "Hidden" "icon" should not exist in the "Manual grade" "table_row"
169
    Then "Hidden" "icon" should not exist in the "Course total" "table_row"
170
 
171
  @javascript
172
  Scenario: View user report containing hidden activities or grade items or grades without capabilities with student view
173
    Given I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
174
    And the following "role capability" exists:
175
      | role                    | editingteacher  |
176
      | moodle/grade:viewhidden | prohibit        |
177
    When I set the field "Search users" to "Student2"
178
    And I click on "Student2 2" "list_item"
179
    And I wait until the page is ready
180
    And the following should exist in the "user-grade" table:
181
      | Grade item                 | Grade    |
182
      | Test assignment name 1     | 70       |
183
      | Test assignment name 3     | -        |
184
      | Manual grade               | -        |
185
      | Course total               | 220      |
186
    And the following should not exist in the "user-grade" table:
187
      | Grade item                 |
188
      | Test assignment name 2     |
189
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
190
    And "Hidden" "icon" should not exist in the "Test assignment name 3" "table_row"
191
    And "Hidden" "icon" should not exist in the "Manual grade" "table_row"
192
    And "Hidden" "icon" should not exist in the "Course total" "table_row"
193
 
194
    And I set the field "Search users" to "Student1"
195
    And I click on "Student1 1" "list_item"
196
    And I wait until the page is ready
197
    And the following should exist in the "user-grade" table:
198
      | Grade item                 | Grade    |
199
      | Test assignment name 1     | -        |
200
      | Test assignment name 3     | -        |
201
      | Manual grade               | -        |
202
      | Course total               | 210      |
203
    And the following should not exist in the "user-grade" table:
204
      | Grade item                 |
205
      | Test assignment name 2     |
206
    And "Hidden" "icon" should not exist in the "Test assignment name 1" "table_row"
207
    And "Hidden" "icon" should not exist in the "Test assignment name 3" "table_row"
208
    And "Hidden" "icon" should not exist in the "Manual grade" "table_row"
209
    Then "Hidden" "icon" should not exist in the "Course total" "table_row"