1 @enrol @enrol_meta @javascript
2 Feature: Enrolments are synchronised with meta courses
3 In order to simplify enrolments in parent courses
5 I need to be able to set up meta enrolments
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@asd.com |
11 | student2 | Student | 2 | student2@asd.com |
12 | student3 | Student | 3 | student3@asd.com |
13 | student4 | Student | 4 | student4@asd.com |
14 And the following "courses" exist:
15 | fullname | shortname |
20 And the following "groups" exist:
21 | name | course | idnumber |
22 | Groupcourse 1 | C3C3 | G1 |
23 | Groupcourse 2 | C3C3 | G2 |
24 And the following "course enrolments" exist:
25 | user | course | role | status |
26 | student1 | C1C1 | student | 0 |
27 | student2 | C1C1 | student | 0 |
28 | student3 | C1C1 | student | 0 |
29 | student4 | C1C1 | student | 0 |
30 | student1 | C2C2 | student | 0 |
31 | student2 | C2C2 | student | 0 |
32 | student1 | C4C4 | student | 0 |
33 | student2 | C4C4 | student | 1 |
34 And I log in as "admin"
35 And I navigate to "Manage enrol plugins" node in "Site administration > Plugins > Enrolments"
36 And I click on "Enable" "link" in the "Course meta link" "table_row"
37 And I am on course index
39 Scenario: Add meta enrolment instance without groups
40 When I am on "Course 3" course homepage
41 And I add "Course meta link" enrolment method with:
42 | Link course | C1C1 |
43 And I navigate to "Enrolled users" node in "Course administration > Users"
44 Then I should see "Student 1"
45 And I should see "Student 4"
46 And I should not see "Groupcourse" in the "table.userenrolment" "css_element"
48 Scenario: Add meta enrolment instance with groups
49 When I am on "Course 3" course homepage
50 And I add "Course meta link" enrolment method with:
51 | Link course | C1C1 |
52 | Add to group | Groupcourse 1 |
53 And I am on "Course 3" course homepage
54 And I add "Course meta link" enrolment method with:
55 | Link course | C2C2 |
56 | Add to group | Groupcourse 2 |
57 And I navigate to "Enrolled users" node in "Course administration > Users"
58 Then I should see "Groupcourse 1" in the "Student 1" "table_row"
59 And I should see "Groupcourse 1" in the "Student 2" "table_row"
60 And I should see "Groupcourse 1" in the "Student 3" "table_row"
61 And I should see "Groupcourse 1" in the "Student 4" "table_row"
62 And I should see "Groupcourse 2" in the "Student 1" "table_row"
63 And I should see "Groupcourse 2" in the "Student 2" "table_row"
64 And I should not see "Groupcourse 2" in the "Student 3" "table_row"
65 And I should not see "Groupcourse 2" in the "Student 4" "table_row"
67 Scenario: Add meta enrolment instance with auto-created groups
68 When I am on "Course 3" course homepage
69 And I add "Course meta link" enrolment method with:
70 | Link course | C1C1 |
71 | Add to group | Create new group |
72 And I navigate to "Enrolled users" node in "Course administration > Users"
73 Then I should see "Course 1 course" in the "Student 1" "table_row"
74 And I should see "Course 1 course" in the "Student 2" "table_row"
75 And I should see "Course 1 course" in the "Student 3" "table_row"
76 And I should see "Course 1 course" in the "Student 4" "table_row"
77 And I navigate to "Groups" node in "Course administration > Users"
78 And the "Groups" select box should contain "Course 1 course (4)"
80 Scenario: Backup and restore of meta enrolment instance
81 When I am on "Course 3" course homepage
82 And I add "Course meta link" enrolment method with:
83 | Link course | C1C1 |
84 | Add to group | Groupcourse 1 |
85 And I am on "Course 3" course homepage
86 And I add "Course meta link" enrolment method with:
87 | Link course | C2C2 |
88 When I backup "Course 3" course using this options:
89 | Confirmation | Filename | test_backup.mbz |
90 And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
91 And I press "Continue"
92 And I set the field "targetid" to "1"
93 And I click on "Continue" "button" in the ".bcs-new-course" "css_element"
95 And I set the field "Course name" to "Course 5"
97 And I press "Perform restore"
99 And I am on "Course 5 copy 1" course homepage
100 And I navigate to "Enrolment methods" node in "Course administration > Users"
101 Then I should see "Course meta link (Course 1)"
102 And I should see "Course meta link (Course 2)"
103 And I navigate to "Enrolled users" node in "Course administration > Users"
104 And I should see "Groupcourse 1" in the "Student 1" "table_row"
105 And I should see "Groupcourse 1" in the "Student 2" "table_row"
106 And I should see "Groupcourse 1" in the "Student 3" "table_row"
107 And I should see "Groupcourse 1" in the "Student 4" "table_row"
108 And I should see "Course 2" in the "Student 1" "table_row"
109 And I should not see "Course 2" in the "Student 3" "table_row"
111 Scenario: Unenrol a user from the course participants page that was enrolled via course meta link.
112 Given I am on "Course 3" course homepage
113 And I add "Course meta link" enrolment method with:
114 | Link course | C4C4 |
115 And I navigate to course participants
116 # Suspended users can be unenrolled.
117 When I click on "//a[@data-action='unenrol']" "xpath_element" in the "student2" "table_row"
118 And I click on "Yes" "button"
119 Then I should not see "Student 2" in the "participants" "table"