MDL-64506 phpunit: Update unit tests to use classic
[moodle.git] / cohort / tests / behat / view_cohorts.feature
CommitLineData
274dc068
MG
1@core @core_cohort
2Feature: View cohort list
3 In order to operate with cohorts
4 As an admin or manager
5 I need to be able to view the list of cohorts in the system
6
7 Background:
8 Given the following "categories" exist:
9 | name | category | idnumber |
10 | Cat 1 | 0 | CAT1 |
11 | Cat 2 | 0 | CAT2 |
12 | Cat 3 | CAT1 | CAT3 |
13 And the following "cohorts" exist:
14 | name | idnumber |
15 | System cohort | CH0 |
16 And the following "cohorts" exist:
17 | name | idnumber | contextlevel | reference |
18 | Cohort in category 1 | CH1 | Category | CAT1 |
19 | Cohort in category 2 | CH2 | Category | CAT2 |
20 | Cohort in category 3 | CH3 | Category | CAT3 |
21 Given the following "users" exist:
22 | username | firstname | lastname | email |
0fe86bbd
RT
23 | user1 | First | User | first@example.com |
24 | user2 | Second | User | second@example.com |
274dc068
MG
25 And the following "role assigns" exist:
26 | user | role | contextlevel | reference |
27 | user1 | manager | System | |
28 | user2 | manager | Category | CAT1 |
29
274dc068
MG
30 Scenario: Admin can see system cohorts and all cohorts
31 When I log in as "admin"
02fda279 32 And I navigate to "Users > Accounts >Cohorts" in site administration
274dc068
MG
33 Then I should see "System cohort"
34 And I should not see "Cohort in category"
35 And I follow "All cohorts"
36 And I should see "System cohort"
37 And I should see "Cohort in category 1"
38 And I should see "Cohort in category 2"
39 And I should see "Cohort in category 3"
40 And I log out
41
274dc068
MG
42 Scenario: Manager can see system cohorts and all cohorts
43 When I log in as "user1"
02fda279 44 And I navigate to "Users > Accounts >Cohorts" in site administration
274dc068
MG
45 Then I should see "System cohort"
46 And I should not see "Cohort in category"
47 And I follow "All cohorts"
48 And I should see "System cohort"
49 And I should see "Cohort in category 1"
50 And I should see "Cohort in category 2"
51 And I should see "Cohort in category 3"
52 And I log out
53
274dc068
MG
54 Scenario: Manager in category can see cohorts in the category
55 When I log in as "user2"
e5287f9b 56 And I am on course index
274dc068
MG
57 And I follow "Cat 1"
58 And I follow "Cohorts"
59 And I should not see "All cohorts"
60 And I should not see "System cohort"
61 And I should see "Cohort in category 1"
62 And I should not see "Cohort in category 2"
63 And I should not see "Cohort in category 3"
64 And I log out