MDL-64161 gradereport_singleview: Single updates reported correctly.
[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
ZD
11 And the following "users" exist:
12 | username | firstname | lastname | email | idnumber | alternatename |
0fe86bbd 13 | teacher1 | Teacher | 1 | teacher1@example.com | t1 | fred |
ae66ed23 14 | teacher2 | No edit | 1 | teacher2@example.com | t2 | nick |
0fe86bbd
RT
15 | student1 | Student | 1 | student1@example.com | s1 | james |
16 | student2 | Student | 2 | student1@example.com | s2 | holly |
17 | student3 | Student | 3 | student1@example.com | s3 | anna |
18 | student4 | Student | 4 | student1@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 |
0a55da57 53 And I log in as "teacher1"
fdeeaff9 54 And I am on "Course 1" course homepage
44f460c3 55 Given I navigate to "View > Grader report" in the course gradebook
2fd9718d 56
237f76ce 57 @javascript
8ec7b088 58 Scenario: I can update grades, add feedback and exclude grades.
44f460c3 59 Given I navigate to "View > Single view" in the course gradebook
47f084c6
AN
60 And I select "Student 4" from the "Select user..." singleselect
61 And I set the field "Override for Test assignment one" to "1"
0a55da57 62 When I set the following fields to these values:
8ec7b088
ZD
63 | Grade for Test assignment one | 10.00 |
64 | Feedback for Test assignment one | test data |
47f084c6 65 And I set the field "Exclude for Test assignment four" to "1"
6cf0aa01 66 And I press "Save"
50e30bd4
ZD
67 Then I should see "Grades were set for 2 items"
68 And I press "Continue"
fdc934a1
AG
69 And the field "Exclude for Test assignment four" matches value "1"
70 And the field "Grade for Test assignment one" matches value "10.00"
831829dd
AG
71 And I set the following fields to these values:
72 | Test grade item | 45 |
6cf0aa01 73 And I press "Save"
831829dd
AG
74 Then I should see "Grades were set for 1 items"
75 And I press "Continue"
76 And the field "Grade for Test grade item" matches value "45.00"
77 And the field "Grade for Course total" matches value "55.00"
f86233a4
ZD
78 And I click on "Show grades for Test assignment three" "link"
79 And I click on "Override for james (Student) 1" "checkbox"
2fd9718d 80 And I set the following fields to these values:
f86233a4
ZD
81 | Grade for james (Student) 1 | 12.05 |
82 | Feedback for james (Student) 1 | test data2 |
47f084c6 83 And I set the field "Exclude for holly (Student) 2" to "1"
6cf0aa01 84 And I press "Save"
50e30bd4
ZD
85 Then I should see "Grades were set for 2 items"
86 And I press "Continue"
fdc934a1
AG
87 And the field "Grade for james (Student) 1" matches value "12.05"
88 And the field "Exclude for holly (Student) 2" matches value "1"
47f084c6 89 And I select "new grade item 1" from the "Select grade item..." singleselect
7c5721f9 90 And I click on "Very good" "option"
6cf0aa01 91 And I press "Save"
50e30bd4
ZD
92 Then I should see "Grades were set for 1 items"
93 And I press "Continue"
7c5721f9 94 And the following should exist in the "generaltable" table:
fdc934a1
AG
95 | First name (Alternate name) Surname | Grade |
96 | james (Student) 1 | Very good |
ae66ed23
DM
97 And I log out
98 And I log in as "teacher2"
fdeeaff9 99 And I am on "Course 1" course homepage
44f460c3 100 Given I navigate to "View > Single view" in the course gradebook
ae66ed23
DM
101 And I click on "Student 4" "option"
102 And the "Exclude for Test assignment one" "checkbox" should be disabled
103 And the "Override for Test assignment one" "checkbox" should be enabled
2fd9718d 104
5f3decb5 105 Scenario: Single view links work on grade report.
8ec7b088
ZD
106 Given I follow "Single view for Test assignment one"
107 Then I should see "Test assignment one"
44f460c3 108 Then I navigate to "View > Grader report" in the course gradebook
2fd9718d 109 And I follow "Single view for Student 1"
8ec7b088 110 Then I should see "Student 1"
2fd9718d 111
dd01789b
JC
112 Scenario: I can bulk update grades.
113 Given I follow "Single view for Student 1"
114 Then I should see "Student 1"
47f084c6 115 When I set the field "For" to "All grades"
dd01789b 116 And I set the field "Insert value" to "1.0"
47f084c6 117 And I set the field "Perform bulk insert" to "1"
6cf0aa01 118 And I press "Save"
5c9bc966 119 Then I should see "Grades were set for 6 items"
dd01789b 120
8ec7b088 121 Scenario: Navigation works in the Single view.
237f76ce 122 Given I follow "Single view for Student 1"
8ec7b088 123 Then I should see "Student 1"
f86233a4 124 And I follow "Student 2"
8ec7b088 125 Then I should see "Student 2"
f86233a4 126 And I follow "Student 1"
8ec7b088
ZD
127 Then I should see "Student 1"
128 And I click on "Show grades for Test assignment four" "link"
129 Then I should see "Test assignment four"
130 And I follow "Test assignment three"
131 Then I should see "Test assignment three"
132 And I follow "Test assignment four"
133 Then I should see "Test assignment four"
237f76ce
ZD
134
135 Scenario: Activities are clickable only when
136 it has a valid activity page.
137 Given I follow "Single view for Student 1"
138 And "new grade item 1" "link" should not exist in the "//tbody//tr[position()=1]//td[position()=2]" "xpath_element"
139 Then "Category total" "link" should not exist in the "//tbody//tr[position()=2]//td[position()=2]" "xpath_element"
140 And "Course total" "link" should not exist in the "//tbody//tr[position()=last()]//td[position()=2]" "xpath_element"