From 9914870b7dcdf78c1699abb07da49a345b149325 Mon Sep 17 00:00:00 2001 From: Jake Dallimore Date: Wed, 9 Aug 2023 16:23:04 +0800 Subject: [PATCH] MDL-78597 mod_lti: cover creation of course tools using cartridge URLs This replaces the legacy scenario, which used the '+' on the activity instance edit form, with a scenario covering the cartridge use on the new course tools (LTI External tools) edit form. --- mod/lti/tests/behat/addtype.feature | 23 +------------------ mod/lti/tests/behat/managecoursetools.feature | 20 ++++++++++++++++ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/mod/lti/tests/behat/addtype.feature b/mod/lti/tests/behat/addtype.feature index 8d2869bbec2..3e87dd1f74b 100644 --- a/mod/lti/tests/behat/addtype.feature +++ b/mod/lti/tests/behat/addtype.feature @@ -18,7 +18,7 @@ Feature: Add preconfigured tools via teacher interface | activity | course | name | typeid | toolurl | | lti | C1 | Test tool | 0 | /mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml | - Scenario: Add a tool from a cartridge + Scenario: Add a tool activity instance from a cartridge Given I am on the "Test tool" "lti activity editing" page logged in as teacher1 And I expand all fieldsets Then the field "Tool URL" matches value "http://www.example.com/lti/provider.php" @@ -26,27 +26,6 @@ Feature: Add preconfigured tools via teacher interface And the field "Icon URL" matches value "http://download.moodle.org/unittest/test.jpg" And the field "Secure icon URL" matches value "https://download.moodle.org/unittest/test.jpg" - @javascript @_switch_window - Scenario: Add a preconfigured tool from a cartridge - Given I am on the "Test tool" "lti activity editing" page logged in as teacher1 - And I follow "Add preconfigured tool" - And I switch to "add_tool" window - And I set the field "Tool name" to "Placeholder" - And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml" - And I press "Save changes" - And I switch to the main window - And I wait "2" seconds - And I follow "Edit preconfigured tool" - When I switch to "edit_tool" window - Then the field "Tool URL" matches value "http://www.example.com/lti/provider.php" - And the field "Icon URL" matches value "http://download.moodle.org/unittest/test.jpg" - And the field "Secure icon URL" matches value "https://download.moodle.org/unittest/test.jpg" - And I press "Cancel" - And I switch to the main window - And I press "Save and display" - And I am on the "Test tool" "lti activity editing" page - And the field "Preconfigured tool" matches value "Placeholder" - @javascript @_switch_window Scenario: Add and use a preconfigured tool Given I am on the "Test tool" "lti activity editing" page logged in as teacher1 diff --git a/mod/lti/tests/behat/managecoursetools.feature b/mod/lti/tests/behat/managecoursetools.feature index 5053431836b..6a50146f973 100644 --- a/mod/lti/tests/behat/managecoursetools.feature +++ b/mod/lti/tests/behat/managecoursetools.feature @@ -127,3 +127,23 @@ Feature: Manage course tools And I click on "Delete" "button" in the "Delete Test tool" "dialogue" And I should see "Test tool removed" And I should not see "Test tool" in the "reportbuilder-table" "table" + + @javascript + Scenario: Add a course tool using a cartridge URL + Given I am on the "Course 1" course page logged in as teacher1 + And I navigate to "LTI External tools" in current page administration + When I click on "Add tool" "link" + And I set the following fields to these values: + | Tool name | Test tool 1 | + | Tool description | Test tool 1 description | + And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml" + And I press "Save changes" + Then I should see "Test tool 1" in the "reportbuilder-table" "table" + # The cartridge description, if set, overrides the description set in the type edit form (bug?). + And I should see "Example tool description" in the "Test tool 1" "table_row" + And I open the action menu in "Test tool 1" "table_row" + And I choose "Edit" in the open action menu + And the field "Tool name" matches value "Test tool 1" + And the field "Tool URL" matches value "http://www.example.com/lti/provider.php" + And the field "Icon URL" matches value "http://download.moodle.org/unittest/test.jpg" + And the field "Secure icon URL" matches value "https://download.moodle.org/unittest/test.jpg"