1 |
efrain |
1 |
@core @core_course @javascript
|
|
|
2 |
Feature: Display and choose from the available activities in course
|
|
|
3 |
In order to add activities to a course
|
|
|
4 |
As a teacher
|
|
|
5 |
I should be enabled to choose from a list of available activities and also being able to read their summaries.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher | Teacher | 1 | teacher@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | format | startdate |
|
|
|
13 |
| Course | C | topics | |
|
|
|
14 |
| Course 2 | C2 | weeks | 95713920 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher | C | editingteacher |
|
|
|
18 |
| teacher | C2 | editingteacher |
|
|
|
19 |
And the following config values are set as admin:
|
|
|
20 |
| enablemoodlenet | 0 | tool_moodlenet |
|
|
|
21 |
And I log in as "teacher"
|
|
|
22 |
And I am on "Course" course homepage with editing mode on
|
|
|
23 |
|
|
|
24 |
Scenario: The available activities are displayed to the teacher in the activity chooser
|
|
|
25 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
26 |
Then I should see "Add an activity or resource" in the ".modal-title" "css_element"
|
|
|
27 |
And I should see "Assignment" in the ".modal-body" "css_element"
|
|
|
28 |
|
|
|
29 |
Scenario: The teacher can choose to add an activity from the activity items in the activity chooser
|
|
|
30 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
31 |
When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
|
|
|
32 |
Then I should see "New Assignment"
|
|
|
33 |
And I set the following fields to these values:
|
|
|
34 |
| Assignment name | Test Assignment |
|
|
|
35 |
And I press "Save and return to course"
|
|
|
36 |
Then I should see "Test Assignment" in the "New section" "section"
|
|
|
37 |
|
|
|
38 |
Scenario: The teacher can choose to add an activity from the activity summary in the activity chooser
|
|
|
39 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
40 |
When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
41 |
When I click on "Add a new Assignment" "link" in the "help" "core_course > Activity chooser screen"
|
|
|
42 |
Then I should see "New Assignment"
|
|
|
43 |
|
|
|
44 |
Scenario: Show summary
|
|
|
45 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
46 |
When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
47 |
Then I should see "Assignment" in the "help" "core_course > Activity chooser screen"
|
|
|
48 |
And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback."
|
|
|
49 |
# Confirm show summary also works for weekly format course
|
|
|
50 |
And I am on "C2" course homepage with editing mode on
|
|
|
51 |
And I click on "Add an activity or resource" "button" in the "13 January - 19 January" "section"
|
|
|
52 |
And I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
53 |
And I should see "Assignment" in the "help" "core_course > Activity chooser screen"
|
|
|
54 |
And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback."
|
|
|
55 |
|
|
|
56 |
Scenario: Hide summary
|
|
|
57 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
58 |
When I click on "Information about the Assignment activity" "button" in the "modules" "core_course > Activity chooser screen"
|
|
|
59 |
And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "help" "core_course > Activity chooser screen"
|
|
|
60 |
And I should see "Back" in the "help" "core_course > Activity chooser screen"
|
|
|
61 |
When I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
|
|
|
62 |
Then "modules" "core_course > Activity chooser screen" should be visible
|
|
|
63 |
And "help" "core_course > Activity chooser screen" should not be visible
|
|
|
64 |
And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
|
|
|
65 |
And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"
|
|
|
66 |
# Confirm hide summary also works for weekly format course
|
|
|
67 |
And I am on "C2" course homepage with editing mode on
|
|
|
68 |
And I click on "Add an activity or resource" "button" in the "13 January - 19 January" "section"
|
|
|
69 |
And I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
70 |
And I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
|
|
|
71 |
And "modules" "core_course > Activity chooser screen" should be visible
|
|
|
72 |
And "help" "core_course > Activity chooser screen" should not be visible
|
|
|
73 |
And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
|
|
|
74 |
And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"
|
|
|
75 |
|
|
|
76 |
Scenario: View recommended activities
|
|
|
77 |
When I log out
|
|
|
78 |
And I log in as "admin"
|
|
|
79 |
And I am on site homepage
|
|
|
80 |
And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
|
|
|
81 |
And I click on ".activity-recommend-checkbox" "css_element" in the "Book" "table_row"
|
|
|
82 |
# Setup done, lets check it works with a teacher.
|
|
|
83 |
And I log out
|
|
|
84 |
And I log in as "teacher"
|
|
|
85 |
And I am on "Course" course homepage with editing mode on
|
|
|
86 |
And I open the activity chooser
|
|
|
87 |
Then I should see "Recommended" in the "Add an activity or resource" "dialogue"
|
|
|
88 |
And I click on "Recommended" "link" in the "Add an activity or resource" "dialogue"
|
|
|
89 |
And I should see "Book" in the "recommended" "core_course > Activity chooser tab"
|
|
|
90 |
|
|
|
91 |
Scenario: Favourite a module in the activity chooser
|
|
|
92 |
Given I open the activity chooser
|
|
|
93 |
And I should not see "Starred" in the "Add an activity or resource" "dialogue"
|
|
|
94 |
And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
95 |
And I should see "Starred" in the "Add an activity or resource" "dialogue"
|
|
|
96 |
When I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
|
|
|
97 |
Then I should see "Assignment" in the "favourites" "core_course > Activity chooser tab"
|
|
|
98 |
And I click on "Information about the Assignment activity" "button" in the "favourites" "core_course > Activity chooser tab"
|
|
|
99 |
And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback."
|
|
|
100 |
|
|
|
101 |
Scenario: Add a favourite module and check it exists when reopening the chooser
|
|
|
102 |
Given I open the activity chooser
|
|
|
103 |
And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
104 |
And I click on "Star Forum activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
105 |
And I should see "Starred" in the "Add an activity or resource" "dialogue"
|
|
|
106 |
And I click on "Close" "button" in the "Add an activity or resource" "dialogue"
|
|
|
107 |
When I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
108 |
And I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
|
|
|
109 |
Then I should see "Forum" in the "favourites" "core_course > Activity chooser tab"
|
|
|
110 |
|
|
|
111 |
Scenario: Add a favourite and then remove it whilst checking the tabs work as expected
|
|
|
112 |
Given I open the activity chooser
|
|
|
113 |
And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
114 |
And I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
|
|
|
115 |
And I click on "Star Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
116 |
Then I should not see "Starred" in the "Add an activity or resource" "dialogue"
|
|
|
117 |
|
|
|
118 |
Scenario: The teacher can search for an activity by it's name
|
|
|
119 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
120 |
When I set the field "search" to "Lesson"
|
|
|
121 |
Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
|
|
|
122 |
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
|
|
|
123 |
|
|
|
124 |
Scenario: The teacher can search for an activity by it's description
|
|
|
125 |
Given I open the activity chooser
|
|
|
126 |
When I set the field "search" to "The lesson activity module enables a teacher to deliver content"
|
|
|
127 |
Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
|
|
|
128 |
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
|
|
|
129 |
|
|
|
130 |
Scenario: Search results are not returned if the search query does not match any activity name or description
|
|
|
131 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
132 |
When I set the field "search" to "Random search query"
|
|
|
133 |
Then I should see "0 results found" in the "Add an activity or resource" "dialogue"
|
|
|
134 |
And ".option" "css_element" should not exist in the ".searchresultitemscontainer" "css_element"
|
|
|
135 |
|
|
|
136 |
Scenario: Teacher can return to the default activity chooser state by manually removing the search query
|
|
|
137 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
138 |
And I set the field "search" to "Lesson"
|
|
|
139 |
And I should see "1 results found" in the "Add an activity or resource" "dialogue"
|
|
|
140 |
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
|
|
|
141 |
When I set the field "search" to ""
|
|
|
142 |
And I should not see "1 results found" in the "Add an activity or resource" "dialogue"
|
|
|
143 |
Then ".searchresultscontainer" "css_element" should not be visible
|
|
|
144 |
And ".optionscontainer" "css_element" should exist
|
|
|
145 |
|
|
|
146 |
Scenario: Teacher can not see a "clear" button if a search query is not entered in the activity chooser search bar
|
|
|
147 |
When I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
148 |
Then "Clear search input" "button" should not be visible
|
|
|
149 |
|
|
|
150 |
Scenario: Teacher can see a "clear" button after entering a search query in the activity chooser search bar
|
|
|
151 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
152 |
When I set the field "search" to "Search query"
|
|
|
153 |
Then "Clear search input" "button" should not be visible
|
|
|
154 |
|
|
|
155 |
Scenario: Teacher can not see a "clear" button if the search query is removed in the activity chooser search bar
|
|
|
156 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
157 |
And I set the field "search" to "Search query"
|
|
|
158 |
And "Clear search input" "button" should exist
|
|
|
159 |
When I set the field "search" to ""
|
|
|
160 |
# Waiting for the animation to hide the button to finish.
|
|
|
161 |
And I wait "1" seconds
|
|
|
162 |
Then "Clear search input" "button" should not be visible
|
|
|
163 |
|
|
|
164 |
Scenario: Teacher can instantly remove the search query from the activity search bar by clicking on the "clear" button
|
|
|
165 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
166 |
And I set the field "search" to "Search query"
|
|
|
167 |
And I should see "results found" in the "Add an activity or resource" "dialogue"
|
|
|
168 |
When I click on "Clear search input" "button"
|
|
|
169 |
Then I should not see "Search query"
|
|
|
170 |
And ".searchresultscontainer" "css_element" should not be visible
|
|
|
171 |
And ".optionscontainer" "css_element" should exist
|
|
|
172 |
|
|
|
173 |
Scenario: Teacher gets the base case for the Activity Chooser tab mode
|
|
|
174 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
175 |
And I should see "Activities" in the "Add an activity or resource" "dialogue"
|
|
|
176 |
When I click on "Activities" "link" in the "Add an activity or resource" "dialogue"
|
|
|
177 |
Then I should not see "Book" in the "activity" "core_course > Activity chooser tab"
|
|
|
178 |
And I click on "Resources" "link" in the "Add an activity or resource" "dialogue"
|
|
|
179 |
And I should not see "Assignment" in the "resources" "core_course > Activity chooser tab"
|
|
|
180 |
|
|
|
181 |
Scenario: Teacher gets the simple case for the Activity Chooser tab mode
|
|
|
182 |
Given I log out
|
|
|
183 |
And I log in as "admin"
|
|
|
184 |
And I am on site homepage
|
|
|
185 |
When I navigate to "Courses > Activity chooser > Activity chooser settings" in site administration
|
|
|
186 |
And I select "Starred, All, Recommended" from the "Activity chooser tabs" singleselect
|
|
|
187 |
And I press "Save changes"
|
|
|
188 |
And I log out
|
|
|
189 |
And I log in as "teacher"
|
|
|
190 |
And I am on "Course" course homepage with editing mode on
|
|
|
191 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
192 |
Then I should not see "Activities" in the "Add an activity or resource" "dialogue"
|
|
|
193 |
And I should not see "Resources" in the "Add an activity or resource" "dialogue"
|
|
|
194 |
|
|
|
195 |
Scenario: Teacher gets the final case for the Activity Chooser tab mode
|
|
|
196 |
Given I log out
|
|
|
197 |
And I log in as "admin"
|
|
|
198 |
And I am on site homepage
|
|
|
199 |
When I navigate to "Courses > Activity chooser > Activity chooser settings" in site administration
|
|
|
200 |
And I select "Starred, Activities, Resources, Recommended" from the "Activity chooser tabs" singleselect
|
|
|
201 |
And I press "Save changes"
|
|
|
202 |
And I log out
|
|
|
203 |
And I log in as "teacher"
|
|
|
204 |
And I am on "Course" course homepage with editing mode on
|
|
|
205 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
206 |
Then I should not see "All" in the "Add an activity or resource" "dialogue"
|
|
|
207 |
And I should see "Activities" in the "Add an activity or resource" "dialogue"
|
|
|
208 |
And I should see "Resources" in the "Add an activity or resource" "dialogue"
|
|
|
209 |
|
|
|
210 |
Scenario: Recommended tab is displayed in the right position depending on the activitychoosertabmode setting
|
|
|
211 |
Given I log out
|
|
|
212 |
And I log in as "admin"
|
|
|
213 |
And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
|
|
|
214 |
And I click on ".activity-recommend-checkbox" "css_element" in the "Book" "table_row"
|
|
|
215 |
And the following config values are set as admin:
|
|
|
216 |
# 3 = Starred, Recommended, All, Activities, Resources
|
|
|
217 |
| activitychoosertabmode | 3 |
|
|
|
218 |
And I log out
|
|
|
219 |
And I log in as "teacher"
|
|
|
220 |
And I am on "Course" course homepage with editing mode on
|
|
|
221 |
When I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
222 |
Then "Recommended" "link" should appear before "All" "link" in the "Add an activity or resource" "dialogue"
|
|
|
223 |
But the following config values are set as admin:
|
|
|
224 |
# 0 = Starred, All, Activities, Resources, Recommended
|
|
|
225 |
| activitychoosertabmode | 0 |
|
|
|
226 |
And I reload the page
|
|
|
227 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
228 |
And "Recommended" "link" should appear after "Resources" "link" in the "Add an activity or resource" "dialogue"
|
|
|
229 |
But the following config values are set as admin:
|
|
|
230 |
# 1 = Starred, All, Recommended
|
|
|
231 |
| activitychoosertabmode | 1 |
|
|
|
232 |
And I reload the page
|
|
|
233 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
234 |
And "Recommended" "link" should appear after "All" "link" in the "Add an activity or resource" "dialogue"
|
|
|
235 |
But the following config values are set as admin:
|
|
|
236 |
# 2 = Starred, Activities, Resources, Recommended
|
|
|
237 |
| activitychoosertabmode | 2 |
|
|
|
238 |
And I reload the page
|
|
|
239 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
240 |
And "Recommended" "link" should appear after "Resources" "link" in the "Add an activity or resource" "dialogue"
|
|
|
241 |
But the following config values are set as admin:
|
|
|
242 |
# 4 = Starred, Recommended, All
|
|
|
243 |
| activitychoosertabmode | 4 |
|
|
|
244 |
And I reload the page
|
|
|
245 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
246 |
And "Recommended" "link" should appear before "All" "link" in the "Add an activity or resource" "dialogue"
|
|
|
247 |
But the following config values are set as admin:
|
|
|
248 |
# 5 = Starred, Recommended, Activities, Resources
|
|
|
249 |
| activitychoosertabmode | 5 |
|
|
|
250 |
And I reload the page
|
|
|
251 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
252 |
And "Recommended" "link" should appear before "Activities" "link" in the "Add an activity or resource" "dialogue"
|
|
|
253 |
|
|
|
254 |
Scenario: Teacher can navigate through activity chooser in Topics format course
|
|
|
255 |
When I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
256 |
Then I should see "All" in the "Add an activity or resource" "dialogue"
|
|
|
257 |
And I press the tab key
|
|
|
258 |
And I press the tab key
|
|
|
259 |
And I press the tab key
|
|
|
260 |
And I press the tab key
|
|
|
261 |
# Confirm right key works
|
|
|
262 |
And I press the right key
|
|
|
263 |
And I press the right key
|
|
|
264 |
And the focused element is "Choice" "menuitem" in the "Add an activity or resource" "dialogue"
|
|
|
265 |
# Confirm left key works
|
|
|
266 |
And I press the left key
|
|
|
267 |
And the focused element is "Book" "menuitem" in the "Add an activity or resource" "dialogue"
|
|
|
268 |
# Confirm clicking "x" button closes modal
|
|
|
269 |
And I click on "Close" "button" in the "Add an activity or resource" "dialogue"
|
|
|
270 |
And "Add an activity or resource" "dialogue" should not be visible
|
|
|
271 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
272 |
# Confirm escape key closes the modal
|
|
|
273 |
And I press the escape key
|
|
|
274 |
And "Add an activity or resource" "dialogue" should not be visible
|
|
|
275 |
|
|
|
276 |
Scenario: Teacher can navigate through activity chooser in Weekly format course
|
|
|
277 |
Given I am on "C2" course homepage with editing mode on
|
|
|
278 |
When I click on "Add an activity or resource" "button" in the "13 January - 19 January" "section"
|
|
|
279 |
Then I should see "All" in the "Add an activity or resource" "dialogue"
|
|
|
280 |
And I press the tab key
|
|
|
281 |
And I press the tab key
|
|
|
282 |
And I press the tab key
|
|
|
283 |
And I press the tab key
|
|
|
284 |
# Confirm right key works
|
|
|
285 |
And I press the right key
|
|
|
286 |
And I press the right key
|
|
|
287 |
And the focused element is "Choice" "menuitem" in the "Add an activity or resource" "dialogue"
|
|
|
288 |
# Confirm left key works
|
|
|
289 |
And I press the left key
|
|
|
290 |
And the focused element is "Book" "menuitem" in the "Add an activity or resource" "dialogue"
|
|
|
291 |
# Confirm clicking "x" button closes modal
|
|
|
292 |
And I click on "Close" "button" in the "Add an activity or resource" "dialogue"
|
|
|
293 |
And "Add an activity or resource" "dialogue" should not be visible
|
|
|
294 |
And I click on "Add an activity or resource" "button" in the "13 January - 19 January" "section"
|
|
|
295 |
# Confirm escape key closes the modal
|
|
|
296 |
And I press the escape key
|
|
|
297 |
And "Add an activity or resource" "dialogue" should not be visible
|
|
|
298 |
|
|
|
299 |
Scenario: Teacher can access 'More help' from activity information in activity chooser
|
|
|
300 |
Given I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
301 |
When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
302 |
# Confirm more help link exists
|
|
|
303 |
Then "More help" "link" should exist
|
|
|
304 |
# Confirm that corresponding help icon exist
|
|
|
305 |
And ".iconhelp" "css_element" should exist
|
|
|
306 |
# Confirm that link opens in new window
|
|
|
307 |
And "Opens in new window" "link" should be visible
|
|
|
308 |
# Confirm the same behaviour for weekly format course
|
|
|
309 |
And I am on "C2" course homepage with editing mode on
|
|
|
310 |
And I click on "Add an activity or resource" "button" in the "13 January - 19 January" "section"
|
|
|
311 |
And I should see "All" in the "Add an activity or resource" "dialogue"
|
|
|
312 |
And I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
|
|
|
313 |
# Confirm more help link exists
|
|
|
314 |
And "More help" "link" should exist
|
|
|
315 |
# Confirm that corresponding help icon exist
|
|
|
316 |
And ".iconhelp" "css_element" should exist
|
|
|
317 |
# Confirm that link opens in new window
|
|
|
318 |
And "Opens in new window" "link" should be visible
|