1 |
efrain |
1 |
@mod @mod_lti
|
|
|
2 |
Feature: Make an LTI only available to specific course categories
|
|
|
3 |
In order to restrict which courses a tool can be used in
|
|
|
4 |
As an administrator
|
|
|
5 |
I need to be able to select which course category the tool is available in
|
|
|
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 "categories" exist:
|
|
|
12 |
| name | category | idnumber |
|
|
|
13 |
| cata | 0 | cata |
|
|
|
14 |
| catca | cata | catca |
|
|
|
15 |
| catb | 0 | catb |
|
|
|
16 |
| catcb | catb | catcb |
|
|
|
17 |
And the following "courses" exist:
|
|
|
18 |
| fullname | shortname | category |
|
|
|
19 |
| Course 1 | C1 | cata |
|
|
|
20 |
| Course 2 | C2 | catb |
|
|
|
21 |
| Course 3 | C3 | catca |
|
|
|
22 |
And the following "course enrolments" exist:
|
|
|
23 |
| user | course | role |
|
|
|
24 |
| teacher1 | C1 | editingteacher |
|
|
|
25 |
| teacher1 | C2 | editingteacher |
|
|
|
26 |
| teacher1 | C3 | editingteacher |
|
|
|
27 |
And the following "mod_lti > tool types" exist:
|
|
|
28 |
| name | description | baseurl | coursevisible | state | lti_coursecategories |
|
|
|
29 |
| Teaching Tool 1 | Tool 1 description | /mod/lti/tests/fixtures/tool_provider.php | 1 | 1 | catb |
|
|
|
30 |
| Teaching Tool 2 | Tool 2 description | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 | catca |
|
|
|
31 |
|
|
|
32 |
Scenario: Tool is set to "Show as preconfigured tool when adding an external tool" on parent category
|
|
|
33 |
Given I am on the "Course 2" course page logged in as teacher1
|
|
|
34 |
When I navigate to "LTI External tools" in current page administration
|
|
|
35 |
Then I should see "Teaching Tool 1" in the "reportbuilder-table" "table"
|
|
|
36 |
And I should not see "Teaching Tool 2" in the "reportbuilder-table" "table"
|
|
|
37 |
|
|
|
38 |
@javascript
|
|
|
39 |
Scenario: Tool is set to "Show in activity chooser and as preconfigured tool" on child category
|
|
|
40 |
Given I log in as "teacher1"
|
|
|
41 |
When I am on "Course 3" course homepage with editing mode on
|
|
|
42 |
And I open the activity chooser
|
|
|
43 |
Then I should see "Teaching Tool 2" in the "Add an activity or resource" "dialogue"
|
|
|
44 |
And I should not see "Teaching Tool 1" in the "Add an activity or resource" "dialogue"
|
|
|
45 |
|
|
|
46 |
@javascript
|
|
|
47 |
Scenario: View a course in a category in which no tools are available
|
|
|
48 |
Given I log in as "teacher1"
|
|
|
49 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
50 |
And I open the activity chooser
|
|
|
51 |
Then I should not see "Teaching Tool 1" in the "Add an activity or resource" "dialogue"
|
|
|
52 |
And I should not see "Teaching Tool 2" in the "Add an activity or resource" "dialogue"
|
|
|
53 |
|
|
|
54 |
@javascript
|
|
|
55 |
Scenario: Editing and saving selected parent / child categories
|
|
|
56 |
Given I log in as "admin"
|
|
|
57 |
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
|
|
|
58 |
And I follow "Manage preconfigured tools"
|
|
|
59 |
And I follow "Add preconfigured tool"
|
|
|
60 |
And I expand all fieldsets
|
|
|
61 |
And I click on "catb" "link"
|
|
|
62 |
And I set the following fields to these values:
|
|
|
63 |
| Tool name | Teaching Tool 3 |
|
|
|
64 |
| Tool configuration usage | Do not show; use only when a matching tool URL is entered |
|
|
|
65 |
| catb | 1 |
|
|
|
66 |
# If parent is selected, child should be selected.
|
|
|
67 |
And the field "catcb" matches value "1"
|
|
|
68 |
# If parent is unselected, child should be unselected.
|
|
|
69 |
And I set the following fields to these values:
|
|
|
70 |
| catb | 0 |
|
|
|
71 |
And the field "catcb" matches value "0"
|
|
|
72 |
# If parent is selected, child is unselected, parent should still be selected.
|
|
|
73 |
# Step 1 - Select parent first so child is selected.
|
|
|
74 |
And I set the following fields to these values:
|
|
|
75 |
| catb | 1 |
|
|
|
76 |
And the field "catcb" matches value "1"
|
|
|
77 |
# Step 2 - Unselect child but parent should stay as selected.
|
|
|
78 |
And I set the following fields to these values:
|
|
|
79 |
| catcb | 0 |
|
|
|
80 |
And the field "catb" matches value "1"
|
|
|
81 |
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/tool_provider.php"
|
|
|
82 |
And I press "Save changes"
|
|
|
83 |
And I wait until the page is ready
|
|
|
84 |
And I should see "Teaching Tool 3"
|
|
|
85 |
When I click on "Update" "link" in the "Teaching Tool 3" "table_row"
|
|
|
86 |
And I expand all fieldsets
|
|
|
87 |
Then the following fields match these values:
|
|
|
88 |
| catb | 1 |
|
|
|
89 |
| catcb | 0 |
|
|
|
90 |
|
|
|
91 |
@javascript
|
|
|
92 |
Scenario: Category restriction only shown for a site tool
|
|
|
93 |
Given the following "mod_lti > tool types" exist:
|
|
|
94 |
| name | baseurl | coursevisible | state |
|
|
|
95 |
| Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 |
|
|
|
96 |
And the following "mod_lti > course tools" exist:
|
|
|
97 |
| name | description | baseurl | course |
|
|
|
98 |
| Course Tool 1 | Example description | https://example.com/tool | C1 |
|
|
|
99 |
And I log in as "admin"
|
|
|
100 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
101 |
And I navigate to "LTI External tools" in current page administration
|
|
|
102 |
When I click on "Add tool" "link"
|
|
|
103 |
And I should not see "Restrict to category"
|
|
|
104 |
And I press "Cancel"
|
|
|
105 |
And I open the action menu in "Course Tool 1" "table_row"
|
|
|
106 |
And I choose "Edit" in the open action menu
|
|
|
107 |
And I should not see "Restrict to category"
|
|
|
108 |
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
|
|
|
109 |
And I follow "Manage preconfigured tools"
|
|
|
110 |
And I follow "Add preconfigured tool"
|
|
|
111 |
And I should see "Restrict to category"
|
|
|
112 |
And I press "Cancel"
|
|
|
113 |
And I click on "Update" "link" in the "Teaching Tool 1" "table_row"
|
|
|
114 |
Then I should see "Restrict to category"
|