2 Feature: Allow to mark course as completed without cron for activity completion criteria
3 In order for students to see instant course completion updates
4 I need to be able update completion state without cron
7 Given the following "courses" exist:
8 | fullname | shortname | category | enablecompletion |
9 | Completion course | CC1 | 0 | 1 |
10 And the following "users" exist:
11 | username | firstname | lastname | email |
12 | student1 | Student | First | student1@example.com |
13 | student2 | Student | Second | student2@example.com |
14 | teacher1 | Teacher | First | teacher1@example.com |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | student1 | CC1 | student |
18 | student2 | CC1 | student |
19 | teacher1 | CC1 | editingteacher |
20 And the following "activity" exists:
23 | name | Test assignment name |
24 | idnumber | assign1 |
25 And the following "blocks" exist:
26 | blockname | contextlevel | reference | pagetypepattern | defaultregion |
27 | completionstatus | Course | CC1 | course-view-* | side-pre |
28 And I am on the "Test assignment name" "assign activity editing" page logged in as admin
29 And I click on "Expand all" "link" in the "region-main" "region"
30 And I set the field "Add requirements" to "1"
31 And I set the field "completionusegrade" to "1"
32 And I press "Save and return to course"
33 And I navigate to "Course completion" in current page administration
34 And I expand all fieldsets
35 And I set the field "Assignment - Test assignment name" to "1"
36 And I press "Save changes"
39 Scenario: Update course completion when student marks activity as complete
40 Given I am on the "Test assignment name" "assign activity editing" page logged in as teacher1
41 And I click on "Expand all" "link" in the "region-main" "region"
42 And I set the field "Students must manually mark the activity as done" to "1"
43 And I press "Save and return to course"
44 When I am on the "Completion course" course page logged in as student1
45 And I should see "Status: Not yet started"
46 And I press "Mark as done"
47 And I wait until "Done" "button" exists
48 And "Mark as done" "button" should not exist
50 Then I should see "Status: Complete"
53 Scenario: Update course completion when teacher grades a single assignment
54 Given I am on the "Test assignment name" "assign activity" page logged in as teacher1
55 And I follow "View all submissions"
56 And I click on "Grade" "link" in the "student1@example.com" "table_row"
57 And I set the field "Grade out of 100" to "40"
58 And I click on "Save changes" "button"
59 And I am on "Completion course" course homepage
60 When I am on the "Completion course" course page logged in as student1
61 Then I should see "Status: Complete"
64 Scenario: Update course completion with multiple activity criteria
65 Given the following "activity" exists:
68 | name | Test assignment name2 |
69 | idnumber | assign2 |
70 And I am on the "Test assignment name2" "assign activity editing" page logged in as admin
71 And I click on "Expand all" "link" in the "region-main" "region"
72 And I set the field "Add requirements" to "1"
73 And I set the field "completionusegrade" to "1"
74 And I press "Save and return to course"
75 And I navigate to "Course completion" in current page administration
76 And I should see "Course completion settings" in the "tertiary-navigation" "region"
77 And I expand all fieldsets
78 And I set the field "Assignment - Test assignment name" to "1"
79 And I set the field "Assignment - Test assignment name2" to "1"
80 And I press "Save changes"
81 And I am on the "Test assignment name" "assign activity" page
82 And I follow "View all submissions"
83 And I click on "Grade" "link" in the "student1@example.com" "table_row"
84 And I set the field "Grade out of 100" to "40"
85 And I click on "Save changes" "button"
86 And I am on the "Completion course" course page logged in as student1
87 And I should see "Status: In progress"
88 And I am on the "Test assignment name2" "assign activity" page logged in as teacher1
89 And I follow "View all submissions"
90 And I click on "Grade" "link" in the "student1@example.com" "table_row"
91 And I set the field "Grade out of 100" to "40"
92 And I click on "Save changes" "button"
93 When I am on the "Completion course" course page logged in as student1
94 Then I should see "Status: Complete"
97 Scenario: Course completion should not be updated when teacher grades assignment on course grader report page
98 Given I am on the "Completion course" "grades > Grader report > View" page logged in as "teacher1"
99 And I turn editing mode on
100 And I give the grade "57" to the user "Student First" for the grade item "Test assignment name"
101 And I press "Save changes"
102 When I am on the "Completion course" course page logged in as student1
103 Then I should see "Status: Pending"
104 And I run the scheduled task "core\task\completion_regular_task"
105 And I wait "1" seconds
106 And I run the scheduled task "core\task\completion_regular_task"
107 And I reload the page
108 And I should see "Status: Complete"
111 Scenario: Course completion should not be updated when teacher grades assignment on activity grader report page
112 Given I am on the "Completion course" "grades > Single View > View" page logged in as "teacher1"
113 And I click on "Users" "link" in the ".page-toggler" "css_element"
114 And I turn editing mode on
115 And I click on "Student First" in the "user" search widget
116 And I set the field "Override for Test assignment name" to "1"
117 When I set the following fields to these values:
118 | Grade for Test assignment name | 10.00 |
119 | Feedback for Test assignment name | test data |
121 When I am on the "Completion course" course page logged in as student1
122 And I should see "Status: Pending"
123 And I run the scheduled task "core\task\completion_regular_task"
124 And I wait "1" seconds
125 And I run the scheduled task "core\task\completion_regular_task"
126 And I reload the page
127 Then I should see "Status: Complete"
129 @javascript @_file_upload
130 Scenario: Course completion should not be updated when teacher imports grades with csv file
131 Given I am on the "Completion course" course page logged in as teacher1
132 And I navigate to "CSV file" import page in the course gradebook
133 And I upload "lib/tests/fixtures/upload_grades.csv" file to "File" filemanager
134 And I press "Upload grades"
135 And I set the field "Map to" to "Email address"
136 And I set the field "Test assignment name" to "Assignment: Test assignment name"
137 And I press "Upload grades"
138 And I press "Continue"
139 And I should see "10.00" in the "Student First" "table_row"
140 And I am on the "Completion course" course page logged in as student1
141 And I should see "Status: Pending"
142 When I run the scheduled task "core\task\completion_regular_task"
143 And I wait "1" seconds
144 And I run the scheduled task "core\task\completion_regular_task"
145 And I reload the page
146 Then I should see "Status: Complete"