1 |
efrain |
1 |
@enrol @enrol_self
|
|
|
2 |
Feature: A course welcome message will be sent to the user when they auto-enrol themself in a course
|
|
|
3 |
In order to let the user know they have been auto-enrol themself in a course successfully
|
|
|
4 |
As a teacher
|
|
|
5 |
I want the user to receive a welcome message when they auto-enrol themself in a course
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| manager | Manager | User | manager@example.com |
|
|
|
11 |
| teacher | Teacher | User | teacher@example.com |
|
|
|
12 |
| user1 | First | User | first@example.com |
|
|
|
13 |
| user2 | Second | User | second@example.com |
|
|
|
14 |
And the following "courses" exist:
|
|
|
15 |
| fullname | shortname | category |
|
|
|
16 |
| Course 1 | C1 | 0 |
|
|
|
17 |
| Course 2 | C2 | 0 |
|
|
|
18 |
And the following "course enrolments" exist:
|
|
|
19 |
| user | course | role |
|
|
|
20 |
| manager | C1 | manager |
|
|
|
21 |
| teacher | C1 | editingteacher |
|
|
|
22 |
| teacher | C2 | editingteacher |
|
|
|
23 |
And I log in as "admin"
|
|
|
24 |
And I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
25 |
| Custom instance name | Test student enrolment |
|
|
|
26 |
And I add "Self enrolment" enrolment method in "Course 2" with:
|
|
|
27 |
| Custom instance name | Test student enrolment |
|
|
|
28 |
|
|
|
29 |
@javascript
|
|
|
30 |
Scenario: Manager should see the new settings for course welcome message
|
|
|
31 |
Given I am on the "C1" "Enrolled users" page logged in as manager
|
|
|
32 |
And I set the field "Participants tertiary navigation" to "Enrolment methods"
|
|
|
33 |
When I click on "Edit" "link" in the "Test student enrolment" "table_row"
|
|
|
34 |
Then I should see "Send course welcome message"
|
|
|
35 |
And the field "Send course welcome message" matches value "From the course contact"
|
|
|
36 |
And I should see "Custom welcome message"
|
|
|
37 |
And the field "Custom welcome message" matches value "Dear {$a->fullname}, you have successfully been enrolled to course {$a->coursename}"
|
|
|
38 |
And I should see "Accepted formats: Plain text or Moodle-auto format. HTML tags and multi-lang tags are also accepted, as well as the following placeholders:"
|
|
|
39 |
And I set the field "Send course welcome message" to "No"
|
|
|
40 |
And I should not see "Custom welcome message"
|
|
|
41 |
And I should not see "Accepted formats: Plain text or Moodle-auto format. HTML tags and multi-lang tags are also accepted, as well as the following placeholders:"
|
|
|
42 |
|
|
|
43 |
@javascript
|
|
|
44 |
Scenario: Student should not receive a welcome message if the setting is disabled
|
|
|
45 |
Given I am on the "C1" "Enrolled users" page logged in as manager
|
|
|
46 |
And I set the field "Participants tertiary navigation" to "Enrolment methods"
|
|
|
47 |
And I click on "Edit" "link" in the "Test student enrolment" "table_row"
|
|
|
48 |
And I set the field "Send course welcome message" to "No"
|
|
|
49 |
And I press "Save changes"
|
|
|
50 |
And I log in as "user1"
|
|
|
51 |
And I am on "Course 1" course homepage
|
|
|
52 |
When I press "Enrol me"
|
|
|
53 |
Then I should not see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
54 |
|
|
|
55 |
@javascript
|
|
|
56 |
Scenario: Students should receive a welcome message if the setting is enabled - Default message
|
|
|
57 |
# Login as first user and check the notification.
|
|
|
58 |
Given I log in as "user1"
|
|
|
59 |
And I am on "Course 1" course homepage
|
|
|
60 |
When I press "Enrol me"
|
|
|
61 |
Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
62 |
And I open the notification popover
|
|
|
63 |
And I should see "Welcome to Course 1"
|
|
|
64 |
And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
|
|
|
65 |
And I should see "Dear First User, you have successfully been enrolled to course Course 1"
|
|
|
66 |
# Login as second user and check the notification.
|
|
|
67 |
And I log in as "user2"
|
|
|
68 |
And I am on "Course 2" course homepage
|
|
|
69 |
And I press "Enrol me"
|
|
|
70 |
And I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
71 |
And I open the notification popover
|
|
|
72 |
And I should see "Welcome to Course 2"
|
|
|
73 |
And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
|
|
|
74 |
And I should see "Dear Second User, you have successfully been enrolled to course Course 2"
|
|
|
75 |
|
|
|
76 |
@javascript
|
|
|
77 |
Scenario: Students should receive a welcome message if the setting is enabled - Custom message
|
|
|
78 |
Given I am on the "C1" "Enrolled users" page logged in as manager
|
|
|
79 |
And I set the field "Participants tertiary navigation" to "Enrolment methods"
|
|
|
80 |
And I click on "Edit" "link" in the "Test student enrolment" "table_row"
|
|
|
81 |
And I set the field "Custom welcome message" to multiline:
|
|
|
82 |
"""
|
|
|
83 |
Dear {$a->fullname}, you have successfully been enrolled to course {$a->coursename}.
|
|
|
84 |
Your email address: {$a->email}
|
|
|
85 |
Your first name: {$a->firstname}
|
|
|
86 |
Your last name: {$a->lastname}
|
|
|
87 |
Your course role: {$a->courserole}
|
|
|
88 |
"""
|
|
|
89 |
And I press "Save changes"
|
|
|
90 |
# Login as first user and check the notification.
|
|
|
91 |
And I log in as "user1"
|
|
|
92 |
And I am on "Course 1" course homepage
|
|
|
93 |
When I press "Enrol me"
|
|
|
94 |
Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
95 |
And I open the notification popover
|
|
|
96 |
And I should see "Welcome to Course 1"
|
|
|
97 |
And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
|
|
|
98 |
And I should see "Dear First User, you have successfully been enrolled to course Course 1"
|
|
|
99 |
And I should see "Your email address: first@example.com"
|
|
|
100 |
And I should see "Your first name: First"
|
|
|
101 |
And I should see "Your last name: User"
|
|
|
102 |
And I should see "Your course role: student"
|
|
|
103 |
# Login as second user and check the notification.
|
|
|
104 |
And I log in as "user2"
|
|
|
105 |
And I am on "Course 1" course homepage
|
|
|
106 |
And I press "Enrol me"
|
|
|
107 |
And I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
108 |
And I open the notification popover
|
|
|
109 |
And I should see "Welcome to Course 1"
|
|
|
110 |
And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
|
|
|
111 |
And I should see "Dear Second User, you have successfully been enrolled to course Course 1"
|
|
|
112 |
And I should see "Your email address: second@example.com"
|
|
|
113 |
And I should see "Your first name: Second"
|
|
|
114 |
And I should see "Your last name: User"
|
|
|
115 |
And I should see "Your course role: student"
|