2 Feature: Viewing the list of cohorts to enrol in a course
3 In order to ensure we only display the cohorts when applicable
5 I should only see the list of cohorts under some circumstances
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 And the following "courses" exist:
12 | fullname | shortname |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
18 @javascript @skip_chrome_zerosize
19 Scenario: Check the teacher does not see the cohorts field without the proper capabilities
20 Given the following "cohort" exists:
21 | name | Test cohort name |
23 | description | Test cohort description |
24 And the following "role capability" exists:
25 | role | editingteacher |
26 | moodle/cohort:manage | prohibit |
27 | moodle/cohort:view | prohibit |
29 And I am on the "Course 1" course page logged in as teacher1
30 And I navigate to course participants
31 When I press "Enrol users"
32 Then I should not see "Select cohorts"
33 And I should not see "Enrol selected users and cohorts"
36 Scenario: Check we show the cohorts field if there are some present
37 Given the following "cohort" exists:
38 | name | Test cohort name |
40 | description | Test cohort description |
41 And I am on the "Course 1" course page logged in as teacher1
42 And I navigate to course participants
43 When I press "Enrol users"
44 Then I should see "Select cohorts"
45 And I should see "Enrol selected users and cohorts"
48 Scenario: Check we do not show the cohorts field if there are none present
49 Given I am on the "Course 1" course page logged in as teacher1
50 And I navigate to course participants
51 When I press "Enrol users"
52 Then I should not see "Select cohorts"
53 And I should not see "Enrol selected users and cohorts"