1 |
efrain |
1 |
@core
|
|
|
2 |
Feature: MoodleNet outbound send activity
|
|
|
3 |
In order to send activity to MoodleNet server
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able package the activity and share to MoodleNet
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given I log in as "admin"
|
|
|
9 |
And a MoodleNet mock server is configured
|
|
|
10 |
And the following config values are set as admin:
|
|
|
11 |
| enablesharingtomoodlenet | 1 |
|
|
|
12 |
And I navigate to "Server > OAuth 2 services" in site administration
|
|
|
13 |
And I press "MoodleNet"
|
|
|
14 |
And I should see "Create new service: MoodleNet"
|
|
|
15 |
And I change the MoodleNet field "Service base URL" to mock server
|
|
|
16 |
And I press "Save changes"
|
|
|
17 |
And I navigate to "MoodleNet > MoodleNet outbound settings" in site administration
|
|
|
18 |
And I set the field "Auth 2 service" to "MoodleNet"
|
|
|
19 |
And I press "Save changes"
|
|
|
20 |
And the following course exists:
|
|
|
21 |
| name | Test course |
|
|
|
22 |
| shortname | C1 |
|
|
|
23 |
And the following "users" exist:
|
|
|
24 |
| username | firstname | lastname | email |
|
|
|
25 |
| student1 | Student | 1 | student1@example.com |
|
|
|
26 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
27 |
| manager1 | Manager | 1 | manager1@example.com |
|
|
|
28 |
And the following "course enrolments" exist:
|
|
|
29 |
| user | course | role |
|
|
|
30 |
| manager1 | C1 | manager |
|
|
|
31 |
| teacher1 | C1 | editingteacher |
|
|
|
32 |
| student1 | C1 | student |
|
|
|
33 |
And the following "activities" exist:
|
|
|
34 |
| activity | course | idnumber | name | intro |
|
|
|
35 |
| assign | C1 | assign1 | Test Assignment 1 | Test Assignment 1 |
|
|
|
36 |
|
|
|
37 |
Scenario: Share to MoodleNet menu only be available for teachers and managers
|
|
|
38 |
Given I am on the "Test Assignment 1" "assign activity" page logged in as student1
|
|
|
39 |
Then "Share to MoodleNet" "link" should not exist in current page administration
|
|
|
40 |
And I am on the "Test Assignment 1" "assign activity" page logged in as teacher1
|
|
|
41 |
And "Share to MoodleNet" "link" should exist in current page administration
|
|
|
42 |
And I am on the "Test Assignment 1" "assign activity" page logged in as manager1
|
|
|
43 |
And "Share to MoodleNet" "link" should exist in current page administration
|
|
|
44 |
|
|
|
45 |
Scenario: Share to MoodleNet menu only be available for user that has capability only
|
|
|
46 |
Given the following "permission overrides" exist:
|
|
|
47 |
| capability | permission | role | contextlevel | reference |
|
|
|
48 |
| moodle/moodlenet:shareactivity | Prohibit | editingteacher | Course | C1 |
|
|
|
49 |
When I am on the "Test Assignment 1" "assign activity" page logged in as teacher1
|
|
|
50 |
Then "Share to MoodleNet" "link" should not exist in current page administration
|
|
|
51 |
And I am on the "Test Assignment 1" "assign activity" page logged in as manager1
|
|
|
52 |
And "Share to MoodleNet" "link" should exist in current page administration
|
|
|
53 |
And the following "permission overrides" exist:
|
|
|
54 |
| capability | permission | role | contextlevel | reference |
|
|
|
55 |
| moodle/moodlenet:shareactivity | Prohibit | manager | Course | C1 |
|
|
|
56 |
And I am on the "Test Assignment 1" "assign activity" page logged in as manager1
|
|
|
57 |
And "Share to MoodleNet" "link" should not exist in current page administration
|
|
|
58 |
|
|
|
59 |
@javascript
|
|
|
60 |
Scenario: User can share activity to MoodleNet
|
|
|
61 |
Given I am on the "Test Assignment 1" "assign activity" page logged in as teacher1
|
|
|
62 |
When I navigate to "Share to MoodleNet" in current page administration
|
|
|
63 |
Then I should see "Assignment" in the "Share to MoodleNet" "dialogue"
|
|
|
64 |
And I should see "Test Assignment 1" in the "Share to MoodleNet" "dialogue"
|
|
|
65 |
And I should see "This activity is being shared with MoodleNet as a resource." in the "Share to MoodleNet" "dialogue"
|
|
|
66 |
And I click on "Share" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
67 |
And I switch to "moodlenet_auth" window
|
|
|
68 |
And I press "Allow" and switch to main window
|
|
|
69 |
And I should see "Saved to MoodleNet drafts"
|
|
|
70 |
And "Go to MoodleNet drafts" "link" should exist in the "Share to MoodleNet" "dialogue"
|
|
|
71 |
|
|
|
72 |
@javascript
|
|
|
73 |
Scenario: User can see their shared resources on the MoodleNet share progress page
|
|
|
74 |
Given I am on the "C1" course page logged in as teacher1
|
|
|
75 |
When I navigate to "MoodleNet share progress" in current page administration
|
|
|
76 |
And I should see "There are no shared resources to display at this time."
|
|
|
77 |
And I am on "C1" course homepage
|
|
|
78 |
And I navigate to "Share to MoodleNet" in current page administration
|
|
|
79 |
And I click on "Share" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
80 |
And I switch to "moodlenet_auth" window
|
|
|
81 |
And I press "Allow" and switch to main window
|
|
|
82 |
And I click on "Close" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
83 |
And I am on the "Test Assignment 1" "assign activity" page
|
|
|
84 |
And I navigate to "Share to MoodleNet" in current page administration
|
|
|
85 |
And I click on "Share" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
86 |
And I click on "Close" "button" in the "Share to MoodleNet" "dialogue"
|
|
|
87 |
And I am on "C1" course homepage
|
|
|
88 |
And I navigate to "MoodleNet share progress" in current page administration
|
|
|
89 |
Then "Test course 1" row "Name" column of "generaltable" table should contain "Test course 1"
|
|
|
90 |
And "Test course 1" row "Type" column of "generaltable" table should contain "Course"
|
|
|
91 |
And "Test course 1" row "Send status" column of "generaltable" table should contain "Sent"
|
|
|
92 |
And "Test Assignment 1" row "Name" column of "generaltable" table should contain "Test Assignment 1"
|
|
|
93 |
And "Test Assignment 1" row "Type" column of "generaltable" table should contain "Assignment"
|
|
|
94 |
And "Test Assignment 1" row "Send status" column of "generaltable" table should contain "Sent"
|