MDL-50055 enrol: Stop requiring javascript for behat tests
[moodle.git] / enrol / guest / tests / behat / guest_access.feature
CommitLineData
550d842e 1@enrol @enrol_guest
594b5a7f
DM
2Feature: Guest users can auto-enrol themself in courses where guest access is allowed
3 In order to access courses contents
4 As a guest
5 I need to access courses as a guest
6
7 Background:
759b323e 8 Given the following "users" exist:
594b5a7f 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:
594b5a7f
DM
13 | fullname | shortname | format |
14 | Course 1 | C1 | topics |
759b323e 15 And the following "course enrolments" exist:
594b5a7f
DM
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 |
047a8800 24 And I click on "Edit settings" "link" in the "Administration" "block"
594b5a7f 25
594b5a7f 26 Scenario: Allow guest access without password
f083d614 27 Given I set the following fields to these values:
594b5a7f 28 | Allow guest access | Yes |
38ea5e0a 29 And I press "Save and display"
594b5a7f
DM
30 And I log out
31 And I log in as "student1"
5c94d1ee 32 And I am on site homepage
594b5a7f
DM
33 And I follow "Course 1"
34 When I follow "Test forum name"
35 Then I should not see "Subscribe to this forum"
36
594b5a7f 37 Scenario: Allow guest access with password
f083d614 38 Given I set the following fields to these values:
594b5a7f
DM
39 | Allow guest access | Yes |
40 | Password | moodle_rules |
38ea5e0a 41 And I press "Save and display"
594b5a7f
DM
42 And I log out
43 And I log in as "student1"
5c94d1ee 44 And I am on site homepage
594b5a7f
DM
45 When I follow "Course 1"
46 Then I should see "Guest access"
f083d614 47 And I set the following fields to these values:
594b5a7f
DM
48 | Password | moodle_rules |
49 And I press "Submit"
50 And I should see "Test forum name"