[ Index ]

PHP Cross Reference of moodle-2.8

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     | [email protected]   |
  26        | user2    | Second    | User     | [email protected]  |
  27        | student  | Sam       | User     | [email protected] |
  28        | teacher  | Terry     | User     | [email protected] |
  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    @javascript
  48    Scenario: Teacher can see visible cohorts defined in the above contexts
  49      When I log in as "teacher"
  50      And I follow "Course 1"
  51      And I navigate to "Enrolment methods" node in "Course administration > Users"
  52      And I set the field "Add method" to "Cohort sync"
  53      Then the "Cohort" select box should contain "Cohort in category 1"
  54      And the "Cohort" select box should contain "System cohort"
  55      And the "Cohort" select box should not contain "Cohort hidden in category 1"
  56      And the "Cohort" select box should not contain "System hidden cohort"
  57      And the "Cohort" select box should not contain "Cohort in category 2"
  58      And the "Cohort" select box should contain "Cohort empty in category 1"
  59      And the "Cohort" select box should contain "System empty cohort"
  60      And I set the field "Cohort" to "System cohort"
  61      And I press "Add method"
  62      And I navigate to "Enrolled users" node in "Course administration > Users"
  63      And I should see "[email protected]"
  64      And I navigate to "Groups" node in "Course administration > Users"
  65      And I press "Auto-create groups"
  66      And the "Select members from cohort" select box should contain "Cohort in category 1"
  67      And the "Select members from cohort" select box should contain "System cohort"
  68      And the "Select members from cohort" select box should not contain "Cohort hidden in category 1"
  69      And the "Select members from cohort" select box should not contain "System hidden cohort"
  70      And the "Select members from cohort" select box should not contain "Cohort in category 2"
  71      And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
  72      And the "Select members from cohort" select box should not contain "System empty cohort"
  73  
  74    @javascript
  75    Scenario: System manager can see all cohorts defined in the above contexts
  76      When I log in as "user1"
  77      And I follow "Course 1"
  78      And I navigate to "Enrolment methods" node in "Course administration > Users"
  79      And I set the field "Add method" to "Cohort sync"
  80      Then the "Cohort" select box should contain "Cohort in category 1"
  81      And the "Cohort" select box should contain "System cohort"
  82      And the "Cohort" select box should contain "Cohort hidden in category 1"
  83      And the "Cohort" select box should contain "System hidden cohort"
  84      And the "Cohort" select box should not contain "Cohort in category 2"
  85      And the "Cohort" select box should contain "Cohort empty in category 1"
  86      And the "Cohort" select box should contain "System empty cohort"
  87      And I set the field "Cohort" to "System cohort"
  88      And I press "Add method"
  89      And I navigate to "Enrolled users" node in "Course administration > Users"
  90      And I should see "[email protected]"
  91      And I navigate to "Groups" node in "Course administration > Users"
  92      And I press "Auto-create groups"
  93      And the "Select members from cohort" select box should contain "Cohort in category 1"
  94      And the "Select members from cohort" select box should contain "System cohort"
  95      And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
  96      And the "Select members from cohort" select box should contain "System hidden cohort"
  97      And the "Select members from cohort" select box should not contain "Cohort in category 2"
  98      And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
  99      And the "Select members from cohort" select box should not contain "System empty cohort"
 100  
 101    @javascript
 102    Scenario: Category manager can see all cohorts defined in his category and visible cohorts defined above
 103      When I log in as "user2"
 104      And I follow "Course 1"
 105      And I navigate to "Enrolment methods" node in "Course administration > Users"
 106      And I set the field "Add method" to "Cohort sync"
 107      Then the "Cohort" select box should contain "Cohort in category 1"
 108      And the "Cohort" select box should contain "System cohort"
 109      And the "Cohort" select box should contain "Cohort hidden in category 1"
 110      And the "Cohort" select box should not contain "System hidden cohort"
 111      And the "Cohort" select box should not contain "Cohort in category 2"
 112      And the "Cohort" select box should contain "Cohort empty in category 1"
 113      And the "Cohort" select box should contain "System empty cohort"
 114      And I set the field "Cohort" to "System cohort"
 115      And I press "Add method"
 116      And I navigate to "Enrolled users" node in "Course administration > Users"
 117      And I should see "[email protected]"
 118      And I navigate to "Groups" node in "Course administration > Users"
 119      And I press "Auto-create groups"
 120      And the "Select members from cohort" select box should contain "Cohort in category 1"
 121      And the "Select members from cohort" select box should contain "System cohort"
 122      And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
 123      And the "Select members from cohort" select box should not contain "System hidden cohort"
 124      And the "Select members from cohort" select box should not contain "Cohort in category 2"
 125      And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
 126      And the "Select members from cohort" select box should not contain "System empty cohort"
 127  


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1