weekly release 4.5dev+
[moodle.git] / user / tests / behat / enrol_cohort_list.feature
blob3f09a38415e79a5bedf4669f5695a582648d647f
1 @core @core_user
2 Feature: Viewing the list of cohorts to enrol in a course
3   In order to ensure we only display the cohorts when applicable
4   As a teacher
5   I should only see the list of cohorts under some circumstances
7   Background:
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 |
13       | Course 1 | C1        |
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        |
22       | idnumber    | 1337                    |
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       |
28     And I log out
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"
35   @javascript
36   Scenario: Check we show the cohorts field if there are some present
37     Given the following "cohort" exists:
38       | name        | Test cohort name        |
39       | idnumber    | 1337                    |
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"
47   @javascript
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"