Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@enrol @enrol_manual
2
Feature: A course welcome message will be sent to the user when they are enrolled in a course
3
  In order to let the user know they have been enrolled in a course
4
  As a teacher
5
  I want the user to receive a welcome message when they are enrolled 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
 
24
  @javascript
25
  Scenario: Manager should see the new settings for course welcome message
26
    Given I am on the "C1" "Enrolled users" page logged in as manager
27
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
28
    When I click on "Edit" "link" in the "Manual enrolments" "table_row"
29
    Then I should see "Send course welcome message"
30
    And the field "Send course welcome message" matches value "From the course contact"
31
    And I should see "Custom welcome message"
1441 ariadna 32
    And the field "Custom welcome message" matches value "Hi {$a->firstname}, you are enrolled in the course {$a->coursename}."
1 efrain 33
    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:"
34
    And I set the field "Send course welcome message" to "No"
35
    And I should not see "Custom welcome message"
36
    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:"
37
 
38
  @javascript
1441 ariadna 39
  Scenario: Teacher can edit the course welcome message
40
    Given I am on the "C1" "Enrolled users" page logged in as teacher
41
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
42
    When I click on "Edit" "link" in the "Manual enrolments" "table_row"
43
    Then I should see "Send course welcome message"
44
    And I should not see "Enable manual enrolments"
45
    And I should not see "Default role"
46
    And I should not see "Default enrolment duration"
47
    And I should not see "Notify before enrolment expires"
48
    And I should not see "Notification threshold"
49
    And I set the field "Custom welcome message" to "Hello {$a->fullname}, welcome to the course {$a->coursename}"
50
    And I press "Save changes"
51
    And I click on "Edit" "link" in the "Manual enrolments" "table_row"
52
    And I should see "Hello {$a->fullname}, welcome to the course {$a->coursename}"
53
 
54
  @javascript
1 efrain 55
  Scenario: Student should not receive a welcome message if the setting is disabled
56
    Given I am on the "C1" "Enrolled users" page logged in as manager
57
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
58
    And I click on "Edit" "link" in the "Manual enrolments" "table_row"
59
    And I set the field "Send course welcome message" to "No"
60
    And I press "Save changes"
61
    And I am on the "C1" "Enrolled users" page logged in as teacher
62
    And I press "Enrol users"
63
    And I set the field "Select users" to "First User"
64
    And I should see "First User"
65
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
66
    And I should see "Active" in the "First User" "table_row"
67
    When I am on the "C1" "course" page logged in as user1
68
    Then I should not see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
69
 
70
  @javascript
71
  Scenario: Students should receive a welcome message if the setting is enabled - Default message
72
    Given I am on the "C1" "Enrolled users" page logged in as teacher
73
    # Enrol first user to Course 1.
74
    And I press "Enrol users"
75
    And I set the field "Select users" to "First User"
76
    And I should see "First User"
77
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
78
    # Enrol second user to Course 2.
79
    And I am on the "C2" "Enrolled users" page
80
    And I press "Enrol users"
81
    And I set the field "Select users" to "Second User"
82
    And I should see "Second User"
83
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
84
    # Login as first user and check the notification.
85
    When I am on the "C1" "course" page logged in as user1
86
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
87
    And I open the notification popover
88
    And I should see "Welcome to Course 1"
89
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 90
    And I should see "Hi First, you are enrolled in the course Course 1."
1 efrain 91
    # Login as second user and check the notification.
92
    And I am on the "C1" "course" page logged in as user2
93
    And I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
94
    And I open the notification popover
95
    And I should see "Welcome to Course 2"
96
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 97
    And I should see "Hi Second, you are enrolled in the course Course 2."
1 efrain 98
 
99
  @javascript
100
  Scenario: Students should receive a welcome message if the setting is enabled - Custom message
101
    Given I am on the "C1" "Enrolled users" page logged in as manager
102
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
103
    And I click on "Edit" "link" in the "Manual enrolments" "table_row"
104
    And I set the field "Custom welcome message" to multiline:
105
    """
1441 ariadna 106
    Dear {$a->fullname}, you are enrolled in the course {$a->coursename}.
1 efrain 107
    Your email address: {$a->email}
108
    Your first name: {$a->firstname}
109
    Your last name: {$a->lastname}
110
    Your course role: {$a->courserole}
111
    """
112
    And I press "Save changes"
113
    # Enrol first user and second user to Course 1.
114
    And the following "course enrolments" exist:
115
      | user  | course | role    |
116
      | user1 | C1     | student |
117
      | user2 | C1     | student |
118
    # Login as first user and check the notification.
119
    When I am on the "C1" "course" page logged in as user1
120
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
121
    And I open the notification popover
122
    And I should see "Welcome to Course 1"
123
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 124
    And I should see "Dear First User, you are enrolled in the course Course 1."
1 efrain 125
    And I should see "Your email address: first@example.com"
126
    And I should see "Your first name: First"
127
    And I should see "Your last name: User"
1441 ariadna 128
    And I should see "Your course role: Student"
1 efrain 129
    # Login as second user and check the notification.
130
    When I am on the "C1" "course" page logged in as user2
131
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
132
    And I open the notification popover
133
    And I should see "Welcome to Course 1"
134
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 135
    And I should see "Dear Second User, you are enrolled in the course Course 1."
1 efrain 136
    And I should see "Your email address: second@example.com"
137
    And I should see "Your first name: Second"
138
    And I should see "Your last name: User"
1441 ariadna 139
    And I should see "Your course role: Student"