1 |
efrain |
1 |
@core @core_course @core_courseformat
|
|
|
2 |
Feature: Course index completion icons
|
|
|
3 |
In order to quickly check my activities completions
|
|
|
4 |
As a student
|
|
|
5 |
I need to see the activity completion in the course index.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "course" exists:
|
|
|
13 |
| fullname | Course 1 |
|
|
|
14 |
| shortname | C1 |
|
|
|
15 |
| category | 0 |
|
|
|
16 |
| enablecompletion | 1 |
|
|
|
17 |
| numsections | 4 |
|
|
|
18 |
And the following "activities" exist:
|
|
|
19 |
| activity | name | intro | course | idnumber | section | completion |
|
|
|
20 |
| assign | Activity sample 1 | Test assignment description | C1 | sample1 | 1 | 1 |
|
|
|
21 |
And the following "course enrolments" exist:
|
|
|
22 |
| user | course | role |
|
|
|
23 |
| student1 | C1 | student |
|
|
|
24 |
| teacher1 | C1 | editingteacher |
|
|
|
25 |
# The course index is hidden by default in small devices.
|
|
|
26 |
And I change window size to "large"
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: Teacher does not see completion icons.
|
|
|
30 |
When I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
31 |
Then I should see "New section" in the "courseindex-content" "region"
|
|
|
32 |
And I should see "Activity sample 1" in the "courseindex-content" "region"
|
|
|
33 |
And "To do" "icon" should not exist in the "courseindex-content" "region"
|
|
|
34 |
|
|
|
35 |
@javascript
|
|
|
36 |
Scenario: User should see the completion icons
|
|
|
37 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
38 |
Then I should see "New section" in the "courseindex-content" "region"
|
|
|
39 |
And I should see "Activity sample 1" in the "courseindex-content" "region"
|
|
|
40 |
And "To do" "icon" should exist in the "courseindex-content" "region"
|
|
|
41 |
|
|
|
42 |
@javascript
|
|
|
43 |
Scenario: Manual completion should update the course index completion
|
|
|
44 |
Given I am on the "C1" "Course" page logged in as "student1"
|
|
|
45 |
And "To do" "icon" should exist in the "courseindex-content" "region"
|
|
|
46 |
When I press "Mark as done"
|
|
|
47 |
And I wait until "Done" "button" exists
|
|
|
48 |
Then "Done" "icon" should exist in the "courseindex-content" "region"
|
|
|
49 |
And I press "Done"
|
|
|
50 |
And I wait until "Mark as done" "button" exists
|
|
|
51 |
And "To do" "icon" should exist in the "courseindex-content" "region"
|
|
|
52 |
|
|
|
53 |
@javascript
|
|
|
54 |
Scenario: Manual completion in an activity page should update the course index
|
|
|
55 |
Given I am on the "sample1" "Activity" page logged in as "student1"
|
|
|
56 |
And "To do" "icon" should exist in the "courseindex-content" "region"
|
|
|
57 |
When I press "Mark as done"
|
|
|
58 |
And I wait until "Done" "button" exists
|
|
|
59 |
Then "Done" "icon" should exist in the "courseindex-content" "region"
|
|
|
60 |
And I press "Done"
|
|
|
61 |
And I wait until "Mark as done" "button" exists
|
|
|
62 |
And "To do" "icon" should exist in the "courseindex-content" "region"
|
|
|
63 |
|
|
|
64 |
@javascript
|
|
|
65 |
Scenario: Refresh the page should keep the completion consistent
|
|
|
66 |
Given I am on the "C1" "Course" page logged in as "student1"
|
|
|
67 |
And "To do" "icon" should exist in the "courseindex-content" "region"
|
|
|
68 |
When I press "Mark as done"
|
|
|
69 |
And I wait until "Done" "button" exists
|
|
|
70 |
And I reload the page
|
|
|
71 |
Then the manual completion button of "Activity sample 1" is displayed as "Done"
|
|
|
72 |
|
|
|
73 |
@javascript
|
|
|
74 |
Scenario: Auto completion should appear in the course index
|
|
|
75 |
Given the following "activities" exist:
|
|
|
76 |
| activity | name | intro | course | idnumber | section | completion | completionview |
|
|
|
77 |
| assign | Activity sample 2 | Test assignment description | C1 | sample2 | 1 | 1 | 1 |
|
|
|
78 |
When I am on the "sample2" "Activity" page logged in as "student1"
|
|
|
79 |
And I am on the "C1" "Course" page
|
|
|
80 |
Then "Done" "icon" should exist in the "courseindex-content" "region"
|
|
|
81 |
|
|
|
82 |
@javascript
|
|
|
83 |
Scenario: Completion failed should appear in the course index
|
|
|
84 |
Given the following "question categories" exist:
|
|
|
85 |
| contextlevel | reference | name |
|
|
|
86 |
| Course | C1 | Test questions |
|
|
|
87 |
And the following "questions" exist:
|
|
|
88 |
| questioncategory | qtype | name | questiontext |
|
|
|
89 |
| Test questions | truefalse | First question | Answer the first question |
|
|
|
90 |
And the following "activities" exist:
|
|
|
91 |
| activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpassgrade | completionattemptsexhausted |
|
|
|
92 |
| quiz | Test quiz name | C1 | quiz1 | 1 | 5.00 | 2 | 1 | 1 | 1 |
|
|
|
93 |
And quiz "Test quiz name" contains the following questions:
|
|
|
94 |
| question | page |
|
|
|
95 |
| First question | 1 |
|
|
|
96 |
And user "student1" has attempted "Test quiz name" with responses:
|
|
|
97 |
| slot | response |
|
|
|
98 |
| 1 | False |
|
|
|
99 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
100 |
And "Failed" "icon" should exist in the "courseindex-content" "region"
|
|
|
101 |
|
|
|
102 |
@javascript
|
|
|
103 |
Scenario: Completion passed should appear in the course index
|
|
|
104 |
Given the following "question categories" exist:
|
|
|
105 |
| contextlevel | reference | name |
|
|
|
106 |
| Course | C1 | Test questions |
|
|
|
107 |
And the following "questions" exist:
|
|
|
108 |
| questioncategory | qtype | name | questiontext |
|
|
|
109 |
| Test questions | truefalse | First question | Answer the first question |
|
|
|
110 |
And the following "activities" exist:
|
|
|
111 |
| activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpassgrade | completionattemptsexhausted |
|
|
|
112 |
| quiz | Test quiz name | C1 | quiz1 | 1 | 5.00 | 2 | 1 | 1 | 1 |
|
|
|
113 |
And quiz "Test quiz name" contains the following questions:
|
|
|
114 |
| question | page |
|
|
|
115 |
| First question | 1 |
|
|
|
116 |
And user "student1" has attempted "Test quiz name" with responses:
|
|
|
117 |
| slot | response |
|
|
|
118 |
| 1 | True |
|
|
|
119 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
120 |
And "Done" "icon" should exist in the "courseindex-content" "region"
|
|
|
121 |
|
|
|
122 |
@javascript
|
|
|
123 |
Scenario: Completion done should appear in the course index when the requirement is any grade
|
|
|
124 |
Given the following "question categories" exist:
|
|
|
125 |
| contextlevel | reference | name |
|
|
|
126 |
| Course | C1 | Test questions |
|
|
|
127 |
And the following "questions" exist:
|
|
|
128 |
| questioncategory | qtype | name | questiontext |
|
|
|
129 |
| Test questions | truefalse | First question | Answer the first question |
|
|
|
130 |
And the following "activities" exist:
|
|
|
131 |
| activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpassgrade |
|
|
|
132 |
| quiz | Test quiz name | C1 | quiz1 | 1 | 5.00 | 2 | 1 | 0 |
|
|
|
133 |
And quiz "Test quiz name" contains the following questions:
|
|
|
134 |
| question | page |
|
|
|
135 |
| First question | 1 |
|
|
|
136 |
And user "student1" has attempted "Test quiz name" with responses:
|
|
|
137 |
| slot | response |
|
|
|
138 |
| 1 | False |
|
|
|
139 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
140 |
And "Done" "icon" should exist in the "courseindex-content" "region"
|
|
|
141 |
|
|
|
142 |
@javascript
|
|
|
143 |
Scenario: Activities with custom completion rules could fail
|
|
|
144 |
Given the following "activity" exists:
|
|
|
145 |
| activity | scorm |
|
|
|
146 |
| course | C1 |
|
|
|
147 |
| name | Music history |
|
|
|
148 |
| packagefilepath | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip |
|
|
|
149 |
| maxattempt | 1 |
|
|
|
150 |
| latattemptlock | 1 |
|
|
|
151 |
# Add requirements
|
|
|
152 |
| completion | 2 |
|
|
|
153 |
| completionscorerequired | 90 |
|
|
|
154 |
Given I am on the "Music history" "scorm activity" page logged in as student1
|
|
|
155 |
# We need a little taller window because Firefox is, apparently, unable to auto-scroll within
|
|
|
156 |
# an iframe, so we need to ensure that the "Save changes" button is visible in the viewport.
|
|
|
157 |
And I change window size to "large"
|
|
|
158 |
And I press "Enter"
|
|
|
159 |
And I switch to the main frame
|
|
|
160 |
And I click on "Par?" "list_item"
|
|
|
161 |
And I switch to "scorm_object" iframe
|
|
|
162 |
And I wait until the page is ready
|
|
|
163 |
And I switch to the main frame
|
|
|
164 |
And I click on "Keeping Score" "list_item"
|
|
|
165 |
And I switch to "scorm_object" iframe
|
|
|
166 |
And I wait until the page is ready
|
|
|
167 |
And I switch to the main frame
|
|
|
168 |
And I click on "Other Scoring Systems" "list_item"
|
|
|
169 |
And I switch to "scorm_object" iframe
|
|
|
170 |
And I wait until the page is ready
|
|
|
171 |
And I switch to the main frame
|
|
|
172 |
And I click on "The Rules of Golf" "list_item"
|
|
|
173 |
And I switch to "scorm_object" iframe
|
|
|
174 |
And I wait until the page is ready
|
|
|
175 |
And I switch to the main frame
|
|
|
176 |
And I click on "Playing Golf Quiz" "list_item"
|
|
|
177 |
And I switch to "scorm_object" iframe
|
|
|
178 |
And I wait until the page is ready
|
|
|
179 |
And I click on "[id='question_com.scorm.golfsamples.interactions.playing_1_1']" "css_element"
|
|
|
180 |
And I press "Submit Answers"
|
|
|
181 |
And I wait until "Score: 20" "text" exists
|
|
|
182 |
And I switch to the main frame
|
|
|
183 |
And I click on "Exit activity" "link"
|
|
|
184 |
And "Failed" "icon" should exist in the "courseindex-content" "region"
|