1 |
efrain |
1 |
@enrol @enrol_self
|
|
|
2 |
Feature: Users can auto-enrol themself in courses where self enrolment is allowed
|
|
|
3 |
In order to participate in courses
|
|
|
4 |
As a user
|
|
|
5 |
I need to auto enrol me in courses
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | format |
|
|
|
14 |
| Course 1 | C1 | topics |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
|
|
|
19 |
# Note: Please keep the javascript tag on this Scenario to ensure that we
|
|
|
20 |
# test use of the singleselect functionality.
|
|
|
21 |
@javascript
|
|
|
22 |
Scenario: Self-enrolment enabled as guest
|
|
|
23 |
Given I log in as "teacher1"
|
|
|
24 |
And I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
25 |
| Custom instance name | Test student enrolment |
|
|
|
26 |
And I log out
|
|
|
27 |
When I am on "Course 1" course homepage
|
|
|
28 |
And I press "Access as a guest"
|
|
|
29 |
Then I should see "Guests cannot access this course. Please log in."
|
|
|
30 |
And I press "Continue"
|
|
|
31 |
And I should see "Log in"
|
|
|
32 |
|
|
|
33 |
Scenario: Self-enrolment enabled
|
|
|
34 |
Given I log in as "teacher1"
|
|
|
35 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
36 |
| Custom instance name | Test student enrolment |
|
|
|
37 |
And I log out
|
|
|
38 |
And I log in as "student1"
|
|
|
39 |
And I am on "Course 1" course homepage
|
|
|
40 |
And I press "Enrol me"
|
|
|
41 |
Then I should see "New section"
|
|
|
42 |
And I should not see "Enrolment options"
|
|
|
43 |
|
|
|
44 |
Scenario: Self-enrolment enabled requiring an enrolment key
|
|
|
45 |
Given I log in as "teacher1"
|
|
|
46 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
47 |
| Custom instance name | Test student enrolment |
|
|
|
48 |
| Enrolment key | moodle_rules |
|
|
|
49 |
And I log out
|
|
|
50 |
And I log in as "student1"
|
|
|
51 |
And I am on "Course 1" course homepage
|
|
|
52 |
And I set the following fields to these values:
|
|
|
53 |
| Enrolment key | moodle_rules |
|
|
|
54 |
And I press "Enrol me"
|
|
|
55 |
Then I should see "New section"
|
|
|
56 |
And I should not see "Enrolment options"
|
|
|
57 |
And I should not see "Enrol me in this course"
|
|
|
58 |
|
|
|
59 |
Scenario: Self-enrolment disabled
|
|
|
60 |
Given I log in as "student1"
|
|
|
61 |
When I am on "Course 1" course homepage
|
|
|
62 |
Then I should see "You cannot enrol yourself in this course"
|
|
|
63 |
|
|
|
64 |
Scenario: Self-enrolment enabled requiring a group enrolment key
|
|
|
65 |
Given I log in as "teacher1"
|
|
|
66 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
67 |
| Custom instance name | Test student enrolment |
|
|
|
68 |
| Enrolment key | moodle_rules |
|
|
|
69 |
| Use group enrolment keys | Yes |
|
|
|
70 |
And I am on the "Course 1" "groups" page
|
|
|
71 |
And I press "Create group"
|
|
|
72 |
And I set the following fields to these values:
|
|
|
73 |
| Group name | Group 1 |
|
|
|
74 |
| Enrolment key | Test-groupenrolkey1 |
|
|
|
75 |
And I press "Save changes"
|
|
|
76 |
And I log out
|
|
|
77 |
And I log in as "student1"
|
|
|
78 |
And I am on "Course 1" course homepage
|
|
|
79 |
And I set the following fields to these values:
|
|
|
80 |
| Enrolment key | Test-groupenrolkey1 |
|
|
|
81 |
And I press "Enrol me"
|
|
|
82 |
Then I should see "New section"
|
|
|
83 |
And I should not see "Enrolment options"
|
|
|
84 |
And I should not see "Enrol me in this course"
|
|
|
85 |
|
|
|
86 |
@javascript
|
|
|
87 |
Scenario: Edit a self-enrolled user's enrolment from the course participants page
|
|
|
88 |
Given I log in as "teacher1"
|
|
|
89 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
90 |
| Custom instance name | Test student enrolment |
|
|
|
91 |
And I log out
|
|
|
92 |
And I log in as "student1"
|
|
|
93 |
And I am on "Course 1" course homepage
|
|
|
94 |
And I press "Enrol me"
|
|
|
95 |
And I should see "You are enrolled in the course"
|
|
|
96 |
And I log out
|
|
|
97 |
And I log in as "teacher1"
|
|
|
98 |
And I am on "Course 1" course homepage
|
|
|
99 |
And I navigate to course participants
|
|
|
100 |
When I click on "//a[@data-action='editenrolment']" "xpath_element" in the "student1" "table_row"
|
|
|
101 |
And I should see "Edit Student 1's enrolment"
|
|
|
102 |
And I set the field "Status" to "Suspended"
|
|
|
103 |
And I click on "Save changes" "button"
|
|
|
104 |
Then I should see "Suspended" in the "student1" "table_row"
|
|
|
105 |
|
|
|
106 |
@javascript
|
|
|
107 |
Scenario: Unenrol a self-enrolled student from the course participants page
|
|
|
108 |
Given I log in as "teacher1"
|
|
|
109 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
110 |
| Custom instance name | Test student enrolment |
|
|
|
111 |
And I log out
|
|
|
112 |
And I log in as "student1"
|
|
|
113 |
And I am on "Course 1" course homepage
|
|
|
114 |
And I press "Enrol me"
|
|
|
115 |
And I should see "You are enrolled in the course"
|
|
|
116 |
And I log out
|
|
|
117 |
And I log in as "teacher1"
|
|
|
118 |
And I am on "Course 1" course homepage
|
|
|
119 |
And I navigate to course participants
|
|
|
120 |
When I click on "//a[@data-action='unenrol']" "xpath_element" in the "student1" "table_row"
|
|
|
121 |
And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
|
|
|
122 |
Then I should not see "Student 1" in the "participants" "table"
|
|
|
123 |
|
|
|
124 |
@javascript
|
|
|
125 |
Scenario: Self unenrol as a self-enrolled student from the course
|
|
|
126 |
Given the "multilang" filter is "on"
|
|
|
127 |
And the "multilang" filter applies to "content and headings"
|
|
|
128 |
And I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
129 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
130 |
| Custom instance name | Test student enrolment |
|
|
|
131 |
And I am on "Course 1" course homepage
|
|
|
132 |
And I navigate to "Settings" in current page administration
|
|
|
133 |
And I set the field "Course full name" in the "General" "fieldset" to "<span lang=\"en\" class=\"multilang\">Course</span><span lang=\"it\" class=\"multilang\">Corso</span> 1"
|
|
|
134 |
And I press "Save and display"
|
|
|
135 |
And I log out
|
|
|
136 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
137 |
And I press "Enrol me"
|
|
|
138 |
And I should see "You are enrolled in the course"
|
|
|
139 |
And I am on the "C1" "course" page
|
|
|
140 |
And I navigate to "Unenrol me from this course" in current page administration
|
|
|
141 |
And I click on "Continue" "button" in the "Confirm" "dialogue"
|
|
|
142 |
Then I should see "You are unenrolled from the course \"Course 1\""
|
|
|
143 |
|
|
|
144 |
@javascript
|
|
|
145 |
Scenario: Self-enrolment enabled with simultaneous guest access
|
|
|
146 |
Given I log in as "teacher1"
|
|
|
147 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
148 |
And I click on "Enable" "link" in the "Self enrolment (Student)" "table_row"
|
|
|
149 |
And I click on "Edit" "link" in the "Guest access" "table_row"
|
|
|
150 |
And I set the following fields to these values:
|
|
|
151 |
| Allow guest access | Yes |
|
|
|
152 |
And I press "Save changes"
|
|
|
153 |
And I log out
|
|
|
154 |
And I log in as "student1"
|
|
|
155 |
And I am on "Course 1" course homepage
|
|
|
156 |
And I navigate to "Enrol me in this course" in current page administration
|
|
|
157 |
And I click on "Enrol me" "button"
|
|
|
158 |
Then I should see "New section"
|