Skip to content

Commit

Permalink
MDL-79844 core_ltix: migrate behat features cover site admin workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed May 20, 2024
1 parent 2c1cad1 commit c4ad5db
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
3 changes: 3 additions & 0 deletions ltix/classes/external/create_tool_proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public static function execute_parameters(): external_function_parameters {
public static function execute(string $name, string $registrationurl, array $capabilityoffered = [],
array $serviceoffered = []): object {

global $CFG;
require_once($CFG->dirroot . '/ltix/constants.php');

$params = self::validate_parameters(self::execute_parameters(),
array(
'name' => $name,
Expand Down
3 changes: 3 additions & 0 deletions ltix/classes/external/create_tool_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public static function execute_parameters(): external_function_parameters {
* @throws \moodle_exception If the tool type could not be created
*/
public static function execute(string $cartridgeurl, string $key = '', string $secret = ''): array {
global $CFG;
require_once($CFG->dirroot . '/ltix/constants.php');

$params = self::validate_parameters(self::execute_parameters(),
array(
'cartridgeurl' => $cartridgeurl,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@mod @mod_lti
@core @core_ltix
Feature: Create/edit tool configuration that has Deep Linking support
In order to provide external tools that support Deep Linking for teachers and learners
As an admin
I need to be able to configure external tool registrations that support Deep Linking.

Background:
Given I log in as "admin"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
And I navigate to "General > LTI > Manage tools" in site administration

Scenario: Verifying ContentItemSelectionRequest selection support in external tool registration
When I follow "Manage external tool registrations"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mod @mod_lti
@core @core_ltix
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
Expand All @@ -24,7 +24,7 @@ Feature: Make an LTI only available to specific course categories
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| teacher1 | C3 | editingteacher |
And the following "mod_lti > tool types" exist:
And the following "core_ltix > tool types" exist:
| name | description | baseurl | coursevisible | state | lti_coursecategories |
| Teaching Tool 1 | Tool 1 description | /ltix/tests/fixtures/tool_provider.php | 1 | 1 | catb |
| Teaching Tool 2 | Tool 2 description | /ltix/tests/fixtures/tool_provider.php | 2 | 1 | catca |
Expand Down Expand Up @@ -54,7 +54,7 @@ Feature: Make an LTI only available to specific course categories
@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 navigate to "General > LTI > Manage tools" in site administration
And I follow "Manage preconfigured tools"
And I follow "Add preconfigured tool"
And I expand all fieldsets
Expand Down Expand Up @@ -90,10 +90,10 @@ Feature: Make an LTI only available to specific course categories

@javascript
Scenario: Category restriction only shown for a site tool
Given the following "mod_lti > tool types" exist:
Given the following "core_ltix > tool types" exist:
| name | baseurl | coursevisible | state |
| Teaching Tool 1 | /ltix/tests/fixtures/tool_provider.php | 2 | 1 |
And the following "mod_lti > course tools" exist:
And the following "core_ltix > course tools" exist:
| name | description | baseurl | course |
| Course Tool 1 | Example description | https://example.com/tool | C1 |
And I log in as "admin"
Expand All @@ -105,7 +105,7 @@ Feature: Make an LTI only available to specific course categories
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 navigate to "General > LTI > Manage tools" in site administration
And I follow "Manage preconfigured tools"
And I follow "Add preconfigured tool"
And I should see "Restrict to category"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mod @mod_lti
@core @core_ltix
Feature: Verify the breadcrumbs in manage tools site administration pages
Whenever I navigate to manage tools page in site administration
As an admin
Expand All @@ -8,33 +8,27 @@ Feature: Verify the breadcrumbs in manage tools site administration pages
Given I log in as "admin"

Scenario: Verify the breadcrumbs in manage tools page as an admin
Given I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
Given I navigate to "General > LTI > Manage tools" in site administration
And "Manage tools" "text" should exist in the ".breadcrumb" "css_element"
And "External tool" "link" should exist in the ".breadcrumb" "css_element"
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
And "LTI" "link" should exist in the ".breadcrumb" "css_element"
When I click on "configure a tool manually" "link"
Then "External tool configuration" "text" should exist in the ".breadcrumb" "css_element"
And "Manage tools" "link" should exist in the ".breadcrumb" "css_element"
And "External tool" "link" should exist in the ".breadcrumb" "css_element"
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
And "LTI" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I click on "Manage preconfigured tools" "link"
And "Manage preconfigured tools" "text" should exist in the ".breadcrumb" "css_element"
And "External tool" "link" should exist in the ".breadcrumb" "css_element"
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
And "LTI" "link" should exist in the ".breadcrumb" "css_element"
And I click on "Add preconfigured tool" "link"
And "External tool configuration" "text" should exist in the ".breadcrumb" "css_element"
And "Manage tools" "link" should exist in the ".breadcrumb" "css_element"
And "External tool" "link" should exist in the ".breadcrumb" "css_element"
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
And "LTI" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
And I navigate to "General > LTI > Manage tools" in site administration
And I click on "Manage external tool registrations" "link"
And "Manage external tool registrations" "text" should exist in the ".breadcrumb" "css_element"
And "External tool" "link" should exist in the ".breadcrumb" "css_element"
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
And "LTI" "link" should exist in the ".breadcrumb" "css_element"
And I click on "Configure a new external tool registration" "link"
And "Edit preconfigured tool" "text" should exist in the ".breadcrumb" "css_element"
And "Manage external tool registrations" "link" should exist in the ".breadcrumb" "css_element"
And "External tool" "link" should exist in the ".breadcrumb" "css_element"
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
And "LTI" "link" should exist in the ".breadcrumb" "css_element"
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@mod @mod_lti
@core @core_ltix
Feature: Configure tool types
In order to allow teachers to add external LTI tools
As an admin
I need to be able to add, remove and configure tool types

Background:
Given I log in as "admin"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
And I navigate to "General > LTI > Manage tools" in site administration

@javascript
Scenario: Add a tool type from a cartridge URL
Expand All @@ -17,8 +17,8 @@ Feature: Configure tool types
And I should see "Example tool"

@javascript
Scenario: Try to add a non-existant cartridge
When I set the field "url" to local url "/mod/lti/tests/fixtures/nonexistant.xml"
Scenario: Try to add a non-existent cartridge
When I set the field "url" to local url "/ltix/tests/fixtures/nonexistent.xml"
And I press "Add Legacy LTI"
Then I should see "Enter your consumer key and shared secret"
And I press "Save changes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@mod @mod_lti
@core @core_ltix
Feature: Navigate existing LTI tool types using pagination
In order to manage reusable activities for teachers
As an admin
I need to view existing tools

Background:
Given 100 "mod_lti > tool types" exist with the following data:
Given 100 "core_ltix > tool types" exist with the following data:
|name |Test tool [count] |
|description |Example description [count] |
|baseurl |https://www.example.com/tool[count]|
And I log in as "admin"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
And I navigate to "General > LTI > Manage tools" in site administration

@javascript
Scenario: View first page of tool types.
Expand Down

0 comments on commit c4ad5db

Please sign in to comment.