Commit | Line | Data |
---|---|---|
550d842e | 1 | @enrol @enrol_self |
f61abd1f DM |
2 | Feature: Users can auto-enrol themself in courses where self enrolment is allowed |
3 | In order to participate in courses | |
5d7b6307 | 4 | As a user |
f61abd1f DM |
5 | I need to auto enrol me in courses |
6 | ||
7 | Background: | |
759b323e | 8 | Given the following "users" exist: |
f61abd1f | 9 | | username | firstname | lastname | email | |
0fe86bbd RT |
10 | | teacher1 | Teacher | 1 | teacher1@example.com | |
11 | | student1 | Student | 1 | student1@example.com | | |
759b323e | 12 | And the following "courses" exist: |
f61abd1f DM |
13 | | fullname | shortname | format | |
14 | | Course 1 | C1 | topics | | |
759b323e | 15 | And the following "course enrolments" exist: |
f61abd1f DM |
16 | | user | course | role | |
17 | | teacher1 | C1 | editingteacher | | |
18 | ||
e8cf6330 AN |
19 | # Note: Please keep the javascript tag on this Scenario to ensure that we |
20 | # test use of the singleselect functionality. | |
e89c5c20 AN |
21 | @javascript |
22 | Scenario: Self-enrolment enabled as guest | |
23 | Given I log in as "teacher1" | |
24 | And I follow "Course 1" | |
25 | And I add "Self enrolment" enrolment method with: | |
26 | | Custom instance name | Test student enrolment | | |
27 | And I log out | |
28 | When I follow "Course 1" | |
29 | And I press "Log in as a guest" | |
30 | Then I should see "Guests can not access this course, please try to log in." | |
31 | And I press "Continue" | |
32 | And I should see "Log in" | |
33 | ||
f61abd1f DM |
34 | Scenario: Self-enrolment enabled |
35 | Given I log in as "teacher1" | |
36 | And I follow "Course 1" | |
37 | When I add "Self enrolment" enrolment method with: | |
38 | | Custom instance name | Test student enrolment | | |
39 | And I log out | |
40 | And I log in as "student1" | |
5c94d1ee | 41 | And I am on site homepage |
f61abd1f DM |
42 | And I follow "Course 1" |
43 | And I press "Enrol me" | |
44 | Then I should see "Topic 1" | |
45 | And I should not see "Enrolment options" | |
46 | ||
f61abd1f DM |
47 | Scenario: Self-enrolment enabled requiring an enrolment key |
48 | Given I log in as "teacher1" | |
49 | And I follow "Course 1" | |
50 | When I add "Self enrolment" enrolment method with: | |
51 | | Custom instance name | Test student enrolment | | |
52 | | Enrolment key | moodle_rules | | |
53 | And I log out | |
54 | And I log in as "student1" | |
5c94d1ee | 55 | And I am on site homepage |
f61abd1f | 56 | And I follow "Course 1" |
f083d614 | 57 | And I set the following fields to these values: |
f61abd1f DM |
58 | | Enrolment key | moodle_rules | |
59 | And I press "Enrol me" | |
60 | Then I should see "Topic 1" | |
61 | And I should not see "Enrolment options" | |
62 | And I should not see "Enrol me in this course" | |
63 | ||
f61abd1f DM |
64 | Scenario: Self-enrolment disabled |
65 | Given I log in as "student1" | |
5c94d1ee | 66 | And I am on site homepage |
f61abd1f DM |
67 | When I follow "Course 1" |
68 | Then I should see "You can not enrol yourself in this course" | |
735c3a7b | 69 | |
735c3a7b RT |
70 | Scenario: Self-enrolment enabled requiring a group enrolment key |
71 | Given I log in as "teacher1" | |
72 | And I follow "Course 1" | |
73 | When I add "Self enrolment" enrolment method with: | |
74 | | Custom instance name | Test student enrolment | | |
75 | | Enrolment key | moodle_rules | | |
76 | | Use group enrolment keys | Yes | | |
77 | And I follow "Groups" | |
78 | And I press "Create group" | |
f083d614 | 79 | And I set the following fields to these values: |
735c3a7b | 80 | | Group name | Group 1 | |
c2c5d577 | 81 | | Enrolment key | Test-groupenrolkey1 | |
735c3a7b RT |
82 | And I press "Save changes" |
83 | And I log out | |
84 | And I log in as "student1" | |
5c94d1ee | 85 | And I am on site homepage |
735c3a7b | 86 | And I follow "Course 1" |
f083d614 | 87 | And I set the following fields to these values: |
c2c5d577 | 88 | | Enrolment key | Test-groupenrolkey1 | |
735c3a7b RT |
89 | And I press "Enrol me" |
90 | Then I should see "Topic 1" | |
91 | And I should not see "Enrolment options" | |
e8cf6330 | 92 | And I should not see "Enrol me in this course" |