1 |
efrain |
1 |
@core
|
|
|
2 |
Feature: MoodleNet outbound share course
|
|
|
3 |
In order to send a course to MoodleNet server
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to backup the course and share to MoodleNet
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following course exists:
|
|
|
9 |
| name | Test course |
|
|
|
10 |
| shortname | C1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| student1 | Student | 1 | student1@example.com |
|
|
|
14 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
15 |
| manager1 | Manager | 1 | manager1@example.com |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| manager1 | C1 | manager |
|
|
|
19 |
| teacher1 | C1 | editingteacher |
|
|
|
20 |
| student1 | C1 | student |
|
|
|
21 |
And I log in as "admin"
|
|
|
22 |
And a MoodleNet mock server is configured
|
|
|
23 |
And the following config values are set as admin:
|
|
|
24 |
| enablesharingtomoodlenet | 1 |
|
|
|
25 |
And I navigate to "Server > OAuth 2 services" in site administration
|
|
|
26 |
And I press "MoodleNet"
|
|
|
27 |
And I should see "Create new service: MoodleNet"
|
|
|
28 |
And I change the MoodleNet field "Service base URL" to mock server
|
|
|
29 |
And I press "Save changes"
|
|
|
30 |
And I navigate to "MoodleNet > MoodleNet outbound settings" in site administration
|
|
|
31 |
And I set the field "Auth 2 service" to "MoodleNet"
|
|
|
32 |
And I press "Save changes"
|
|
|
33 |
|
|
|
34 |
Scenario: Share course to MoodleNet option only be available for teachers and managers
|
|
|
35 |
Given I am on the "C1" "course" page logged in as student1
|
|
|
36 |
And "Share to MoodleNet" "link" should not exist in current page administration
|
|
|
37 |
When I am on the "C1" "course" page logged in as teacher1
|
|
|
38 |
And "Share to MoodleNet" "link" should exist in current page administration
|
|
|
39 |
Then I am on the "C1" "course" page logged in as manager1
|
|
|
40 |
And "Share to MoodleNet" "link" should exist in current page administration
|
|
|
41 |
|
|
|
42 |
Scenario: Share course to MoodleNet option only be available for user that has capability only
|
|
|
43 |
Given the following "permission overrides" exist:
|
|
|
44 |
| capability | permission | role | contextlevel | reference |
|
|
|
45 |
| moodle/moodlenet:sharecourse | Prohibit | editingteacher | Course | C1 |
|
|
|
46 |
When I am on the "C1" "course" page logged in as teacher1
|
|
|
47 |
Then "Share to MoodleNet" "link" should not exist in current page administration
|
|
|
48 |
And I am on the "C1" "course" page logged in as manager1
|
|
|
49 |
And "Share to MoodleNet" "link" should exist in current page administration
|
|
|
50 |
And the following "permission overrides" exist:
|
|
|
51 |
| capability | permission | role | contextlevel | reference |
|
|
|
52 |
| moodle/moodlenet:sharecourse | Prohibit | manager | Course | C1 |
|
|
|
53 |
And I am on the "C1" "course" page logged in as manager1
|
|
|
54 |
And "Share to MoodleNet" "link" should not exist in current page administration
|
|
|
55 |
|
|
|
56 |
@javascript
|
|
|
57 |
Scenario: User can share course to MoodleNet
|
|
|
58 |
Given I am on the "C1" "course" page logged in as teacher1
|
|
|
59 |
When I navigate to "Share to MoodleNet" in current page administration
|
|
|
60 |
Then I should see "Course" in the "Share to MoodleNet" "dialogue"
|
|
|
61 |
And I should see "Test course 1" in the "Share to MoodleNet" "dialogue"
|
|
|
62 |
And I should see "This course is being shared with MoodleNet as a resource." in the "Share to MoodleNet" "dialogue"
|
|
|
63 |
And I click on "Share" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
64 |
And I switch to "moodlenet_auth" window
|
|
|
65 |
And I press "Allow" and switch to main window
|
|
|
66 |
And I should see "Saved to MoodleNet drafts"
|
|
|
67 |
And "Go to MoodleNet drafts" "link" should exist in the "Share to MoodleNet" "dialogue"
|