__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
@mod @mod_lti
Feature: Make an LTI only available to specific course categories
In order to restrict which courses a tool can be used in
As an administrator
I need to be able to select which course category the tool is available in
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
And the following "categories" exist:
| name | category | idnumber |
| cata | 0 | cata |
| catca | cata | catca |
| catb | 0 | catb |
| catcb | catb | catcb |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | cata |
| Course 2 | C2 | catb |
| Course 3 | C3 | catca |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| teacher1 | C3 | editingteacher |
And the following "mod_lti > tool types" exist:
| name | description | baseurl | coursevisible | state | lti_coursecategories |
| Teaching Tool 1 | Tool 1 description | /mod/lti/tests/fixtures/tool_provider.php | 1 | 1 | catb |
| Teaching Tool 2 | Tool 2 description | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 | catca |
Scenario: Tool is set to "Show as preconfigured tool when adding an external tool" on parent category
Given I am on the "Course 2" course page logged in as teacher1
When I navigate to "LTI External tools" in current page administration
Then I should see "Teaching Tool 1" in the "reportbuilder-table" "table"
And I should not see "Teaching Tool 2" in the "reportbuilder-table" "table"
@javascript
Scenario: Tool is set to "Show in activity chooser and as preconfigured tool" on child category
Given I log in as "teacher1"
When I am on "Course 3" course homepage with editing mode on
And I open the activity chooser
Then I should see "Teaching Tool 2" in the "Add an activity or resource" "dialogue"
And I should not see "Teaching Tool 1" in the "Add an activity or resource" "dialogue"
@javascript
Scenario: View a course in a category in which no tools are available
Given I log in as "teacher1"
When I am on "Course 1" course homepage with editing mode on
And I open the activity chooser
Then I should not see "Teaching Tool 1" in the "Add an activity or resource" "dialogue"
And I should not see "Teaching Tool 2" in the "Add an activity or resource" "dialogue"
@javascript
Scenario: Editing and saving selected parent / child categories
Given I log in as "admin"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
And I follow "Manage preconfigured tools"
And I follow "Add preconfigured tool"
And I expand all fieldsets
And I click on "catb" "link"
And I set the following fields to these values:
| Tool name | Teaching Tool 3 |
| Tool configuration usage | Do not show; use only when a matching tool URL is entered |
| catb | 1 |
# If parent is selected, child should be selected.
And the field "catcb" matches value "1"
# If parent is unselected, child should be unselected.
And I set the following fields to these values:
| catb | 0 |
And the field "catcb" matches value "0"
# If parent is selected, child is unselected, parent should still be selected.
# Step 1 - Select parent first so child is selected.
And I set the following fields to these values:
| catb | 1 |
And the field "catcb" matches value "1"
# Step 2 - Unselect child but parent should stay as selected.
And I set the following fields to these values:
| catcb | 0 |
And the field "catb" matches value "1"
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/tool_provider.php"
And I press "Save changes"
And I wait until the page is ready
And I should see "Teaching Tool 3"
When I click on "Update" "link" in the "Teaching Tool 3" "table_row"
And I expand all fieldsets
Then the following fields match these values:
| catb | 1 |
| catcb | 0 |
@javascript
Scenario: Category restriction only shown for a site tool
Given the following "mod_lti > tool types" exist:
| name | baseurl | coursevisible | state |
| Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 |
And the following "mod_lti > course tools" exist:
| name | description | baseurl | course |
| Course Tool 1 | Example description | https://example.com/tool | C1 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "LTI External tools" in current page administration
When I click on "Add tool" "link"
And I should not see "Restrict to category"
And I press "Cancel"
And I open the action menu in "Course Tool 1" "table_row"
And I choose "Edit" in the open action menu
And I should not see "Restrict to category"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
And I follow "Manage preconfigured tools"
And I follow "Add preconfigured tool"
And I should see "Restrict to category"
And I press "Cancel"
And I click on "Update" "link" in the "Teaching Tool 1" "table_row"
Then I should see "Restrict to category"
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| addtool.feature | File | 8.77 KB | 0777 |
|
| backup_restore.feature | File | 3.68 KB | 0777 |
|
| contentitem.feature | File | 1.78 KB | 0777 |
|
| contentitemregistration.feature | File | 1.61 KB | 0777 |
|
| lti_activity_completion.feature | File | 2.93 KB | 0777 |
|
| lti_completion_pass_grade.feature | File | 3.74 KB | 0777 |
|
| managecoursetools.feature | File | 17.52 KB | 0777 |
|
| renametool.feature | File | 905 B | 0777 |
|
| restricttocategory.feature | File | 5.62 KB | 0777 |
|
| siteadmin_managetool_breadcrumbs.feature | File | 2.58 KB | 0777 |
|
| toolconfigure.feature | File | 1.28 KB | 0777 |
|
| viewtools.feature | File | 1.08 KB | 0777 |
|