1 |
efrain |
1 |
@core
|
|
|
2 |
Feature: MoodleNet outbound share selected activities in a course
|
|
|
3 |
In order to send a number of selected activities in a course to MoodleNet server
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to backup the selected activities in a 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 "activities" exist:
|
|
|
12 |
| activity | course | idnumber | name | intro |
|
|
|
13 |
| assign | C1 | assign1 | Test Assignment 1 | Test Assignment 1 |
|
|
|
14 |
| assign | C1 | assign2 | Test Assignment 2 | Test Assignment 2 |
|
|
|
15 |
| assign | C1 | assign3 | Test Assignment 3 | Test Assignment 3 |
|
|
|
16 |
And the following "users" exist:
|
|
|
17 |
| username | firstname | lastname | email |
|
|
|
18 |
| student1 | Student | 1 | student1@example.com |
|
|
|
19 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
20 |
| manager1 | Manager | 1 | manager1@example.com |
|
|
|
21 |
And the following "course enrolments" exist:
|
|
|
22 |
| user | course | role |
|
|
|
23 |
| manager1 | C1 | manager |
|
|
|
24 |
| teacher1 | C1 | editingteacher |
|
|
|
25 |
| student1 | C1 | student |
|
|
|
26 |
And I log in as "admin"
|
|
|
27 |
And a MoodleNet mock server is configured
|
|
|
28 |
And the following config values are set as admin:
|
|
|
29 |
| enablesharingtomoodlenet | 1 |
|
|
|
30 |
And I navigate to "Server > OAuth 2 services" in site administration
|
|
|
31 |
And I press "MoodleNet"
|
|
|
32 |
And I should see "Create new service: MoodleNet"
|
|
|
33 |
And I change the MoodleNet field "Service base URL" to mock server
|
|
|
34 |
And I press "Save changes"
|
|
|
35 |
And I navigate to "MoodleNet > MoodleNet outbound settings" in site administration
|
|
|
36 |
And I set the field "Auth 2 service" to "MoodleNet"
|
|
|
37 |
And I press "Save changes"
|
|
|
38 |
|
|
|
39 |
@javascript
|
|
|
40 |
Scenario: Share to MoodleNet bulk option should only be available for users with the capability
|
|
|
41 |
Given the following "permission overrides" exist:
|
|
|
42 |
| capability | permission | role | contextlevel | reference |
|
|
|
43 |
| moodle/moodlenet:sharecourse | Prohibit | editingteacher | Course | C1 |
|
|
|
44 |
When I am on the "C1" "course" page logged in as teacher1
|
|
|
45 |
And I turn editing mode on
|
|
|
46 |
And I click on "Bulk actions" "button"
|
|
|
47 |
And I click on "Select activity Test Assignment 1" "checkbox"
|
|
|
48 |
Then "Share to MoodleNet" "button" should not exist in the "sticky-footer" "region"
|
|
|
49 |
And I am on the "C1" "course" page logged in as manager1
|
|
|
50 |
And I turn editing mode on
|
|
|
51 |
And I click on "Bulk actions" "button"
|
|
|
52 |
And I click on "Select activity Test Assignment 1" "checkbox"
|
|
|
53 |
And "Share to MoodleNet" "button" should exist in the "sticky-footer" "region"
|
|
|
54 |
And the following "permission overrides" exist:
|
|
|
55 |
| capability | permission | role | contextlevel | reference |
|
|
|
56 |
| moodle/moodlenet:sharecourse | Prohibit | manager | Course | C1 |
|
|
|
57 |
And I am on the "C1" "course" page logged in as manager1
|
|
|
58 |
And I turn editing mode on
|
|
|
59 |
And I click on "Bulk actions" "button"
|
|
|
60 |
And I click on "Select activity Test Assignment 1" "checkbox"
|
|
|
61 |
And "Share to MoodleNet" "button" should not exist in the "sticky-footer" "region"
|
|
|
62 |
|
|
|
63 |
@javascript
|
|
|
64 |
Scenario: User can share selected activities in a course to MoodleNet
|
|
|
65 |
Given I am on the "C1" "course" page logged in as teacher1
|
|
|
66 |
And I turn editing mode on
|
|
|
67 |
And I click on "Bulk actions" "button"
|
|
|
68 |
When I click on "Share to MoodleNet" "button" in the "sticky-footer" "region"
|
|
|
69 |
Then "Share to MoodleNet" "dialogue" should not exist
|
|
|
70 |
And I click on "Select activity Test Assignment 1" "checkbox"
|
|
|
71 |
And I click on "Select activity Test Assignment 2" "checkbox"
|
|
|
72 |
And I click on "Share to MoodleNet" "button" in the "sticky-footer" "region"
|
|
|
73 |
And "Share to MoodleNet" "dialogue" should exist
|
|
|
74 |
And I should see "Test course 1" in the "Share to MoodleNet" "dialogue"
|
|
|
75 |
And I should see "The selected activities are being shared with MoodleNet as a resource." in the "Share to MoodleNet" "dialogue"
|
|
|
76 |
And I should see "2 activities will be included in the course." in the "Share to MoodleNet" "dialogue"
|
|
|
77 |
And I click on "Share" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
78 |
And I switch to "moodlenet_auth" window
|
|
|
79 |
And I press "Allow" and switch to main window
|
|
|
80 |
And I should see "Saved to MoodleNet drafts"
|
|
|
81 |
And "Go to MoodleNet drafts" "link" should exist in the "Share to MoodleNet" "dialogue"
|
|
|
82 |
|
|
|
83 |
@javascript
|
|
|
84 |
Scenario: User can share activity directly in a course bulk mode to MoodleNet
|
|
|
85 |
Given I am on the "C1" "course" page logged in as teacher1
|
|
|
86 |
And I turn editing mode on
|
|
|
87 |
And I click on "Bulk actions" "button"
|
|
|
88 |
And I click on "Select activity Test Assignment 1" "checkbox"
|
|
|
89 |
When I click on "Share to MoodleNet" "button" in the "sticky-footer" "region"
|
|
|
90 |
Then I should see "Test Assignment 1" in the "Share to MoodleNet" "dialogue"
|
|
|
91 |
And I should see "This activity is being shared with MoodleNet as a resource." in the "Share to MoodleNet" "dialogue"
|
|
|
92 |
And I should not see "1 activities will be included in the course." in the "Share to MoodleNet" "dialogue"
|
|
|
93 |
And I click on "Share" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
94 |
And I switch to "moodlenet_auth" window
|
|
|
95 |
And I press "Allow" and switch to main window
|
|
|
96 |
And I should see "Saved to MoodleNet drafts"
|
|
|
97 |
And "Go to MoodleNet drafts" "link" should exist in the "Share to MoodleNet" "dialogue"
|