forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-76658 Behat: Coverage for course cohort enrolment groups
Co-authored-by: Simey Lameze <[email protected]>
- Loading branch information
1 parent
880462a
commit 7bc1079
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,72 @@ Feature: Cohort enrolment management | |
And I set the field "Assign role" to "Non-editing teacher" | ||
And I click on "Save" "button" | ||
And I should see "Cohort sync (Alpha1 - Non-editing teacher)" | ||
|
||
@javascript | ||
Scenario: Course cohort enrolment sync cohorts members | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| s1 | Sandra | Cole | s1@example.com | | ||
| s2 | John | Smith | s2@example.com | | ||
| s4 | Jane | Doe | s4@example.com | | ||
And the following "cohort members" exist: | ||
| user | cohort | | ||
| s1 | A1 | | ||
| s2 | A1 | | ||
When I log in as "teacher001" | ||
And I add "Cohort sync" enrolment method in "Course 001" with: | ||
| Cohort | A1 | | ||
| customint2 | -1 | | ||
Then I should see "Cohort sync (Alpha1 - Student)" | ||
And I select "Groups" from the "jump" singleselect | ||
# Confirm that group was created and corresponding group members are present | ||
And I set the field "groups[]" to "Alpha1 cohort (2)" | ||
And the "members" select box should contain "Sandra Cole ([email protected])" | ||
And the "members" select box should contain "John Smith ([email protected])" | ||
And I log in as "admin" | ||
And I navigate to "Users > Accounts > Cohorts" in site administration | ||
And I press "Assign" action in the "Alpha1" report row | ||
And I should see "Cohort 'Alpha1' members" | ||
And I should see "Removing users from a cohort may result in unenrolling of users from multiple courses which includes deleting of user settings, grades, group membership and other user information from affected courses." | ||
# Remove user s4 from cohort | ||
And I set the field "removeselect[]" to "John Smith ([email protected])" | ||
And I click on "Remove" "button" | ||
# Add user s4 to the cohort. | ||
And I set the field "addselect_searchtext" to "s4" | ||
And I set the field "addselect[]" to "Jane Doe ([email protected])" | ||
And I click on "Add" "button" | ||
And the "removeselect[]" select box should contain "Sandra Cole ([email protected])" | ||
And the "removeselect[]" select box should contain "Jane Doe ([email protected])" | ||
And the "removeselect[]" select box should not contain "John Smith ([email protected])" | ||
And I trigger cron | ||
And I am on "Course 001" course homepage | ||
And I navigate to course participants | ||
# Verifies students 1 and 4 are in the cohort and student 2 is not any more. | ||
And the following should exist in the "participants" table: | ||
| First name / Last name | Email address | Roles | Groups | | ||
| Sandra Cole | s1@example.com | Student | Alpha1 cohort | | ||
| Jane Doe | s4@example.com | Student | Alpha1 cohort | | ||
And the following should not exist in the "participants" table: | ||
| First name / Last name | Email address | Roles | Groups | | ||
| John Smith | s2@example.com | Student | Alpha1 cohort | | ||
|
||
@javascript | ||
Scenario: Course cohort enrolment creates a new group | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| s3 | Bianca | McAfee | s3@example.com | | ||
| s5 | Abigail | Wyatt | s5@example.com | | ||
And the following "cohort members" exist: | ||
| user | cohort | | ||
| s3 | B1 | | ||
| s5 | B1 | | ||
When I log in as "teacher001" | ||
And I add "Cohort sync" enrolment method in "Course 001" with: | ||
| Cohort | B1 | | ||
And I click on "Edit" "link" in the "Beta2" "table_row" | ||
And I set the field "Add to group" to "Create new group" | ||
And I click on "Save changes" "button" | ||
And I select "Groups" from the "jump" singleselect | ||
And I set the field "groups[]" to "Beta2 cohort (2)" | ||
Then the "members" select box should contain "Bianca McAfee ([email protected])" | ||
And the "members" select box should contain "Abigail Wyatt ([email protected])" |