1 |
efrain |
1 |
@mod @mod_lti @core_backup @javascript
|
|
|
2 |
Feature: Restoring Moodle 2 backup restores LTI configuration
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
|
|
|
8 |
And the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course 1 | C1 | 0 |
|
|
|
11 |
| Course 2 | C2 | 0 |
|
|
|
12 |
And the following "course enrolments" exist:
|
|
|
13 |
| user | course | role |
|
|
|
14 |
| teacher1 | C1 | editingteacher |
|
|
|
15 |
| teacher1 | C2 | editingteacher |
|
|
|
16 |
And the following config values are set as admin:
|
|
|
17 |
| enableasyncbackup | 0 |
|
|
|
18 |
|
|
|
19 |
Scenario: Backup and restore course with preconfigured site LTI tool on the same site
|
|
|
20 |
Given the following "mod_lti > tool types" exist:
|
|
|
21 |
| name | description | baseurl | coursevisible | state |
|
|
|
22 |
| My site tool | Site tool description | https://www.moodle.org | 2 | 1 |
|
|
|
23 |
And the following "mod_lti > tool instances" exist:
|
|
|
24 |
| name | tool | course |
|
|
|
25 |
| My LTI module | My site tool | C1 |
|
|
|
26 |
And I am on the "Course 1" course page logged in as admin
|
|
|
27 |
And I should see "My LTI module"
|
|
|
28 |
When I backup "Course 1" course using this options:
|
|
|
29 |
| Confirmation | Filename | test_backup.mbz |
|
|
|
30 |
And I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
31 |
And I am on site homepage
|
|
|
32 |
And I follow "Course 1 copy 1"
|
|
|
33 |
Then I should see "My LTI module"
|
|
|
34 |
And I navigate to "Plugins > Activity modules > External tool > Manage tools" in site administration
|
|
|
35 |
And "This tool is being used 2 times" "text" should exist in the "//div[contains(@id,'tool-card-container') and contains(., 'My site tool')]" "xpath_element"
|
|
|
36 |
|
|
|
37 |
@javascript
|
|
|
38 |
Scenario: Backup and restore course with preconfigured course LTI tool on the same site
|
|
|
39 |
Given the following "mod_lti > course tools" exist:
|
|
|
40 |
| name | description | baseurl | course | lti_resourcekey | lti_password | lti_launchcontainer |
|
|
|
41 |
| My course tool | Example description | http://www.example.com/lti/provider.php | C1 | my key | my secret | 5 |
|
|
|
42 |
# In the first course create an LTI module that uses a course preconfigured tool
|
|
|
43 |
And the following "mod_lti > tool instances" exist:
|
|
|
44 |
| name | tool | course |
|
|
|
45 |
| Test tool activity 2 | My course tool | C1 |
|
|
|
46 |
And I am on the "Course 1" course page logged in as admin
|
|
|
47 |
# Backup course and restore into another course
|
|
|
48 |
And I backup "Course 1" course using this options:
|
|
|
49 |
| Confirmation | Filename | test_backup.mbz |
|
|
|
50 |
When I restore "test_backup.mbz" backup into "Course 2" course using this options:
|
|
|
51 |
# Make sure the copy of the preconfigured tool was created in the second course with both encrypted and non-encrypted properties.
|
|
|
52 |
And I am on "Course 2" course homepage with editing mode on
|
|
|
53 |
And I open "Test tool activity 2" actions menu
|
|
|
54 |
And I choose "Edit settings" in the open action menu
|
|
|
55 |
And the field "Activity name" matches value "Test tool activity 2"
|
|
|
56 |
And I am on "Course 1" course homepage
|
|
|
57 |
And I navigate to "LTI External tools" in current page administration
|
|
|
58 |
Then I should see "My course tool"
|
|
|
59 |
And I open the action menu in "My course tool" "table_row"
|
|
|
60 |
And I choose "Edit" in the open action menu
|
|
|
61 |
And the field "Tool URL" matches value "http://www.example.com/lti/provider.php"
|
|
|
62 |
And the field "Consumer key" matches value "my key"
|
|
|
63 |
And the field "Shared secret" matches value "my secret"
|
|
|
64 |
And the field "Default launch container" matches value "Existing window"
|