first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,126 @@
@core @core_cohort @enrol_cohort
Feature: Access visible and hidden cohorts
In order to enrol users from cohorts
As an manager or teacher
I need to be able to view the list of cohorts defined above the course
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
And the following "cohorts" exist:
| name | idnumber | visible |
| System cohort | CV0 | 1 |
| System hidden cohort | CH0 | 0 |
| System empty cohort | CVE0 | 1 |
And the following "cohorts" exist:
| name | idnumber | contextlevel | reference | visible |
| Cohort in category 1 | CV1 | Category | CAT1 | 1 |
| Cohort in category 2 | CV2 | Category | CAT2 | 1 |
| Cohort hidden in category 1 | CH1 | Category | CAT1 | 0 |
| Cohort empty in category 1 | CVE1 | Category | CAT1 | 1 |
Given the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| student | Sam | User | student@example.com |
| teacher | Terry | User | teacher@example.com |
And the following "cohort members" exist:
| user | cohort |
| student | CV0 |
| student | CV1 |
| student | CV2 |
| student | CH0 |
| student | CH1 |
And the following "role assigns" exist:
| user | role | contextlevel | reference |
| user1 | manager | System | |
| user2 | manager | Category | CAT1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | CAT1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher | C1 | editingteacher |
@javascript @skip_chrome_zerosize
Scenario: Teacher can see visible cohorts defined in the above contexts
When I log in as "teacher"
And I am on the "Course 1" "enrolment methods" page
And I select "Cohort sync" from the "Add method" singleselect
And I open the autocomplete suggestions list
Then "Cohort in category 1" "autocomplete_suggestions" should exist
And "System cohort" "autocomplete_suggestions" should exist
And "Cohort hidden in category 1" "autocomplete_suggestions" should not exist
And "System hidden cohort" "autocomplete_suggestions" should not exist
And "Cohort in category 2" "autocomplete_suggestions" should not exist
And "Cohort empty in category 1" "autocomplete_suggestions" should exist
And "System empty cohort" "autocomplete_suggestions" should exist
And I set the field "Cohort" to "System cohort"
And I press "Add method"
And I am on the "Course 1" "enrolled users" page
And I should see "student@example.com"
And I am on the "Course 1" "groups" page
And I press "Auto-create groups"
And the "Select members from cohort" select box should contain "Cohort in category 1"
And the "Select members from cohort" select box should contain "System cohort"
And the "Select members from cohort" select box should not contain "Cohort hidden in category 1"
And the "Select members from cohort" select box should not contain "System hidden cohort"
And the "Select members from cohort" select box should not contain "Cohort in category 2"
And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
And the "Select members from cohort" select box should not contain "System empty cohort"
@javascript @skip_chrome_zerosize
Scenario: System manager can see all cohorts defined in the above contexts
When I log in as "user1"
And I am on the "Course 1" "enrolment methods" page
And I select "Cohort sync" from the "Add method" singleselect
And I open the autocomplete suggestions list
Then "Cohort in category 1" "autocomplete_suggestions" should exist
And "System cohort" "autocomplete_suggestions" should exist
And "Cohort hidden in category 1" "autocomplete_suggestions" should exist
And "System hidden cohort" "autocomplete_suggestions" should exist
And "Cohort in category 2" "autocomplete_suggestions" should not exist
And "Cohort empty in category 1" "autocomplete_suggestions" should exist
And "System empty cohort" "autocomplete_suggestions" should exist
And I set the field "Cohort" to "System cohort"
And I press "Add method"
And I am on the "Course 1" "enrolled users" page
And I should see "student@example.com"
And I am on the "Course 1" "groups" page
And I press "Auto-create groups"
And the "Select members from cohort" select box should contain "Cohort in category 1"
And the "Select members from cohort" select box should contain "System cohort"
And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
And the "Select members from cohort" select box should contain "System hidden cohort"
And the "Select members from cohort" select box should not contain "Cohort in category 2"
And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
And the "Select members from cohort" select box should not contain "System empty cohort"
@javascript @skip_chrome_zerosize
Scenario: Category manager can see all cohorts defined in his category and visible cohorts defined above
When I log in as "user2"
And I am on the "Course 1" "enrolment methods" page
And I select "Cohort sync" from the "Add method" singleselect
And I open the autocomplete suggestions list
Then "Cohort in category 1" "autocomplete_suggestions" should exist
And "System cohort" "autocomplete_suggestions" should exist
And "Cohort hidden in category 1" "autocomplete_suggestions" should exist
And "System hidden cohort" "autocomplete_suggestions" should not exist
And "Cohort in category 2" "autocomplete_suggestions" should not exist
And "Cohort empty in category 1" "autocomplete_suggestions" should exist
And "System empty cohort" "autocomplete_suggestions" should exist
And I set the field "Cohort" to "System cohort"
And I press "Add method"
And I am on the "Course 1" "enrolled users" page
And I should see "student@example.com"
And I am on the "Course 1" "groups" page
And I press "Auto-create groups"
And the "Select members from cohort" select box should contain "Cohort in category 1"
And the "Select members from cohort" select box should contain "System cohort"
And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
And the "Select members from cohort" select box should not contain "System hidden cohort"
And the "Select members from cohort" select box should not contain "Cohort in category 2"
And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
And the "Select members from cohort" select box should not contain "System empty cohort"
+128
View File
@@ -0,0 +1,128 @@
@core @core_cohort
Feature: Add cohorts of users
In order to create site-wide groups
As an admin
I need to create cohorts and add users on them
Background:
Given the following "custom profile fields" exist:
| datatype | shortname | name |
| text | fruit | Fruit |
And the following "users" exist:
| username | firstname | lastname | email | profile_field_fruit |
| user1 | First | User | first@example.com | Apple |
| user2 | Second | User | second@example.com | Banana |
| user3 | Third | User | third@example.com | Apple |
| user4 | Forth | User | forth@example.com | Pear |
And the following "cohort" exists:
| name | Test cohort name |
| idnumber | 333 |
| description | Test cohort description |
And I log in as "admin"
And I navigate to "Users > Accounts > Cohorts" in site administration
@javascript
Scenario: Add a cohort
When I follow "Add new cohort"
And I set the following fields to these values:
| Name | My new cohort |
| Context | System |
| Cohort ID | mynewcohort |
| Description | My new cohort is cool |
And I press "Save changes"
Then the following should exist in the "generaltable" table:
| Name | Cohort ID | Description |
| My new cohort | mynewcohort | My new cohort is cool |
And I should see "Test cohort name"
And I should see "333"
And I should see "Test cohort description"
And I should see "Created manually"
@javascript
Scenario: Add users to a cohort selecting them from the system users list
When I add "First User (first@example.com)" user to "333" cohort members
And I add "Second User (second@example.com)" user to "333" cohort members
Then the following should exist in the "reportbuilder-table" table:
| Name | Cohort size |
| Test cohort name | 2 |
And I press "Assign" action in the "Test cohort name" report row
And the "Current users" select box should contain "First User (first@example.com)"
And the "Current users" select box should contain "Second User (second@example.com)"
And the "Current users" select box should not contain "Forth User (forth@example.com)"
@javascript
Scenario: Add user to cohort using custom user field search
Given the following config values are set as admin:
| showuseridentity | email,profile_field_fruit |
When I press "Assign" action in the "Test cohort name" report row
And I set the field "addselect_searchtext" to "Apple"
And I wait "1" seconds
Then the "Potential users" select box should contain "First User (first@example.com\, Apple)"
And the "Potential users" select box should not contain "Second User (second@example.com\, Banana)"
And the "Potential users" select box should not contain "Forth User (forth@example.com\, Pear)"
And I set the field "Potential users" to "Third User (third@example.com\, Apple)"
And I press "Add"
And the "Current users" select box should contain "Third User (third@example.com\, Apple)"
@javascript
Scenario: Remove user from cohort using custom user field search
Given the following config values are set as admin:
| showuseridentity | email,profile_field_fruit |
And the following "cohort members" exist:
| cohort | user |
| 333 | user1 |
| 333 | user2 |
When I press "Assign" action in the "Test cohort name" report row
And I set the field "removeselect_searchtext" to "Apple"
And I wait "1" seconds
Then the "Current users" select box should not contain "Second User (second@example.com\, Banana)"
And I set the field "Current users" to "First User (first@example.com\, Apple)"
And I press "Remove"
And the "Potential users" select box should contain "First User (first@example.com\, Apple)"
@javascript
Scenario: Add users to a cohort using a bulk user action
When I navigate to "Users > Accounts > Bulk user actions" in site administration
And I set the field "Available" to "Third User"
And I press "Add to selection"
And I set the field "Available" to "Forth User"
And I press "Add to selection"
And I set the field "id_action" to "Add to cohort"
And I press "Go"
And I set the field "Cohort" to "Test cohort name [333]"
And I press "Add to cohort"
And I navigate to "Users > Accounts > Cohorts" in site administration
Then the following should exist in the "reportbuilder-table" table:
| Name | Cohort size |
| Test cohort name | 2 |
And I press "Assign" action in the "Test cohort name" report row
And the "Current users" select box should contain "Third User (third@example.com)"
And the "Current users" select box should contain "Forth User (forth@example.com)"
And the "Current users" select box should not contain "First User (first@example.com)"
@javascript
Scenario: Add users to a cohort using a user list bulk action
When I navigate to "Users > Accounts > Browse list of users" in site administration
And I click on "Third User" "checkbox"
And I click on "Forth User" "checkbox"
And I set the field "Bulk user actions" to "Add to cohort"
And I set the field "Cohort" to "Test cohort name [333]"
And I press "Add to cohort"
And I should see "Browse list of users"
And I navigate to "Users > Accounts > Cohorts" in site administration
Then the following should exist in the "reportbuilder-table" table:
| Name | Cohort size |
| Test cohort name | 2 |
And I press "Assign" action in the "Test cohort name" report row
And the "Current users" select box should contain "Third User (third@example.com)"
And the "Current users" select box should contain "Forth User (forth@example.com)"
And the "Current users" select box should not contain "First User (first@example.com)"
@javascript
Scenario: Edit cohort name in-place
When I navigate to "Users > Accounts > Cohorts" in site administration
And I set the field "Edit cohort name" to "Students cohort"
Then I should not see "Test cohort name"
And I should see "Students cohort"
And I navigate to "Users > Accounts > Cohorts" in site administration
And I should see "Students cohort"
+73
View File
@@ -0,0 +1,73 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Cohorts steps definitions.
*
* @package core_cohort
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
/**
* Steps definitions for cohort actions.
*
* @package core_cohort
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_cohort extends behat_base {
/**
* Adds the user to the specified cohort. The user should be specified like "Firstname Lastname (user@example.com)".
*
* @Given /^I add "(?P<user_fullname_string>(?:[^"]|\\")*)" user to "(?P<cohort_idnumber_string>(?:[^"]|\\")*)" cohort members$/
* @param string $user
* @param string $cohortidnumber
*/
public function i_add_user_to_cohort_members($user, $cohortidnumber) {
// If we are not in the cohorts management we should move there before anything else.
$cohortsurl = new moodle_url('/cohort/index.php');
if (strpos($this->getSession()->getCurrentUrl(), $cohortsurl->out(false)) !== 0) {
// With JS enabled we should expand a few tree nodes.
$parentnodes = get_string('users', 'admin') . ' > ' .
get_string('accounts', 'admin');
$this->execute("behat_general::i_am_on_homepage");
$this->execute("behat_navigation::i_navigate_to_in_site_administration",
$parentnodes . ' > ' . get_string('cohorts', 'cohort')
);
}
$this->execute('behat_reportbuilder::i_press_action_in_the_report_row',
[get_string('assign', 'cohort'), $this->escape($cohortidnumber)]);
$this->execute("behat_forms::i_set_the_field_to",
array(get_string('potusers', 'cohort'), $this->escape($user))
);
$this->execute("behat_forms::press_button", get_string('add'));
$this->execute("behat_forms::press_button", get_string('backtocohorts', 'cohort'));
}
}
+39
View File
@@ -0,0 +1,39 @@
@core @core_cohort @core_customfield @javascript
Feature: Add and use cohort custom fields
In order to store an extra information about cohorts
As an admin
I need to create cohort customs fields and be able to populate them on cohort creation
Background:
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_cohort | cohort | 0 |
Scenario: Create a new cohort custom field and use the field for a new cohort
When I log in as "admin"
And I navigate to "Users > Accounts > Cohort custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field |
| Short name | testfield |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
Then the following should exist in the "generaltable" table:
| Custom field | Short name | Type |
| Test field | testfield | Short text |
And I navigate to "Users > Accounts > Cohorts" in site administration
And I follow "Add new cohort"
Then I should see "Category for test"
And I should see "Test field"
And I set the following fields to these values:
| Name | My new cohort |
| Context | System |
| Cohort ID | mynewcohort |
| Description | My new cohort description |
| Test field | Custom field text |
And I press "Save changes"
Then the following should exist in the "generaltable" table:
| Name | Cohort ID | Description |
| My new cohort | mynewcohort | My new cohort description |
And I press "Edit" action in the "My new cohort" report row
And the field "Test field" matches value "Custom field text"
@@ -0,0 +1,44 @@
@core @core_cohort @_file_upload
Feature: Upload users to a cohort
In order to quickly fill site-wide groups with users
As an admin
I need to upload a file with users data containing cohort assigns
@javascript @skip_chrome_zerosize
Scenario: Upload users and assign them to a course with cohort enrolment method enabled
Given the following "cohorts" exist:
| name | idnumber |
| Cohort 1 | ASD |
| Cohort 2 | DSA |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
And I log in as "admin"
And I add "Cohort sync" enrolment method in "Course 1" with:
| Cohort | Cohort 1 |
And I should see "Cohort sync (Cohort 1 - Student)"
And I add "Cohort sync" enrolment method in "Course 2" with:
| Cohort | Cohort 2 |
And I should see "Cohort sync (Cohort 2 - Student)"
When I navigate to "Users > Accounts > Upload users" in site administration
And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filemanager
And I press "Upload users"
And I press "Upload users"
And I press "Continue"
And I navigate to "Users > Accounts > Cohorts" in site administration
And I press "Assign" action in the "Cohort 1" report row
Then the "Current users" select box should contain "Tom Jones (tomjones@example.com)"
And the "Current users" select box should contain "Bob Jones (bobjones@example.com)"
And I press "Back to cohorts"
And I press "Assign" action in the "Cohort 2" report row
And the "Current users" select box should contain "Mary Smith (marysmith@example.com)"
And the "Current users" select box should contain "Alice Smith (alicesmith@example.com)"
And I am on the "Course 1" "enrolled users" page
And I should see "Tom Jones"
And I should see "Bob Jones"
And I should not see "Mary Smith"
And I am on the "Course 2" "enrolled users" page
And I should see "Mary Smith"
And I should see "Alice Smith"
And I should not see "Tom Jones"
+195
View File
@@ -0,0 +1,195 @@
@core @core_cohort @_file_upload
Feature: A privileged user can create cohorts using a CSV file
In order to create cohorts using a CSV file
As an admin
I need to be able to upload a CSV file and navigate through the upload process
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 3 | CAT1 | CAT3 |
@javascript
Scenario: Upload cohorts with default System context as admin
When I log in as "admin"
And I navigate to "Users > Accounts >Cohorts" in site administration
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
And I click on "Preview" "button"
Then the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | visible | Status |
| cohort name 1 | cohortid1 | first description | System | 1 | |
| cohort name 2 | cohortid2 | | System | 1 | |
| cohort name 3 | cohortid3 | | Category 1 | 0 | |
| cohort name 4 | cohortid4 | | Cat 1 | 1 | |
| cohort name 5 | cohortid5 | | Cat 2 | 0 | |
| cohort name 6 | cohortid6 | | Cat 3 | 1 | |
And I press "Upload cohorts"
And I should see "Uploaded 6 cohorts"
And I press "Continue"
And the following should exist in the "reportbuilder-table" table:
| Name | Cohort ID | Description | Cohort size | Source |
| cohort name 1 | cohortid1 | first description | 0 | Created manually |
| cohort name 2 | cohortid2 | | 0 | Created manually |
And I follow "All cohorts"
And the following should exist in the "reportbuilder-table" table:
| Category | Name | Cohort ID | Description | Cohort size | Source |
| System | cohort name 1 | cohortid1 | first description | 0 | Created manually |
| System | cohort name 2 | cohortid2 | | 0 | Created manually |
| Category 1 | cohort name 3 | cohortid3 | | 0 | Created manually |
| Cat 1 | cohort name 4 | cohortid4 | | 0 | Created manually |
| Cat 2 | cohort name 5 | cohortid5 | | 0 | Created manually |
| Cat 3 | cohort name 6 | cohortid6 | | 0 | Created manually |
And ".text-muted" "css_element" should not exist in the "cohort name 1" "table_row"
And ".text-muted" "css_element" should not exist in the "cohort name 2" "table_row"
And ".text-muted" "css_element" should exist in the "cohort name 3" "table_row"
And the "class" attribute of "cohort name 3" "table_row" should contain "text-muted"
And ".text-muted" "css_element" should not exist in the "cohort name 4" "table_row"
And the "class" attribute of "cohort name 5" "table_row" should contain "text-muted"
And ".text-muted" "css_element" should not exist in the "cohort name 6" "table_row"
@javascript @_file_upload
Scenario: Upload cohorts with default category context as admin
When I log in as "admin"
And I navigate to "Users > Accounts >Cohorts" in site administration
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
And I set the field "Default context" to "Cat 1 / Cat 3"
And I click on "Preview" "button"
Then the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | Status |
| cohort name 1 | cohortid1 | first description | Cat 3 | |
| cohort name 2 | cohortid2 | | Cat 3 | |
| cohort name 3 | cohortid3 | | Category 1 | |
| cohort name 4 | cohortid4 | | Cat 1 | |
| cohort name 5 | cohortid5 | | Cat 2 | |
| cohort name 6 | cohortid6 | | Cat 3 | |
And I press "Upload cohorts"
And I should see "Uploaded 6 cohorts"
And I press "Continue"
And I should see "Cat 3"
And I navigate to "Users > Accounts >Cohorts" in site administration
And I follow "All cohorts"
And the following should exist in the "reportbuilder-table" table:
| Category | Name | Cohort ID | Description | Cohort size | Source |
| Cat 3 | cohort name 1 | cohortid1 | first description | 0 | Created manually |
| Cat 3 | cohort name 2 | cohortid2 | | 0 | Created manually |
| Category 1 | cohort name 3 | cohortid3 | | 0 | Created manually |
| Cat 1 | cohort name 4 | cohortid4 | | 0 | Created manually |
| Cat 2 | cohort name 5 | cohortid5 | | 0 | Created manually |
| Cat 3 | cohort name 6 | cohortid6 | | 0 | Created manually |
@javascript @_file_upload
Scenario: Upload cohorts with default category context as manager
Given the following "users" exist:
| username | firstname | lastname | email |
| user1 | User | 1 | user1@example.com |
And the following "role assigns" exist:
| user | role | contextlevel | reference |
| user1 | manager | Category | CAT1 |
When I log in as "user1"
And I am on course index
And I follow "Cat 1"
And I navigate to "Cohorts" in current page administration
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
And I click on "Preview" "button"
Then the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | Status |
| cohort name 1 | cohortid1 | first description | Cat 1 | |
| cohort name 2 | cohortid2 | | Cat 1 | |
| cohort name 3 | cohortid3 | | Cat 1 | Category Category 1 not found or you don't have permission to create a cohort there. The default context will be used. |
| cohort name 4 | cohortid4 | | Cat 1 | |
| cohort name 5 | cohortid5 | | Cat 1 | Category CAT2 not found or you don't have permission to create a cohort there. The default context will be used. |
| cohort name 6 | cohortid6 | | Cat 3 | |
And I press "Upload cohorts"
And I should see "Uploaded 6 cohorts"
@javascript @_file_upload
Scenario: Upload cohorts with conflicting id number
Given the following "cohorts" exist:
| name | idnumber |
| Cohort | cohortid2 |
When I log in as "admin"
And I navigate to "Users > Accounts >Cohorts" in site administration
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
And I click on "Preview" "button"
Then I should see "Errors were found in CSV data. See details below."
Then the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | Status |
| cohort name 1 | cohortid1 | first description | System | |
| cohort name 2 | cohortid2 | | System | Cohort with the same ID number already exists |
| cohort name 3 | cohortid3 | | Category 1 | |
| cohort name 4 | cohortid4 | | Cat 1 | |
| cohort name 5 | cohortid5 | | Cat 2 | |
| cohort name 6 | cohortid6 | | Cat 3 | |
And "Upload cohorts" "button" should not exist
@javascript @_file_upload
Scenario: Upload cohorts with different ways of specifying context
When I log in as "admin"
And I navigate to "Users > Accounts >Cohorts" in site administration
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts2.csv" file to "File" filemanager
And I click on "Preview" "button"
Then the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | Status |
| Specify category as name | cohortid1 | | Category 1 | |
| Specify category as idnumber | cohortid2 | | Cat 1 | |
| Specify category as id | cohortid3 | | Category 1 | |
| Specify category as path | cohortid4 | | Cat 3 | |
| Specify category_id | cohortid5 | | Category 1 | |
| Specify category_idnumber | cohortid6 | | Cat 1 | |
| Specify category_path | cohortid7 | | Cat 3 | |
And I should not see "not found or you"
And I press "Upload cohorts"
And I should see "Uploaded 7 cohorts"
And I press "Continue"
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts3.csv" file to "File" filemanager
And I click on "Preview" "button"
And the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | Status |
| Specify context as id (system) | cohortid8 | | System | |
| Specify context as name (system) | cohortid9 | | System | |
| Specify context as category name only | cohortid10 | | Cat 1 | |
| Specify context as category path | cohortid12 | | Cat 3 | |
| Specify context as category idnumber | cohortid13 | | Cat 2 | |
And I should not see "not found or you"
And I press "Upload cohorts"
And I should see "Uploaded 5 cohorts"
@javascript @_file_upload
Scenario: Upload cohorts with theme
When I log in as "admin"
And I navigate to "Users > Accounts >Cohorts" in site administration
And I follow "Upload cohorts"
And I upload "cohort/tests/fixtures/uploadcohorts4.csv" file to "File" filemanager
And I click on "Preview" "button"
Then the following should exist in the "previewuploadedcohorts" table:
| name | idnumber | description | Context | visible | theme | Status |
| cohort name 1 | cohortid1 | first description | System | 1 | boost | |
| cohort name 2 | cohortid2 | | System | 1 | | |
| cohort name 3 | cohortid3 | | Category 1 | 0 | boost | |
| cohort name 4 | cohortid4 | | Cat 1 | 1 | classic | |
| cohort name 5 | cohortid5 | | Cat 2 | 0 | | |
| cohort name 6 | cohortid6 | | Cat 3 | 1 | classic | |
And I press "Upload cohorts"
And I should see "Uploaded 6 cohorts"
And I press "Continue"
And the following should exist in the "reportbuilder-table" table:
| Name | Cohort ID | Description | Cohort size | Source |
| cohort name 1 | cohortid1 | first description | 0 | Created manually |
| cohort name 2 | cohortid2 | | 0 | Created manually |
And I follow "All cohorts"
And the following should exist in the "reportbuilder-table" table:
| Category | Name | Cohort ID | Description | Cohort size | Source |
| System | cohort name 1 | cohortid1 | first description | 0 | Created manually |
| System | cohort name 2 | cohortid2 | | 0 | Created manually |
| Category 1 | cohort name 3 | cohortid3 | | 0 | Created manually |
| Cat 1 | cohort name 4 | cohortid4 | | 0 | Created manually |
| Cat 2 | cohort name 5 | cohortid5 | | 0 | Created manually |
| Cat 3 | cohort name 6 | cohortid6 | | 0 | Created manually |
+83
View File
@@ -0,0 +1,83 @@
@core @core_cohort
Feature: View cohort list
In order to operate with cohorts
As an admin or manager
I need to be able to view the list of cohorts in the system
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
| Cat 2 | 0 | CAT2 |
| Cat 3 | CAT1 | CAT3 |
And the following "cohorts" exist:
| name | idnumber |
| System cohort | CH0 |
And the following "cohorts" exist:
| name | idnumber | contextlevel | reference |
| Cohort in category 1 | CH1 | Category | CAT1 |
| Cohort in category 2 | CH2 | Category | CAT2 |
| Cohort in category 3 | CH3 | Category | CAT3 |
Given the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
And the following "role assigns" exist:
| user | role | contextlevel | reference |
| user1 | manager | System | |
| user2 | manager | Category | CAT1 |
Scenario: Admin can see system cohorts and all cohorts
When I log in as "admin"
And I navigate to "Users > Accounts >Cohorts" in site administration
Then I should see "System cohort"
And I should not see "Cohort in category"
And I follow "All cohorts"
And I should see "System cohort"
And I should see "Cohort in category 1"
And I should see "Cohort in category 2"
And I should see "Cohort in category 3"
And I log out
Scenario: Manager can see system cohorts and all cohorts
When I log in as "user1"
And I navigate to "Users > Accounts >Cohorts" in site administration
Then I should see "System cohort"
And I should not see "Cohort in category"
And I follow "All cohorts"
And I should see "System cohort"
And I should see "Cohort in category 1"
And I should see "Cohort in category 2"
And I should see "Cohort in category 3"
And I log out
Scenario: Manager in category can see cohorts in the category
When I log in as "user2"
And I am on course index
And I follow "Cat 1"
And I follow "Cohorts"
And I should not see "All cohorts"
And I should not see "System cohort"
And I should see "Cohort in category 1"
And I should not see "Cohort in category 2"
And I should not see "Cohort in category 3"
And I log out
@javascript
Scenario: Cohorts list can be filtered
When I log in as "admin"
And I navigate to "Users > Accounts > Cohorts" in site administration
And I follow "All cohorts"
And I click on "Filters" "button"
And I set the following fields in the "Name" "core_reportbuilder > Filter" to these values:
| Name operator | Contains |
| Name value | category 1 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then the following should exist in the "reportbuilder-table" table:
| Category | Name |
| Cat 1 | Cohort in category 1 |
And the following should not exist in the "reportbuilder-table" table:
| Category | Name |
| Cat 2 | Cohort in category 2 |
| Cat 3 | Cohort in category 3 |
| System | System cohort |