2 Feature: Guest users can auto-enrol themself in courses where guest access is allowed
3 In order to access courses contents
5 I need to access courses as a guest
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 And I log in as "teacher1"
19 And I follow "Course 1"
20 And I turn editing mode on
21 And I add a "Forum" to section "1" and I fill the form with:
22 | Forum name | Test forum name |
23 | Description | Test forum description |
24 And I click on "Edit settings" "link" in the "Administration" "block"
26 Scenario: Allow guest access without password
27 Given I set the following fields to these values:
28 | Allow guest access | Yes |
29 And I press "Save and display"
31 And I log in as "student1"
32 And I am on site homepage
33 And I follow "Course 1"
34 When I follow "Test forum name"
35 Then I should not see "Subscribe to this forum"
37 Scenario: Allow guest access with password
38 Given I set the following fields to these values:
39 | Allow guest access | Yes |
40 | Password | moodle_rules |
41 And I press "Save and display"
43 And I log in as "student1"
44 And I am on site homepage
45 When I follow "Course 1"
46 Then I should see "Guest access"
47 And I set the following fields to these values:
48 | Password | moodle_rules |
50 And I should see "Test forum name"