2 Feature: Edit user enrolment
3 In order to manage students' enrolments
5 I need to be able to view enrolment details and edit student enrolments in the course participants page
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 | student2 | Student | 2 | student2@example.com |
13 And the following "courses" exist:
14 | fullname | shortname | format |
15 | Course 1 | C1 | topics |
16 And the following "course enrolments" exist:
17 | user | course | role | status |
18 | teacher1 | C1 | editingteacher | 0 |
19 | student1 | C1 | student | 0 |
20 | student2 | C1 | student | 1 |
23 Scenario: Edit a user's enrolment
24 Given I log in as "teacher1"
25 And I am on "Course 1" course homepage
26 And I navigate to course participants
27 When I click on "Edit enrolment" "icon" in the "student1" "table_row"
28 And I should see "Edit Student 1's enrolment"
29 And I set the field "Status" to "Suspended"
30 And I click on "Save changes" "button"
31 And I click on "Edit enrolment" "icon" in the "student2" "table_row"
32 And I should see "Edit Student 2's enrolment"
33 And I set the field "timeend[enabled]" to "1"
34 And I set the field "timeend[day]" to "1"
35 And I set the field "timeend[month]" to "January"
36 And I set the field "timeend[year]" to "2017"
37 And I set the field "Status" to "Active"
38 And I click on "Save changes" "button"
39 Then I should see "Suspended" in the "student1" "table_row"
40 And I should see "Not current" in the "student2" "table_row"
43 Scenario: Unenrol a student
44 Given I log in as "teacher1"
45 And I am on "Course 1" course homepage
46 And I navigate to course participants
47 When I click on "Unenrol" "icon" in the "student1" "table_row"
48 And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
49 Then I should not see "Student 1" in the "participants" "table"
52 Scenario: View a student's enrolment details
53 Given I log in as "teacher1"
54 And I am on "Course 1" course homepage
55 And I navigate to course participants
56 When I click on "Manual enrolments" "icon" in the "student1" "table_row"
57 Then I should see "Enrolment details"
58 And I should see "Student 1" in the "Full name" "table_row"
59 And I should see "Active" in the "//td[@class='user-enrol-status']" "xpath_element"
60 And I should see "Manual enrolments" in the "Enrolment method" "table_row"
61 And I should see "Enrolment created"
62 And I click on "Cancel" "button" in the "Enrolment details" "dialogue"
63 And I click on "Manual enrolments" "icon" in the "student2" "table_row"
64 And I should see "Enrolment details"
65 And I should see "Student 2" in the "Full name" "table_row"
66 And I should see "Suspended" in the "//td[@class='user-enrol-status']" "xpath_element"
67 And I should see "Manual enrolments" in the "Enrolment method" "table_row"
68 And I should see "Enrolment created"
69 And "Edit enrolment" "icon" should exist in the "Enrolment method" "table_row"
72 Scenario: View a student's enrolment details for a student enrolled via course meta link where editing can't be done
73 Given the following "users" exist:
74 | username | firstname | lastname | email |
75 | student3 | Student | 3 | student3@example.com |
76 And the following "courses" exist:
77 | fullname | shortname | format |
78 | Course 2 | C2 | topics |
79 And the following "course enrolments" exist:
80 | user | course | role | status |
81 | student3 | C2 | student | 0 |
82 And I log in as "admin"
83 And I navigate to "Plugins > Enrolments > Manage enrol plugins" in site administration
84 And I click on "Enable" "link" in the "Course meta link" "table_row"
85 And I add "Course meta link" enrolment method in "Course 1" with:
88 And I log in as "teacher1"
89 And I am on "Course 1" course homepage
90 When I navigate to course participants
91 Then I should see "Student 3" in the "participants" "table"
92 And "Edit enrolment" "icon" should not exist in the "student3" "table_row"
93 And "Unenrol" "icon" should not exist in the "student3" "table_row"
94 And I click on "Course meta link (Course 2)" "icon" in the "student3" "table_row"
95 And I should see "Enrolment details"
96 And I should see "Student 3" in the "Full name" "table_row"
97 And I should see "Active" in the "//td[@class='user-enrol-status']" "xpath_element"
98 And I should see "Course meta link (Course 2)" in the "Enrolment method" "table_row"
99 And "Edit enrolment" "icon" should not exist in the "Enrolment method" "table_row"
102 Scenario: Edit a student's enrolment details from the status dialogue
103 Given I log in as "teacher1"
104 And I am on "Course 1" course homepage
105 And I navigate to course participants
106 When I click on "Manual enrolments" "icon" in the "student2" "table_row"
107 And I click on "Edit enrolment" "icon" in the "Enrolment method" "table_row"
108 And I should see "Edit Student 2's enrolment"
109 And I set the field "Status" to "Active"
110 And I click on "Save changes" "button"
111 Then I should see "Active" in the "student2" "table_row"
113 # Without JS, the user should be redirected to the original edit enrolment form.
114 Scenario: Edit a user's enrolment without JavaScript
115 Given I log in as "teacher1"
116 And I am on "Course 1" course homepage
117 And I navigate to course participants
118 When I click on "Edit enrolment" "link" in the "student1" "table_row"
119 And I should see "Student 1"
120 And I set the field "Status" to "Suspended"
121 And I click on "Save changes" "button"
122 And I click on "Edit enrolment" "link" in the "student2" "table_row"
123 And I should see "Student 2"
124 And I set the field "timeend[enabled]" to "1"
125 And I set the field "timeend[day]" to "1"
126 And I set the field "timeend[month]" to "January"
127 And I set the field "timeend[year]" to "2017"
128 And I set the field "Status" to "Active"
129 And I click on "Save changes" "button"
130 Then I should see "Suspended" in the "student1" "table_row"
131 And I should see "Not current" in the "student2" "table_row"
133 # Without JS, the user should be redirected to the original unenrol confirmation page.
134 Scenario: Unenrol a student
135 Given I log in as "teacher1"
136 And I am on "Course 1" course homepage
137 And I navigate to course participants
138 When I click on "Unenrol" "link" in the "student1" "table_row"
139 And I click on "Continue" "button"
140 Then I should not see "Student 1" in the "participants" "table"