MDL-51709 gradebook: Name display in single view.
[moodle.git] / grade / report / singleview / tests / behat / singleview.feature
CommitLineData
8ec7b088 1@core @core_grades @gradereport_singleview
2fd9718d
ZD
2Feature: We can use Single view
3 As a teacher
8ec7b088
ZD
4 In order to view and edit grades
5 For users and activities for a course.
2fd9718d 6
8ec7b088 7 Background:
2fd9718d 8 Given the following "courses" exist:
8ec7b088
ZD
9 | fullname | shortname | category |
10 | Course 1 | C1 | 0 |
2fd9718d 11 And the following "users" exist:
4830f551
LB
12 | username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
13 | teacher1 | Teacher | 1 | teacher1@example.com | t1 | | fred | | |
14 | teacher2 | No edit | 1 | teacher2@example.com | t2 | | nick | | |
15 | student1 | Grainne | Beauchamp | student1@example.com | s1 | Ann | Jill | Gronya | Beecham |
16 | student2 | Niamh | Cholmondely | student2@example.com | s2 | Jane | Nina | Nee | Chumlee |
17 | student3 | Siobhan | Desforges | student3@example.com | s3 | Sarah | Sev | Shevon | De-forjay |
18 | student4 | Student | 4 | student4@example.com | s4 | | zac | | |
7c5721f9
ZD
19 And the following "scales" exist:
20 | name | scale |
21 | Test Scale | Disappointing, Good, Very good, Excellent |
237f76ce 22 And the following "grade items" exist:
7c5721f9
ZD
23 | itemname | course | gradetype | scale |
24 | new grade item 1 | C1 | Scale | Test Scale |
25 And the following "scales" exist:
26 | name | scale |
27 | Test Scale | Disappointing, Good, Very good, Excellent |
2fd9718d
ZD
28 And the following "course enrolments" exist:
29 | user | course | role |
30 | teacher1 | C1 | editingteacher |
ae66ed23 31 | teacher2 | C1 | teacher |
2fd9718d
ZD
32 | student1 | C1 | student |
33 | student2 | C1 | student |
34 | student3 | C1 | student |
35 | student4 | C1 | student |
36 And the following "grade categories" exist:
37 | fullname | course |
38 | Sub category 1 | C1|
39 | Sub category 2 | C1|
40 And the following "activities" exist:
41 | activity | course | idnumber | name | intro | grade |
42 | assign | C1 | a1 | Test assignment one | Submit something! | 300 |
43 | assign | C1 | a2 | Test assignment two | Submit something! | 100 |
44 | assign | C1 | a3 | Test assignment three | Submit something! | 150 |
45 | assign | C1 | a4 | Test assignment four | Submit nothing! | 150 |
7c5721f9
ZD
46 And the following "grade items" exist:
47 | itemname | course | gradetype |
48 | Test grade item | C1 | Scale |
ae66ed23
DM
49 And the following "permission overrides" exist:
50 | capability | permission | role | contextlevel | reference |
51 | moodle/grade:edit | Allow | teacher | Course | C1 |
52 | gradereport/singleview:view | Allow | teacher | Course | C1 |
4830f551
LB
53 And the following config values are set as admin:
54 | fullnamedisplay | firstnamephonetic,lastnamephonetic |
55 | alternativefullnameformat | middlename, alternatename, firstname, lastname |
0a55da57 56 And I log in as "teacher1"
fdeeaff9 57 And I am on "Course 1" course homepage
44f460c3 58 Given I navigate to "View > Grader report" in the course gradebook
2fd9718d 59
237f76ce 60 @javascript
8ec7b088 61 Scenario: I can update grades, add feedback and exclude grades.
44f460c3 62 Given I navigate to "View > Single view" in the course gradebook
4830f551 63 And I select "Student" from the "Select user..." singleselect
47f084c6 64 And I set the field "Override for Test assignment one" to "1"
0a55da57 65 When I set the following fields to these values:
8ec7b088
ZD
66 | Grade for Test assignment one | 10.00 |
67 | Feedback for Test assignment one | test data |
47f084c6 68 And I set the field "Exclude for Test assignment four" to "1"
6cf0aa01 69 And I press "Save"
50e30bd4
ZD
70 Then I should see "Grades were set for 2 items"
71 And I press "Continue"
fdc934a1
AG
72 And the field "Exclude for Test assignment four" matches value "1"
73 And the field "Grade for Test assignment one" matches value "10.00"
831829dd
AG
74 And I set the following fields to these values:
75 | Test grade item | 45 |
6cf0aa01 76 And I press "Save"
831829dd
AG
77 Then I should see "Grades were set for 1 items"
78 And I press "Continue"
79 And the field "Grade for Test grade item" matches value "45.00"
80 And the field "Grade for Course total" matches value "55.00"
f86233a4 81 And I click on "Show grades for Test assignment three" "link"
4830f551 82 And I click on "Override for Ann, Jill, Grainne, Beauchamp" "checkbox"
2fd9718d 83 And I set the following fields to these values:
4830f551
LB
84 | Grade for Ann, Jill, Grainne, Beauchamp | 12.05 |
85 | Feedback for Ann, Jill, Grainne, Beauchamp | test data2 |
86 And I set the field "Exclude for Jane, Nina, Niamh, Cholmondely" to "1"
6cf0aa01 87 And I press "Save"
50e30bd4
ZD
88 Then I should see "Grades were set for 2 items"
89 And I press "Continue"
4830f551
LB
90 And the field "Grade for Ann, Jill, Grainne, Beauchamp" matches value "12.05"
91 And the field "Exclude for Jane, Nina, Niamh, Cholmondely" matches value "1"
47f084c6 92 And I select "new grade item 1" from the "Select grade item..." singleselect
4830f551 93 And I set the field "Grade for Ann, Jill, Grainne, Beauchamp" to "Very good"
6cf0aa01 94 And I press "Save"
50e30bd4
ZD
95 Then I should see "Grades were set for 1 items"
96 And I press "Continue"
7c5721f9 97 And the following should exist in the "generaltable" table:
fdc934a1 98 | First name (Alternate name) Surname | Grade |
4830f551 99 | Ann, Jill, Grainne, Beauchamp | Very good |
ae66ed23
DM
100 And I log out
101 And I log in as "teacher2"
fdeeaff9 102 And I am on "Course 1" course homepage
44f460c3 103 Given I navigate to "View > Single view" in the course gradebook
4830f551 104 And I select "Student" from the "Select user..." singleselect
ae66ed23
DM
105 And the "Exclude for Test assignment one" "checkbox" should be disabled
106 And the "Override for Test assignment one" "checkbox" should be enabled
2fd9718d 107
5f3decb5 108 Scenario: Single view links work on grade report.
8ec7b088
ZD
109 Given I follow "Single view for Test assignment one"
110 Then I should see "Test assignment one"
44f460c3 111 Then I navigate to "View > Grader report" in the course gradebook
4830f551
LB
112 And I follow "Single view for Ann, Jill, Grainne, Beauchamp"
113 Then I should see "Gronya,Beecham"
2fd9718d 114
dd01789b 115 Scenario: I can bulk update grades.
4830f551
LB
116 Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
117 Then I should see "Gronya,Beecham"
47f084c6 118 When I set the field "For" to "All grades"
dd01789b 119 And I set the field "Insert value" to "1.0"
47f084c6 120 And I set the field "Perform bulk insert" to "1"
6cf0aa01 121 And I press "Save"
5c9bc966 122 Then I should see "Grades were set for 6 items"
dd01789b 123
8ec7b088 124 Scenario: Navigation works in the Single view.
4830f551
LB
125 Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
126 Then I should see "Gronya,Beecham"
127 And I follow "Nee,Chumlee"
128 Then I should see "Nee,Chumlee"
129 And I follow "Gronya,Beecham"
130 Then I should see "Gronya,Beecham"
8ec7b088
ZD
131 And I click on "Show grades for Test assignment four" "link"
132 Then I should see "Test assignment four"
133 And I follow "Test assignment three"
134 Then I should see "Test assignment three"
135 And I follow "Test assignment four"
136 Then I should see "Test assignment four"
237f76ce
ZD
137
138 Scenario: Activities are clickable only when
139 it has a valid activity page.
4830f551 140 Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
237f76ce
ZD
141 And "new grade item 1" "link" should not exist in the "//tbody//tr[position()=1]//td[position()=2]" "xpath_element"
142 Then "Category total" "link" should not exist in the "//tbody//tr[position()=2]//td[position()=2]" "xpath_element"
143 And "Course total" "link" should not exist in the "//tbody//tr[position()=last()]//td[position()=2]" "xpath_element"