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_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"
1441 ariadna 37
    And the field "Custom welcome message" matches value "Hi {$a->firstname}, you are enrolled in the course {$a->coursename}."
1 efrain 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
1441 ariadna 44
  Scenario: Teacher can edit the course welcome message
45
    Given I am on the "C1" "Enrolled users" page logged in as teacher
46
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
47
    When I click on "Edit" "link" in the "Self enrolment" "table_row"
48
    Then I should see "Send course welcome message"
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 "Self enrolment" "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 "Test student enrolment" "table_row"
59
    And I set the field "Send course welcome message" to "No"
60
    And I press "Save changes"
61
    And I log in as "user1"
62
    And I am on "Course 1" course homepage
63
    When I press "Enrol me"
64
    Then I should not see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
65
 
66
  @javascript
67
  Scenario: Students should receive a welcome message if the setting is enabled - Default message
68
    # Login as first user and check the notification.
69
    Given I log in as "user1"
70
    And I am on "Course 1" course homepage
71
    When I press "Enrol me"
72
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
73
    And I open the notification popover
74
    And I should see "Welcome to Course 1"
75
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 76
    And I should see "Hi First, you are enrolled in the course Course 1."
1 efrain 77
    # Login as second user and check the notification.
78
    And I log in as "user2"
79
    And I am on "Course 2" course homepage
80
    And I press "Enrol me"
81
    And I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
82
    And I open the notification popover
83
    And I should see "Welcome to Course 2"
84
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 85
    And I should see "Hi Second, you are enrolled in the course Course 2."
1 efrain 86
 
87
  @javascript
88
  Scenario: Students should receive a welcome message if the setting is enabled - Custom message
89
    Given I am on the "C1" "Enrolled users" page logged in as manager
90
    And I set the field "Participants tertiary navigation" to "Enrolment methods"
91
    And I click on "Edit" "link" in the "Test student enrolment" "table_row"
92
    And I set the field "Custom welcome message" to multiline:
93
    """
1441 ariadna 94
    Dear {$a->fullname}, you are enrolled in the course {$a->coursename}.
1 efrain 95
    Your email address: {$a->email}
96
    Your first name: {$a->firstname}
97
    Your last name: {$a->lastname}
98
    Your course role: {$a->courserole}
99
    """
100
    And I press "Save changes"
101
    # Login as first user and check the notification.
102
    And I log in as "user1"
103
    And I am on "Course 1" course homepage
104
    When I press "Enrol me"
105
    Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
106
    And I open the notification popover
107
    And I should see "Welcome to Course 1"
108
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 109
    And I should see "Dear First User, you are enrolled in the course Course 1."
1 efrain 110
    And I should see "Your email address: first@example.com"
111
    And I should see "Your first name: First"
112
    And I should see "Your last name: User"
1441 ariadna 113
    And I should see "Your course role: Student"
1 efrain 114
    # Login as second user and check the notification.
115
    And I log in as "user2"
116
    And I am on "Course 1" course homepage
117
    And I press "Enrol me"
118
    And I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
119
    And I open the notification popover
120
    And I should see "Welcome to Course 1"
121
    And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
1441 ariadna 122
    And I should see "Dear Second User, you are enrolled in the course Course 1."
1 efrain 123
    And I should see "Your email address: second@example.com"
124
    And I should see "Your first name: Second"
125
    And I should see "Your last name: User"
1441 ariadna 126
    And I should see "Your course role: Student"