[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/cohort/tests/behat/ -> access_visible_cohorts.feature (source)

   1  @core @core_cohort @enrol_cohort
   2  Feature: Access visible and hidden cohorts
   3    In order to enrol users from cohorts
   4    As an manager or teacher
   5    I need to be able to view the list of cohorts defined above the course
   6  
   7    Background:
   8      Given the following "categories" exist:
   9        | name  | category | idnumber |
  10        | Cat 1 | 0        | CAT1     |
  11        | Cat 2 | 0        | CAT2     |
  12      And the following "cohorts" exist:
  13        | name                 | idnumber | visible |
  14        | System cohort        | CV0      | 1       |
  15        | System hidden cohort | CH0      | 0       |
  16        | System empty cohort  | CVE0     | 1       |
  17      And the following "cohorts" exist:
  18        | name                        | idnumber | contextlevel | reference | visible |
  19        | Cohort in category 1        | CV1      | Category     | CAT1      | 1       |
  20        | Cohort in category 2        | CV2      | Category     | CAT2      | 1       |
  21        | Cohort hidden in category 1 | CH1      | Category     | CAT1      | 0       |
  22        | Cohort empty in category 1  | CVE1     | Category     | CAT1      | 1       |
  23      Given the following "users" exist:
  24        | username | firstname | lastname | email            |
  25        | user1    | First     | User     | first@example.com   |
  26        | user2    | Second    | User     | second@example.com  |
  27        | student  | Sam       | User     | student@example.com |
  28        | teacher  | Terry     | User     | teacher@example.com |
  29      And the following "cohort members" exist:
  30        | user    | cohort |
  31        | student | CV0   |
  32        | student | CV1   |
  33        | student | CV2   |
  34        | student | CH0   |
  35        | student | CH1   |
  36      And the following "role assigns" exist:
  37        | user  | role    | contextlevel | reference |
  38        | user1 | manager | System       |           |
  39        | user2 | manager | Category     | CAT1      |
  40      And the following "courses" exist:
  41        | fullname | shortname | category |
  42        | Course 1 | C1        | CAT1     |
  43      And the following "course enrolments" exist:
  44        | user    | course | role           |
  45        | teacher | C1     | editingteacher |
  46  
  47    Scenario: Teacher can see visible cohorts defined in the above contexts
  48      When I log in as "teacher"
  49      And I follow "Course 1"
  50      And I navigate to "Enrolment methods" node in "Course administration > Users"
  51      And I select "Cohort sync" from the "Add method" singleselect
  52      Then the "Cohort" select box should contain "Cohort in category 1"
  53      And the "Cohort" select box should contain "System cohort"
  54      And the "Cohort" select box should not contain "Cohort hidden in category 1"
  55      And the "Cohort" select box should not contain "System hidden cohort"
  56      And the "Cohort" select box should not contain "Cohort in category 2"
  57      And the "Cohort" select box should contain "Cohort empty in category 1"
  58      And the "Cohort" select box should contain "System empty cohort"
  59      And I set the field "Cohort" to "System cohort"
  60      And I press "Add method"
  61      And I navigate to "Enrolled users" node in "Course administration > Users"
  62      And I should see "student@example.com"
  63      And I navigate to "Groups" node in "Course administration > Users"
  64      And I press "Auto-create groups"
  65      And the "Select members from cohort" select box should contain "Cohort in category 1"
  66      And the "Select members from cohort" select box should contain "System cohort"
  67      And the "Select members from cohort" select box should not contain "Cohort hidden in category 1"
  68      And the "Select members from cohort" select box should not contain "System hidden cohort"
  69      And the "Select members from cohort" select box should not contain "Cohort in category 2"
  70      And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
  71      And the "Select members from cohort" select box should not contain "System empty cohort"
  72  
  73    Scenario: System manager can see all cohorts defined in the above contexts
  74      When I log in as "user1"
  75      And I am on site homepage
  76      And I follow "Course 1"
  77      And I navigate to "Enrolment methods" node in "Course administration > Users"
  78      And I select "Cohort sync" from the "Add method" singleselect
  79      Then the "Cohort" select box should contain "Cohort in category 1"
  80      And the "Cohort" select box should contain "System cohort"
  81      And the "Cohort" select box should contain "Cohort hidden in category 1"
  82      And the "Cohort" select box should contain "System hidden cohort"
  83      And the "Cohort" select box should not contain "Cohort in category 2"
  84      And the "Cohort" select box should contain "Cohort empty in category 1"
  85      And the "Cohort" select box should contain "System empty cohort"
  86      And I set the field "Cohort" to "System cohort"
  87      And I press "Add method"
  88      And I navigate to "Enrolled users" node in "Course administration > Users"
  89      And I should see "student@example.com"
  90      And I navigate to "Groups" node in "Course administration > Users"
  91      And I press "Auto-create groups"
  92      And the "Select members from cohort" select box should contain "Cohort in category 1"
  93      And the "Select members from cohort" select box should contain "System cohort"
  94      And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
  95      And the "Select members from cohort" select box should contain "System hidden cohort"
  96      And the "Select members from cohort" select box should not contain "Cohort in category 2"
  97      And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
  98      And the "Select members from cohort" select box should not contain "System empty cohort"
  99  
 100    Scenario: Category manager can see all cohorts defined in his category and visible cohorts defined above
 101      When I log in as "user2"
 102      And I am on site homepage
 103      And I follow "Course 1"
 104      And I navigate to "Enrolment methods" node in "Course administration > Users"
 105      And I select "Cohort sync" from the "Add method" singleselect
 106      Then the "Cohort" select box should contain "Cohort in category 1"
 107      And the "Cohort" select box should contain "System cohort"
 108      And the "Cohort" select box should contain "Cohort hidden in category 1"
 109      And the "Cohort" select box should not contain "System hidden cohort"
 110      And the "Cohort" select box should not contain "Cohort in category 2"
 111      And the "Cohort" select box should contain "Cohort empty in category 1"
 112      And the "Cohort" select box should contain "System empty cohort"
 113      And I set the field "Cohort" to "System cohort"
 114      And I press "Add method"
 115      And I navigate to "Enrolled users" node in "Course administration > Users"
 116      And I should see "student@example.com"
 117      And I navigate to "Groups" node in "Course administration > Users"
 118      And I press "Auto-create groups"
 119      And the "Select members from cohort" select box should contain "Cohort in category 1"
 120      And the "Select members from cohort" select box should contain "System cohort"
 121      And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
 122      And the "Select members from cohort" select box should not contain "System hidden cohort"
 123      And the "Select members from cohort" select box should not contain "Cohort in category 2"
 124      And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
 125      And the "Select members from cohort" select box should not contain "System empty cohort"
 126  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1