1 |
efrain |
1 |
@mod @mod_lti
|
|
|
2 |
Feature: Manage course tools
|
|
|
3 |
In order to provide richer experiences for learners
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to add external tools to a course
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
|
|
|
11 |
And the following "course" exists:
|
|
|
12 |
| fullname | Course 1 |
|
|
|
13 |
| shortname | C1 |
|
|
|
14 |
| category | 0 |
|
|
|
15 |
| format | topics |
|
|
|
16 |
| numsections | 1 |
|
|
|
17 |
And the following "course enrolments" exist:
|
|
|
18 |
| user | course | role |
|
|
|
19 |
| teacher1 | C1 | editingteacher |
|
|
|
20 |
And the following config values are set as admin:
|
|
|
21 |
| enableasyncbackup | 0 |
|
|
|
22 |
|
|
|
23 |
Scenario: Create a course tool from the zero state
|
|
|
24 |
Given I am on the "Course 1" course page logged in as teacher1
|
|
|
25 |
And I navigate to "LTI External tools" in current page administration
|
|
|
26 |
And I should see "LTI External tools are add-on apps"
|
|
|
27 |
And I should see "There are no LTI External tools yet."
|
|
|
28 |
When I click on "Add tool" "link"
|
|
|
29 |
And I press "Cancel"
|
|
|
30 |
Then I should see "LTI External tools are add-on apps"
|
|
|
31 |
And I should see "There are no LTI External tools yet."
|
|
|
32 |
And I click on "Add tool" "link"
|
|
|
33 |
And I set the following fields to these values:
|
|
|
34 |
| Tool name | Teaching Tool 1 |
|
|
|
35 |
| Tool URL | http://example.com |
|
|
|
36 |
| Tool description | A short description of the tool |
|
|
|
37 |
And I press "Save changes"
|
|
|
38 |
And I should see "Teaching Tool 1 added"
|
|
|
39 |
And I should see "A short description of the tool" in the "Teaching Tool 1" "table_row"
|
|
|
40 |
|
|
|
41 |
Scenario: Viewing a site level tool in the course tools table
|
|
|
42 |
# The first tool isn't visible in courses, the next two are, and the last tool is in a pending state and is not visible.
|
|
|
43 |
Given the following "mod_lti > tool types" exist:
|
|
|
44 |
| name | description | baseurl | coursevisible | state |
|
|
|
45 |
| Example tool | Another description | https://example.com/tool1 | 0 | 1 |
|
|
|
46 |
| Test tool 2 | Tool2 description | https://example.com/tool2 | 1 | 1 |
|
|
|
47 |
| Test tool 3 | Tool3 description | https://example.com/tool3 | 2 | 1 |
|
|
|
48 |
| Test tool 4 | Tool4 description | https://example.com/tool4 | 2 | 2 |
|
|
|
49 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
50 |
When I navigate to "LTI External tools" in current page administration
|
|
|
51 |
Then I should see "Test tool 2" in the "reportbuilder-table" "table"
|
|
|
52 |
And "You don't have permission to edit this tool" "icon" should exist in the "Test tool 2" "table_row"
|
|
|
53 |
And I should see "Test tool 3" in the "reportbuilder-table" "table"
|
|
|
54 |
And "You don't have permission to edit this tool" "icon" should exist in the "Test tool 3" "table_row"
|
|
|
55 |
And I should not see "Example tool" in the "reportbuilder-table" "table"
|
|
|
56 |
And I should not see "Test tool 4" in the "reportbuilder-table" "table"
|
|
|
57 |
|
|
|
58 |
Scenario: Viewing course tools without the capability to add/edit but having the capability to use
|
|
|
59 |
Given the following "role capability" exists:
|
|
|
60 |
| role | editingteacher |
|
|
|
61 |
| mod/lti:addcoursetool | prohibit |
|
|
|
62 |
| mod/lti:addpreconfiguredinstance | allow |
|
|
|
63 |
And the following "mod_lti > course tools" exist:
|
|
|
64 |
| name | description | baseurl | course |
|
|
|
65 |
| Test tool | Example description | https://example.com/tool | C1 |
|
|
|
66 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
67 |
When I navigate to "LTI External tools" in current page administration
|
|
|
68 |
Then "You don't have permission to edit this tool" "icon" should exist in the "Test tool" "table_row"
|
|
|
69 |
|
|
|
70 |
Scenario: Viewing course tools with the capability to add/edit and without the capability to use
|
|
|
71 |
Given the following "role capability" exists:
|
|
|
72 |
| role | editingteacher |
|
|
|
73 |
| mod/lti:addcoursetool | allow |
|
|
|
74 |
| mod/lti:addpreconfiguredinstance | prohibit |
|
|
|
75 |
And the following "mod_lti > course tools" exist:
|
|
|
76 |
| name | description | baseurl | course |
|
|
|
77 |
| Test tool | Example description | https://example.com/tool | C1 |
|
|
|
78 |
When I am on the "Course 1" course page logged in as teacher1
|
|
|
79 |
Then "LTI External tools" "link" should not exist in current page administration
|
|
|
80 |
|
|
|
81 |
@javascript
|
|
|
82 |
Scenario: Edit a course tool
|
|
|
83 |
Given the following "mod_lti > course tools" exist:
|
|
|
84 |
| name | description | baseurl | course |
|
|
|
85 |
| Test tool | Example description | https://example.com/tool | C1 |
|
|
|
86 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
87 |
And I navigate to "LTI External tools" in current page administration
|
|
|
88 |
And the "Edit" item should exist in the "Actions" action menu of the "Test tool" "table_row"
|
|
|
89 |
And the "Delete" item should exist in the "Actions" action menu of the "Test tool" "table_row"
|
|
|
90 |
When I open the action menu in "Test tool" "table_row"
|
|
|
91 |
And I choose "Edit" in the open action menu
|
|
|
92 |
And I press "Cancel"
|
|
|
93 |
Then I should see "Test tool" in the "reportbuilder-table" "table"
|
|
|
94 |
And I open the action menu in "Test tool" "table_row"
|
|
|
95 |
And I choose "Edit" in the open action menu
|
|
|
96 |
And I set the following fields to these values:
|
|
|
97 |
| Tool name | Test tool (edited) |
|
|
|
98 |
| Tool URL | http://example.com |
|
|
|
99 |
| Tool description | A short description of the tool (edited) |
|
|
|
100 |
And I press "Save changes"
|
|
|
101 |
And I should see "Changes saved"
|
|
|
102 |
And I should see "A short description of the tool (edited)" in the "Test tool (edited)" "table_row"
|
|
|
103 |
|
|
|
104 |
@javascript
|
|
|
105 |
Scenario: Navigate through the listing of course tools
|
|
|
106 |
Given 20 "mod_lti > course tools" exist with the following data:
|
|
|
107 |
| name | Test tool [count] |
|
|
|
108 |
| description | Example description [count] |
|
|
|
109 |
| baseurl | https://www.example.com/tool[count] |
|
|
|
110 |
| course | C1 |
|
|
|
111 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
112 |
When I navigate to "LTI External tools" in current page administration
|
|
|
113 |
Then I should see "Test tool 1" in the "reportbuilder-table" "table"
|
|
|
114 |
And I click on "Name" "link"
|
|
|
115 |
And I should see "Test tool 20" in the "reportbuilder-table" "table"
|
|
|
116 |
And I click on "2" "link" in the "page" "region"
|
|
|
117 |
And I should see "Test tool 1" in the "reportbuilder-table" "table"
|
|
|
118 |
|
|
|
119 |
@javascript
|
|
|
120 |
Scenario: Delete a course tool
|
|
|
121 |
Given the following "mod_lti > course tools" exist:
|
|
|
122 |
| name | description | baseurl | course |
|
|
|
123 |
| Test tool | Example description | https://example.com/tool | C1 |
|
|
|
124 |
| Another tool | Example 123 | https://another.example.com/tool | C1 |
|
|
|
125 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
126 |
And I navigate to "LTI External tools" in current page administration
|
|
|
127 |
When I open the action menu in "Test tool" "table_row"
|
|
|
128 |
And I choose "Delete" in the open action menu
|
|
|
129 |
Then I should see "This will delete Test tool from the available LTI tools in your course."
|
|
|
130 |
And I click on "Cancel" "button" in the "Delete Test tool" "dialogue"
|
|
|
131 |
And I should see "Test tool" in the "reportbuilder-table" "table"
|
|
|
132 |
And I open the action menu in "Test tool" "table_row"
|
|
|
133 |
And I choose "Delete" in the open action menu
|
|
|
134 |
And I should see "This will delete Test tool from the available LTI tools in your course."
|
|
|
135 |
And I click on "Delete" "button" in the "Delete Test tool" "dialogue"
|
|
|
136 |
And I should see "Test tool deleted"
|
|
|
137 |
And I should not see "Test tool" in the "reportbuilder-table" "table"
|
|
|
138 |
|
|
|
139 |
@javascript
|
|
|
140 |
Scenario: Add a course tool using a cartridge URL
|
|
|
141 |
Given I am on the "Course 1" course page logged in as teacher1
|
|
|
142 |
And I navigate to "LTI External tools" in current page administration
|
|
|
143 |
When I click on "Add tool" "link"
|
|
|
144 |
And I set the following fields to these values:
|
|
|
145 |
| Tool name | Test tool 1 |
|
|
|
146 |
| Tool description | Test tool 1 description |
|
|
|
147 |
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml"
|
|
|
148 |
And I press "Save changes"
|
|
|
149 |
Then I should see "Test tool 1" in the "reportbuilder-table" "table"
|
|
|
150 |
# The cartridge description, if set, overrides the description set in the type edit form (bug?).
|
|
|
151 |
And I should see "Example tool description" in the "Test tool 1" "table_row"
|
|
|
152 |
And I open the action menu in "Test tool 1" "table_row"
|
|
|
153 |
And I choose "Edit" in the open action menu
|
|
|
154 |
And the field "Tool name" matches value "Test tool 1"
|
|
|
155 |
And the field "Tool URL" matches value "http://www.example.com/lti/provider.php"
|
|
|
156 |
And the field "Icon URL" matches value "http://download.moodle.org/unittest/test.jpg"
|
|
|
157 |
And the field "Secure icon URL" matches value "https://download.moodle.org/unittest/test.jpg"
|
|
|
158 |
|
|
|
159 |
@javascript
|
|
|
160 |
Scenario: Site tool appearing in activity chooser according to settings
|
|
|
161 |
Given the following "mod_lti > tool types" exist:
|
|
|
162 |
| name | baseurl | coursevisible | state |
|
|
|
163 |
| Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 |
|
|
|
164 |
| Teaching Tool 2 | /mod/lti/tests/fixtures/tool_provider.php | 1 | 1 |
|
|
|
165 |
| Teaching Tool 3 | /mod/lti/tests/fixtures/tool_provider.php | 0 | 1 |
|
|
|
166 |
And the following "courses" exist:
|
|
|
167 |
| fullname | shortname | category |
|
|
|
168 |
| Course 2 | C2 | 0 |
|
|
|
169 |
And the following "course enrolments" exist:
|
|
|
170 |
| user | course | role |
|
|
|
171 |
| teacher1 | C2 | editingteacher |
|
|
|
172 |
And I log in as "teacher1"
|
|
|
173 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
174 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
175 |
And I should see "Teaching Tool 1" in the ".modal-body" "css_element"
|
|
|
176 |
And I should not see "Teaching Tool 2" in the ".modal-body" "css_element"
|
|
|
177 |
And I should not see "Teaching Tool 3" in the ".modal-body" "css_element"
|
|
|
178 |
And I click on "Close" "button" in the ".modal-dialog" "css_element"
|
|
|
179 |
And I navigate to "LTI External tools" in current page administration
|
|
|
180 |
And I should not see "Teaching Tool 3"
|
|
|
181 |
And I click on "Don't show in activity chooser" "field" in the "Teaching Tool 1" "table_row"
|
|
|
182 |
And I click on "Show in activity chooser" "field" in the "Teaching Tool 2" "table_row"
|
|
|
183 |
And I am on "Course 1" course homepage
|
|
|
184 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
185 |
And I should not see "Teaching Tool 1" in the ".modal-body" "css_element"
|
|
|
186 |
And I should see "Teaching Tool 2" in the ".modal-body" "css_element"
|
|
|
187 |
And I should not see "Teaching Tool 3" in the ".modal-body" "css_element"
|
|
|
188 |
And I click on "Close" "button" in the ".modal-dialog" "css_element"
|
|
|
189 |
|
|
|
190 |
# Should not affect other courses.
|
|
|
191 |
And I am on "Course 2" course homepage
|
|
|
192 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
193 |
And I should see "Teaching Tool 1" in the ".modal-body" "css_element"
|
|
|
194 |
And I should not see "Teaching Tool 2" in the ".modal-body" "css_element"
|
|
|
195 |
And I should not see "Teaching Tool 3" in the ".modal-body" "css_element"
|
|
|
196 |
And I click on "Close" "button" in the ".modal-dialog" "css_element"
|
|
|
197 |
|
|
|
198 |
And I am on "Course 1" course homepage
|
|
|
199 |
And I navigate to "LTI External tools" in current page administration
|
|
|
200 |
And I click on "Show in activity chooser" "field" in the "Teaching Tool 1" "table_row"
|
|
|
201 |
And I click on "Don't show in activity chooser" "field" in the "Teaching Tool 2" "table_row"
|
|
|
202 |
And I am on "Course 1" course homepage
|
|
|
203 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
204 |
And I should see "Teaching Tool 1" in the ".modal-body" "css_element"
|
|
|
205 |
And I should not see "Teaching Tool 2" in the ".modal-body" "css_element"
|
|
|
206 |
And I should not see "Teaching Tool 3" in the ".modal-body" "css_element"
|
|
|
207 |
|
|
|
208 |
When the following "role capability" exists:
|
|
|
209 |
| role | editingteacher |
|
|
|
210 |
| mod/lti:addcoursetool | prohibit |
|
|
|
211 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
212 |
And I navigate to "LTI External tools" in current page administration
|
|
|
213 |
Then the "Don't show in activity chooser" "field" should be disabled
|
|
|
214 |
And the "Show in activity chooser" "field" should be disabled
|
|
|
215 |
|
|
|
216 |
@javascript
|
|
|
217 |
Scenario: Course tool appearing in activity chooser according to settings
|
|
|
218 |
Given the following "mod_lti > course tools" exist:
|
|
|
219 |
| name | baseurl | course | coursevisible |
|
|
|
220 |
| Course Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | C1 | 2 |
|
|
|
221 |
| Course Tool 2 | /mod/lti/tests/fixtures/tool_provider.php | C1 | 1 |
|
|
|
222 |
And I log in as "teacher1"
|
|
|
223 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
224 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
225 |
And I should see "Course Tool 1" in the ".modal-body" "css_element"
|
|
|
226 |
And I should not see "Course Tool 2" in the ".modal-body" "css_element"
|
|
|
227 |
And I click on "Close" "button" in the ".modal-dialog" "css_element"
|
|
|
228 |
And I navigate to "LTI External tools" in current page administration
|
|
|
229 |
And I click on "Don't show in activity chooser" "field" in the "Course Tool 1" "table_row"
|
|
|
230 |
And I click on "Show in activity chooser" "field" in the "Course Tool 2" "table_row"
|
|
|
231 |
And I am on "Course 1" course homepage
|
|
|
232 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
233 |
And I should not see "Course Tool 1" in the ".modal-body" "css_element"
|
|
|
234 |
And I should see "Course Tool 2" in the ".modal-body" "css_element"
|
|
|
235 |
And I click on "Close" "button" in the ".modal-dialog" "css_element"
|
|
|
236 |
And I navigate to "LTI External tools" in current page administration
|
|
|
237 |
And I click on "Show in activity chooser" "field" in the "Course Tool 1" "table_row"
|
|
|
238 |
And I click on "Don't show in activity chooser" "field" in the "Course Tool 2" "table_row"
|
|
|
239 |
And I am on "Course 1" course homepage
|
|
|
240 |
And I click on "Add an activity or resource" "button" in the "New section" "section"
|
|
|
241 |
And I should see "Course Tool 1" in the ".modal-body" "css_element"
|
|
|
242 |
And I should not see "Course Tool 2" in the ".modal-body" "css_element"
|
|
|
243 |
|
|
|
244 |
When the following "role capability" exists:
|
|
|
245 |
| role | editingteacher |
|
|
|
246 |
| mod/lti:addcoursetool | prohibit |
|
|
|
247 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
248 |
And I navigate to "LTI External tools" in current page administration
|
|
|
249 |
Then the "Don't show in activity chooser" "field" should be disabled
|
|
|
250 |
And the "Show in activity chooser" "field" should be disabled
|
|
|
251 |
|
|
|
252 |
@javascript
|
|
|
253 |
Scenario: Site and course tools settings are preserved when backup and restore
|
|
|
254 |
Given the following "mod_lti > tool types" exist:
|
|
|
255 |
| name | baseurl | coursevisible | state |
|
|
|
256 |
| Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 |
|
|
|
257 |
| Teaching Tool 2 | /mod/lti/tests/fixtures/tool_provider.php | 1 | 1 |
|
|
|
258 |
And the following "mod_lti > course tools" exist:
|
|
|
259 |
| name | description | baseurl | course |
|
|
|
260 |
| Course Tool 1 | Example description | https://example.com/tool | C1 |
|
|
|
261 |
And I log in as "admin"
|
|
|
262 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
263 |
And I add a "Teaching Tool 1" to section "1" using the activity chooser
|
|
|
264 |
And I set the field "Activity name" to "Test tool activity 1"
|
|
|
265 |
And I press "Save and return to course"
|
|
|
266 |
And I add a "Course Tool 1" to section "1" using the activity chooser
|
|
|
267 |
And I set the field "Activity name" to "Course tool activity 1"
|
|
|
268 |
And I press "Save and return to course"
|
|
|
269 |
And I navigate to "LTI External tools" in current page administration
|
|
|
270 |
And I click on "Don't show in activity chooser" "field" in the "Teaching Tool 1" "table_row"
|
|
|
271 |
And I click on "Show in activity chooser" "field" in the "Teaching Tool 2" "table_row"
|
|
|
272 |
And I click on "Don't show in activity chooser" "field" in the "Course Tool 1" "table_row"
|
|
|
273 |
And I am on "Course 1" course homepage
|
|
|
274 |
And I add a "Teaching Tool 2" to section "1" using the activity chooser
|
|
|
275 |
And I set the field "Activity name" to "Test tool activity 2"
|
|
|
276 |
And I press "Save and return to course"
|
|
|
277 |
When I backup "Course 1" course using this options:
|
|
|
278 |
| Confirmation | Filename | test_backup.mbz |
|
|
|
279 |
And I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
280 |
| Schema | Course name | Restored course |
|
|
|
281 |
And I should see "Restored course"
|
|
|
282 |
And I click on "Add an activity or resource" "button" in the "General" "section"
|
|
|
283 |
Then I should not see "Teaching Tool 1" in the ".modal-body" "css_element"
|
|
|
284 |
And I should see "Teaching Tool 2" in the ".modal-body" "css_element"
|
|
|
285 |
And I should not see "Course Tool 2" in the ".modal-body" "css_element"
|
|
|
286 |
And I click on "Close" "button" in the ".modal-dialog" "css_element"
|
|
|
287 |
And I navigate to "LTI External tools" in current page administration
|
|
|
288 |
And I should see "Show in activity chooser" in the "Teaching Tool 1" "table_row"
|
|
|
289 |
And I should see "Don't show in activity chooser" in the "Teaching Tool 2" "table_row"
|
|
|
290 |
And I should see "Show in activity chooser" in the "Course Tool 1" "table_row"
|