Skip to content

Commit

Permalink
Merge branch 'MDL-76065-311' of https://github.com/lameze/moodle into…
Browse files Browse the repository at this point in the history
… MOODLE_311_STABLE
  • Loading branch information
junpataleta committed May 25, 2023
2 parents 6e21aa5 + a989d78 commit 87e29b9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 64 deletions.
36 changes: 11 additions & 25 deletions mod/lti/tests/behat/addtype.feature
Expand Up @@ -14,17 +14,12 @@ Feature: Add preconfigured tools via teacher interface
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | name | typeid | toolurl |
| lti | C1 | Test tool | 0 | /mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml |

@javascript
Scenario: Add a tool from a cartridge
Given the following "activity" exists:
| course | C1 |
| activity | lti |
| name | Test tool activity |
When I am on the "Test tool activity" "lti activity editing" page logged in as teacher1
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml"
And I press "Save and return to course"
And I am on the "Test tool activity" "lti activity editing" page
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"
And the field "Secure tool URL" matches value "https://www.example.com/lti/provider.php"
Expand All @@ -33,11 +28,7 @@ Feature: Add preconfigured tools via teacher interface

@javascript @_switch_window
Scenario: Add a preconfigured tool from a cartridge
Given the following "activity" exists:
| course | C1 |
| activity | lti |
| name | Test tool activity 1 |
When I am on the "Test tool activity 1" "lti activity editing" page logged in as teacher1
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"
Expand All @@ -46,25 +37,20 @@ Feature: Add preconfigured tools via teacher interface
And I switch to the main window
And I wait "2" seconds
And I follow "Edit preconfigured tool"
And I switch to "edit_tool" window
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 return to course"
And I am on the "Test tool activity 1" "lti activity editing" page
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 the following "activity" exists:
| course | C1 |
| activity | lti |
| name | Test tool activity |
When I am on the "Test tool activity" "lti activity editing" page logged in as teacher1
Given I am on the "Test tool" "lti activity editing" page logged in as teacher1
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/tool_provider.php"
And I press "Save and return to course"
And I am on the "Test tool activity" "lti activity" page
And I switch to "contentframe" iframe
And I press "Save and display"
When I switch to "contentframe" iframe
Then I should see "This represents a tool provider"
14 changes: 4 additions & 10 deletions mod/lti/tests/behat/contentitem.feature
Expand Up @@ -87,15 +87,9 @@ Feature: Content-Item support

@javascript
Scenario: Editing a manually configured external tool
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "External tool" to section "1"
And the field "Preconfigured tool" matches value "Automatic, based on tool URL"
And I set the field "Activity name" to "Test tool activity 1"
And the "Select content" "button" should be disabled
And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/tool_provider.php"
And I press "Save and return to course"
When I open "Test tool activity 1" actions menu
And I choose "Edit settings" in the open action menu
Given the following "activities" exist:
| activity | course | name | typeid | toolurl |
| lti | C1 | Test tool | 0 | /mod/lti/tests/fixtures/tool_provider.php |
And I am on the "Test tool" "lti activity editing" page logged in as teacher1
Then the field "Preconfigured tool" matches value "Automatic, based on tool URL"
And the "Select content" "button" should be disabled
10 changes: 4 additions & 6 deletions mod/lti/tests/behat/lti_activity_completion.feature
@@ -1,4 +1,4 @@
@mod @mod_lti @core_completion @javascript
@mod @mod_lti @core_completion
Feature: View activity completion information in the LTI activity
In order to have visibility of LTI completion requirements
As a student
Expand All @@ -25,30 +25,28 @@ Feature: View activity completion information in the LTI activity
Then "Music history" should have the "Receive a grade" completion condition
And "Music history" should have the "View" completion condition

@javascript
Scenario: View automatic completion items as a student
Given I am on the "Music history" "lti activity" page logged in as student1
And the "View" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "90.00" to the user "Vinnie Student1" for the grade item "Music history"
And I press "Save changes"
And I log out
When I am on the "Music history" "lti activity" page logged in as student1
Then the "Receive a grade" completion condition of "Music history" is displayed as "done"
And the "View" completion condition of "Music history" is displayed as "done"

@javascript
Scenario: Use manual completion
Given I am on the "Music history" "lti activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
And I press "Save and return to course"
And I press "Save and display"
# Teacher view.
Given I am on the "Music history" "lti activity" page
And the manual completion button for "Music history" should be disabled
And I log out
# Student view.
When I am on the "Music history" "lti activity" page logged in as student1
Then the manual completion button of "Music history" is displayed as "Mark as done"
Expand Down
17 changes: 6 additions & 11 deletions mod/lti/tests/behat/renametool.feature
Expand Up @@ -5,23 +5,18 @@ Feature: Rename external tools via inline editing
I need to be able to rename the LTI tool and have it's name change in the gradebook

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | name |
| lti | C1 | Test tool activity 1 |

@javascript
Scenario: Add a tool and inline edit
When I log in as "teacher1"
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "External tool" to section "1" and I fill the form with:
| Activity name | Test tool activity 1 |
And I set the field "Edit title" in the "li#section-1" "css_element" to "Test tool activity renamed"
And I set the field "Edit title" in the "Test tool activity 1" "activity" to "Test tool activity renamed"
And I navigate to "Setup > Gradebook setup" in the course gradebook
Then I should not see "Test tool activity 1"
And I should see "Test tool activity renamed"
13 changes: 1 addition & 12 deletions mod/lti/tests/behat/toolconfigure.feature
Expand Up @@ -5,18 +5,7 @@ Feature: Configure tool types
I need to be able to add, remove and configure tool types

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
| student1 | Sam1 | Student1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
Given I log in as "admin"
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration

@javascript
Expand Down
3 changes: 3 additions & 0 deletions mod/lti/tests/generator/lib.php
Expand Up @@ -42,6 +42,9 @@ public function create_instance($record = null, array $options = null) {

if (!isset($record->toolurl)) {
$record->toolurl = '';
} else {
$toolurl = new moodle_url($record->toolurl);
$record->toolurl = $toolurl->out(false);
}
if (!isset($record->resourcekey)) {
$record->resourcekey = '12345';
Expand Down

0 comments on commit 87e29b9

Please sign in to comment.