Proyectos de Subversion Moodle

Rev

| 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"
32
    And the field "Custom welcome message" matches value "Dear {$a->fullname}, you have successfully been enrolled to course {$a->coursename}"
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
39
  Scenario: Student should not receive a welcome message if the setting is disabled
40
    Given I am on the "C1" "Enrolled users" page logged in as manager
41
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
42
    And I click on "Edit" "link" in the "Manual enrolments" "table_row"
43
    And I set the field "Send course welcome message" to "No"
44
    And I press "Save changes"
45
    And I am on the "C1" "Enrolled users" page logged in as teacher
46
    And I press "Enrol users"
47
    And I set the field "Select users" to "First User"
48
    And I should see "First User"
49
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
50
    And I should see "Active" in the "First User" "table_row"
51
    When I am on the "C1" "course" page logged in as user1
52
    Then I should not see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
53
 
54
  @javascript
55
  Scenario: Students should receive a welcome message if the setting is enabled - Default message
56
    Given I am on the "C1" "Enrolled users" page logged in as teacher
57
    # Enrol first user to Course 1.
58
    And I press "Enrol users"
59
    And I set the field "Select users" to "First User"
60
    And I should see "First User"
61
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
62
    # Enrol second user to Course 2.
63
    And I am on the "C2" "Enrolled users" page
64
    And I press "Enrol users"
65
    And I set the field "Select users" to "Second User"
66
    And I should see "Second User"
67
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
68
    # Login as first user and check the notification.
69
    When I am on the "C1" "course" page logged in as user1
70
    Then 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 1"
73
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
74
    And I should see "Dear First User, you have successfully been enrolled to course Course 1"
75
    # Login as second user and check the notification.
76
    And I am on the "C1" "course" page logged in as user2
77
    And I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
78
    And I open the notification popover
79
    And I should see "Welcome to Course 2"
80
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
81
    And I should see "Dear Second User, you have successfully been enrolled to course Course 2"
82
 
83
  @javascript
84
  Scenario: Students should receive a welcome message if the setting is enabled - Custom message
85
    Given I am on the "C1" "Enrolled users" page logged in as manager
86
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
87
    And I click on "Edit" "link" in the "Manual enrolments" "table_row"
88
    And I set the field "Custom welcome message" to multiline:
89
    """
90
    Dear {$a->fullname}, you have successfully been enrolled to course {$a->coursename}.
91
    Your email address: {$a->email}
92
    Your first name: {$a->firstname}
93
    Your last name: {$a->lastname}
94
    Your course role: {$a->courserole}
95
    """
96
    And I press "Save changes"
97
    # Enrol first user and second user to Course 1.
98
    And the following "course enrolments" exist:
99
      | user  | course | role    |
100
      | user1 | C1     | student |
101
      | user2 | C1     | student |
102
    # Login as first user and check the notification.
103
    When I am on the "C1" "course" page logged in as user1
104
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
105
    And I open the notification popover
106
    And I should see "Welcome to Course 1"
107
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
108
    And I should see "Dear First User, you have successfully been enrolled to course Course 1"
109
    And I should see "Your email address: first@example.com"
110
    And I should see "Your first name: First"
111
    And I should see "Your last name: User"
112
    And I should see "Your course role: student"
113
    # Login as second user and check the notification.
114
    When I am on the "C1" "course" page logged in as user2
115
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
116
    And I open the notification popover
117
    And I should see "Welcome to Course 1"
118
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
119
    And I should see "Dear Second User, you have successfully been enrolled to course Course 1"
120
    And I should see "Your email address: second@example.com"
121
    And I should see "Your first name: Second"
122
    And I should see "Your last name: User"
123
    And I should see "Your course role: student"