Merge branch 'MDL-72090-master' of git://github.com/abgreeve/moodle

This commit is contained in:
Jun Pataleta 2021-12-09 11:17:32 +08:00
commit 107bcc143c
81 changed files with 656 additions and 368 deletions

View File

@ -12,8 +12,7 @@ Feature: Highlight non-inherited permissions
@javascript
Scenario: Override a permission
Given I am on "Course fullname" course homepage
And I navigate to "Users > Permissions" in current page administration
Given I am on the "Course fullname" "permissions" page
And I select "Manager (0)" from the "roleid" singleselect
And I click on "Prohibit" "radio" in the "View added and updated modules in recent activity block" "table_row"
And I press "Save changes"

View File

@ -27,8 +27,8 @@ Feature: Staff can check user permissions
@javascript
Scenario: Search for a user (enrolled on the course) by custom field and select them to see permissions
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Users > Permissions > Check permissions" in current page administration
When I am on the "C1" "permissions" page logged in as "admin"
And I select "Check permissions" from the "jump" singleselect
And I set the field "Search" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
Then "optgroup[label='Matching enrolled users (1)']" "css_element" should exist
@ -41,8 +41,8 @@ Feature: Staff can check user permissions
@javascript
Scenario: Search for a user (not enrolled on the course) by custom field and select them to see permissions
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Users > Permissions > Check permissions" in current page administration
When I am on the "C1" "permissions" page logged in as "admin"
And I select "Check permissions" from the "jump" singleselect
And I set the field "Search" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
Then "optgroup[label*='Potential users matching'][label*=' (1)']" "css_element" should exist

View File

@ -57,8 +57,7 @@ Feature: Set up contextual data for tests
| Grouping 1 | C1 | GG1 |
| Grouping 2 | C1 | GG2 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
Then I should see "Group 1"
And I should see "Group 2"
And I select "Groupings" from the "jump" singleselect
@ -86,8 +85,7 @@ Feature: Set up contextual data for tests
| mod/forum:editanypost | Allow | student | Course | C1 |
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I set the field "Advanced role override" to "Student (1)"
Then "mod/forum:editanypost" capability has "Allow" permission
And I press "Cancel"
@ -254,8 +252,7 @@ Feature: Set up contextual data for tests
| grouping | group |
| GG1 | G1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
Then the "groups" select box should contain "Group 1 (1)"
And the "groups" select box should contain "Group 2 (1)"
And I set the field "groups" to "Group 1 (1)"

View File

@ -35,14 +35,14 @@ Feature: Edit capabilities
Scenario: Course capabilities overrides
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Student" role with:
| mod/forum:deleteanypost | Prohibit |
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I click on "Go" "button" in the "div.advancedoverride" "css_element"
# There are two select elements and go buttons and we want to press the second one.
And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
@ -64,7 +64,7 @@ Feature: Edit capabilities
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I click on "Go" "button" in the "region-main" "region"
And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
@ -82,7 +82,7 @@ Feature: Edit capabilities
Then I should see "Teacher >= editing (Teacher)" in the "Teacher 1" "table_row"
And I should see "Teacher < \"editing\" (Non-editing teacher)" in the "Teaching Assistant" "table_row"
And I should see "Studier & 'learner' (Student)" in the "Student One" "table_row"
And I navigate to "Users > Permissions" in current page administration
And I am on the "C1" "permissions" page
And I should see "Teacher >= editing" in the "mod/forum:replypost" "table_row"
And I should see "Teacher < \"editing\"" in the "mod/forum:replypost" "table_row"
And I should see "Studier & 'learner'" in the "mod/forum:replypost" "table_row"

View File

@ -33,8 +33,7 @@ Feature: Verify that all form fields values can be get and set
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
# Select (multi-select) - Checking "the select box should contain".
And I expand all fieldsets
And the "Unenrol users" select box should contain "No roles"
@ -147,8 +146,7 @@ Feature: Verify that all form fields values can be get and set
@javascript
Scenario: with JS enabled all form fields getters and setters works as expected
Then I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
Then I am on the "Course 1" "groups" page
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
And I set the field "groups" to "Group 2"
And the "members" select box should contain "Student 2 (s2@example.com)"

View File

@ -77,8 +77,7 @@ Feature: Basic recycle bin functionality
And I wait to be redirected
And I go to the courses management page
And I should see "Course 2" in the "#course-listing" "css_element"
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 2" "groups" page
And I select "Overview" from the "jump" singleselect
And "Student 1" "text" should exist in the "Group A" "table_row"
And "Student 2" "text" should exist in the "Group A" "table_row"

View File

@ -12,8 +12,7 @@ Feature: An admin can update courses enrolments using a CSV file
@javascript
Scenario: Creating enrolment method by enable it
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
@ -25,14 +24,12 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Disable" "icon" should exist in the "Guest access" "table_row"
@javascript
Scenario: Creating enrolment method by disabling it
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
@ -44,8 +41,7 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Enable" "icon" should exist in the "Guest access" "table_row"
@javascript
@ -58,14 +54,12 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Disable" "icon" should exist in the "Guest access" "table_row"
@javascript
Scenario: Disable an enrolment method
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Enable" "link" in the "Guest access" "table_row"
And "Disable" "icon" should exist in the "Guest access" "table_row"
And I navigate to "Courses > Upload courses" in site administration
@ -76,8 +70,7 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Enable" "icon" should exist in the "Guest access" "table_row"
@javascript
@ -90,14 +83,12 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I should not see "Guest access" in the "generaltable" "table"
@javascript
Scenario: Delete an unexistent enrolment method (nothing should change)
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
@ -109,6 +100,5 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I should not see "Guest access" in the "generaltable" "table"

View File

@ -33,8 +33,7 @@ Feature: Upload users
And I should see "Tom Jones"
And I should see "Trent Reznor"
And I should see "reznor@example.com"
And I am on "Maths" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Maths" "groups" page
And I set the field "groups" to "Section 1 (1)"
And the "members" select box should contain "Tom Jones (jonest@example.com)"

View File

@ -28,6 +28,7 @@
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
require_once(__DIR__ . '/../../../../../lib/behat/behat_field_manager.php');
require_once(__DIR__ . '/../../../../../lib/tests/behat/behat_navigation.php');
require_once(__DIR__ . '/../../../../../lib/behat/form_field/behat_form_field.php');
use Behat\Gherkin\Node\TableNode as TableNode,
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException,
@ -55,15 +56,8 @@ class behat_backup extends behat_base {
// We can not use other steps here as we don't know where the provided data
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
$this->execute('behat_general::i_visit', ['/?redirect=0']);
$this->execute("behat_general::wait_until_the_page_is_ready");
// Click the course link.
$this->execute("behat_general::click_link", $backupcourse);
// Click the backup link.
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", get_string('backup'));
// Navigate to the course backup page.
$this->execute("behat_navigation::i_am_on_page_instance", [$backupcourse, 'backup']);
// Initial settings.
$this->fill_backup_restore_form($this->get_step_options($options, "Initial"));
@ -97,14 +91,8 @@ class behat_backup extends behat_base {
// We can not use other steps here as we don't know where the provided data
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
$this->execute('behat_general::i_visit', ['/?redirect=0']);
// Click the course link.
$this->execute("behat_general::click_link", $backupcourse);
// Click the backup link.
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", get_string('backup'));
// Navigate to the course backup page.
$this->execute("behat_navigation::i_am_on_page_instance", [$backupcourse, 'backup']);
// Initial settings.
$this->execute("behat_forms::press_button", get_string('jumptofinalstep', 'backup'));
@ -133,15 +121,8 @@ class behat_backup extends behat_base {
// We can not use other steps here as we don't know where the provided data
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
$this->execute('behat_general::i_visit', ['/?redirect=0']);
$this->execute("behat_general::wait_until_the_page_is_ready");
// Click the course link.
$this->execute("behat_general::click_link", $tocourse);
// Click the import link.
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", get_string('import'));
// Navigate to the course import page.
$this->execute("behat_navigation::i_am_on_page_instance", [$tocourse, 'import']);
// Select the course.
$fromcourse = behat_context_helper::escape($fromcourse);

View File

@ -40,10 +40,10 @@ Feature: Import course's contents into another course
And I log in as "teacher1"
When I import "Course 1" course into "Course 2" course using this options:
| Initial | Include permission overrides | 1 |
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
Then I should see "Non-editing teacher (1)"
And I set the field "Advanced role override" to "Non-editing teacher (1)"
And I click on "Go" "button" in the "div.advancedoverride" "css_element"
And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
And "enrol/manual:enrol" capability has "Allow" permission
Scenario: Import process without permission option
@ -53,5 +53,5 @@ Feature: Import course's contents into another course
And I log in as "teacher1"
When I import "Course 1" course into "Course 2" course using this options:
| Initial | Include permission overrides | 0 |
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 2" "permissions" page
Then I should see "Non-editing teacher (0)"

View File

@ -30,7 +30,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
Scenario: Include groups and groupings when importing a course to another course
Given I import "Course 1" course into "Course 2" course using this options:
| Initial | Include groups and groupings | 1 |
When I navigate to "Users > Groups" in current page administration
When I am on the "Course 2" "groups" page
Then I should see "Group 1"
And I should see "Group 2"
And I select "Groupings" from the "jump" singleselect
@ -40,7 +40,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
Scenario: Do not include groups and groupings when importing a course to another course
Given I import "Course 1" course into "Course 2" course using this options:
| Initial | Include groups and groupings | 0 |
When I navigate to "Users > Groups" in current page administration
When I am on the "Course 2" "groups" page
Then I should not see "Group 1"
And I should not see "Group 2"
And I select "Groupings" from the "jump" singleselect

View File

@ -66,7 +66,7 @@ Feature: Restore Moodle 2 course backups
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum post backup name |
| Description | Test forum post backup description |
And I navigate to "Restore" in current page administration
And I am on the "Course 1" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Section 3 | 0 |
Then I should see "Course 1"
@ -169,8 +169,7 @@ Feature: Restore Moodle 2 course backups
When I backup "Course 1" course using this options:
| Initial | Include enrolled users | 0 |
| Confirmation | Filename | test_backup.mbz |
And I am on "Course 2" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 2" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Overwrite course configuration | Yes |
And I navigate to "Settings" in current page administration
@ -198,8 +197,7 @@ Feature: Restore Moodle 2 course backups
When I backup "Course 1" course using this options:
| Initial | Include enrolled users | 0 |
| Confirmation | Filename | test_backup.mbz |
And I am on "Course 2" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 2" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Overwrite course configuration | No |
And I navigate to "Settings" in current page administration
@ -227,8 +225,7 @@ Feature: Restore Moodle 2 course backups
When I backup "Course 1" course using this options:
| Initial | Include enrolled users | 0 |
| Confirmation | Filename | test_backup.mbz |
And I am on "Course 4" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 4" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Overwrite course configuration | No |
And I navigate to "Settings" in current page administration
@ -254,7 +251,7 @@ Feature: Restore Moodle 2 course backups
| Confirmation | Filename | test_backup.mbz |
When I restore "test_backup.mbz" backup into a new course using this options:
| Settings | Include permission overrides | 1 |
Then I navigate to "Users > Permissions" in current page administration
Then I am on the "Course 1 copy 1" "permissions" page
And I should see "Non-editing teacher (1)"
And I set the field "Advanced role override" to "Non-editing teacher (1)"
And "enrol/manual:enrol" capability has "Allow" permission
@ -268,5 +265,5 @@ Feature: Restore Moodle 2 course backups
| Confirmation | Filename | test_backup.mbz |
When I restore "test_backup.mbz" backup into a new course using this options:
| Settings | Include permission overrides | 0 |
Then I navigate to "Users > Permissions" in current page administration
Then I am on the "Course 1 copy 1" "permissions" page
And I should see "Non-editing teacher (0)"

View File

@ -99,8 +99,7 @@ Feature: Restore Moodle 2 course backups with different user data settings
Given I navigate to "Courses > Backups > General restore defaults" in site administration
And I set the field "s_restore_restore_general_users" to ""
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 1" "restore" page
# "User data" marks the user data field for the section
# "-" marks the user data field for the data activity
And I restore "test_backup.mbz" backup into a new course using this options:
@ -116,8 +115,7 @@ Feature: Restore Moodle 2 course backups with different user data settings
Given I navigate to "Courses > Backups > General restore defaults" in site administration
And I set the field "s_restore_restore_general_users" to ""
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 1" "restore" page
When I restore "test_backup.mbz" backup into a new course using this options:
| Settings | Include enrolled users | 0 |
Then I should see "Test database name"

View File

@ -82,8 +82,7 @@ Feature: Award badges with separate groups
@javascript
Scenario: Award course badge as non-editing teacher with more than one group
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I set the field "groups" to "Class B (2)"
And I press "Add/remove users"
And I set the field "addselect" to "Teacher 2 (teacher2@example.com)"
@ -107,8 +106,7 @@ Feature: Award badges with separate groups
@javascript
Scenario: Award course badge as non-editing teacher without any group
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I set the field "groups" to "Class A (2)"
And I press "Add/remove users"
And I set the field "removeselect" to "Teacher 2 (teacher2@example.com)"

View File

@ -45,8 +45,7 @@ Feature: Expand the courses nodes within the navigation block
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I turn editing mode off
And I am on "Course 2" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 2" "enrolment methods" page
And I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |

View File

@ -27,8 +27,7 @@ Feature: Allowed blocks controls
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
| block/activity_modules:addinstance | Prohibit |
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| block/completionstatus:addinstance | Prohibit |
And I log out

View File

@ -47,8 +47,7 @@ Feature: Access visible and hidden cohorts
@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 "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
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
@ -60,11 +59,9 @@ Feature: Access visible and hidden cohorts
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 "Course 1" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 1" "enrolled users" page
And I should see "student@example.com"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
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"
@ -77,8 +74,7 @@ Feature: Access visible and hidden cohorts
@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 "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
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
@ -90,10 +86,9 @@ Feature: Access visible and hidden cohorts
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 "Course 1" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 1" "enrolled users" page
And I should see "student@example.com"
And I navigate to "Users > Groups" in current page administration
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"
@ -106,8 +101,7 @@ Feature: Access visible and hidden cohorts
@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 "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
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
@ -119,10 +113,9 @@ Feature: Access visible and hidden cohorts
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 "Course 1" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 1" "enrolled users" page
And I should see "student@example.com"
And I navigate to "Users > Groups" in current page administration
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"

View File

@ -15,12 +15,10 @@ Feature: Upload users to a cohort
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I add "Cohort sync" enrolment method with:
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 am on "Course 2" course homepage
And I add "Cohort sync" enrolment method with:
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
@ -36,13 +34,11 @@ Feature: Upload users to a cohort
And I click on "Assign" "link" in the "Cohort 2" "table_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 "Course 1" course homepage
And I navigate to "Users > Enrolled users" in current page administration
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 "Course 2" course homepage
And I navigate to "Users > Enrolled users" in current page administration
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"

View File

@ -32,8 +32,7 @@ Feature: Completion with no calendar capabilites
| id_completionexpected_month | 1 |
| id_completionexpected_year | 2017 |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -179,8 +179,7 @@ Feature: Content bank use editor feature
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
| Course | C1 | contenttype_h5p | teacher1 | ipsums.h5p | /h5p/tests/fixtures/ipsums.h5p |
And I am on "Course 1" course homepage
And I navigate to "Copy course" in current page administration
And I am on the "Course 1" "course copy" page
And I set the following fields to these values:
| Course full name | Copy |
| Course short name | Copy |

View File

@ -250,7 +250,7 @@ Feature: Test category management actions
# Redirect
And I should see "Assign roles in Category: Cat 1"
And I should see "Please choose a role to assign"
And I click on "Back" "button"
And I follow "Manage this category"
# Redirect
And I should see the "Course categories and courses" management page
And "Cat 1" "link" should exist in the "#category-listing" "css_element"

View File

@ -29,8 +29,7 @@ Feature: Keyholder role is listed as course contact
And the following "courses" exist:
| fullname | shortname | format | coursedisplay | numsections | category |
| Course 1 | C1 | topics | 0 | 5 | CAT1 |
And I am on "Course 1" course homepage
And I add "Self enrolment" enrolment method with:
And I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
| Enrolment key | letmein |
And I log out

View File

@ -33,8 +33,7 @@ Feature: Restrict activities availability
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
| mod/chat:addinstance | Prohibit |
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| mod/glossary:addinstance | Prohibit |
And I log out

View File

@ -19,9 +19,7 @@ Feature: Enrol multiple cohorts
@javascript
Scenario: Add multiple cohorts to the course
When I log in as "teacher001"
And I am on "Course 001" course homepage
And I navigate to course participants
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 001" "enrolment methods" page
And I select "Cohort sync" from the "Add method" singleselect
And I open the autocomplete suggestions list
And I click on "Alpha1" item in the autocomplete list

View File

@ -28,16 +28,13 @@ Feature: Unenrol action to disable course enrolment
@javascript @skip_chrome_zerosize
Scenario: Removing the user from the cohort will suspend the enrolment but keep the role
When I log in as "teacher001"
And I am on "Course 001" course homepage
And I navigate to course participants
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 001" "enrolment methods" page
And I select "Cohort sync" from the "Add method" singleselect
And I open the autocomplete suggestions list
Then "System cohort" "autocomplete_suggestions" should exist
And I set the field "Cohort" to "System cohort"
And I press "Add method"
And I am on "Course 001" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 001" "enrolled users" page
And I should see "student001@example.com"
And I should see "student002@example.com"
And I should see "student003@example.com"
@ -63,16 +60,13 @@ Feature: Unenrol action to disable course enrolment
@javascript @skip_chrome_zerosize
Scenario: Deleting non-empty cohort will suspend the enrolment but keep the role
When I log in as "teacher001"
And I am on "Course 001" course homepage
And I navigate to course participants
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 001" "enrolment methods" page
And I select "Cohort sync" from the "Add method" singleselect
And I open the autocomplete suggestions list
Then "System cohort" "autocomplete_suggestions" should exist
And I set the field "Cohort" to "System cohort"
And I press "Add method"
And I am on "Course 001" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 001" "enrolled users" page
And I should see "student001@example.com"
And I should see "student002@example.com"
And I should see "student003@example.com"

View File

@ -25,8 +25,7 @@ Feature: Signing up for a course with a fee enrolment method
@javascript
Scenario: Student can see the payment prompt on the course enrolment page
When I log in as "manager1"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I select "Enrolment on payment" from the "Add method" singleselect
And I set the following fields to these values:
| Payment account | Account1 |

View File

@ -23,11 +23,12 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
| intro | Test forum description |
| section | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I am on "Course 1" course homepage
And I turn editing mode on
And I am on the "Course 1" "enrolment methods" page
Scenario: Allow guest access without password
Given I navigate to "Users > Enrolment methods" in current page administration
And I click on "Edit" "link" in the "Guest access" "table_row"
Given I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |
And I press "Save changes"
@ -38,8 +39,7 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
Then I should not see "Subscribe to this forum"
Scenario: Allow guest access with password
Given I navigate to "Users > Enrolment methods" in current page administration
And I click on "Edit" "link" in the "Guest access" "table_row"
Given I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |
| Password | moodle_rules |

View File

@ -30,8 +30,7 @@ Feature: Check that settings are adhered to when creating an enrolment plugin
Scenario: As an admin set site-wide settings for the enrolment plugin and ensure they are used
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I select "Publish as LTI tool" from the "Add method" singleselect
When I expand all fieldsets
Then the field "Email display" matches value "Allow everyone to see my email address"

View File

@ -24,8 +24,8 @@ Feature: Check that the page listing the shared external tools is functioning as
Scenario: I want to edit an external tool
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Users > Enrolment methods" in current page administration
And I turn editing mode on
And I am on the "Course 1" "enrolment methods" page
And I select "Publish as LTI tool" from the "Add method" singleselect
And I set the following fields to these values:
| Custom instance name | Assignment - LTI |

View File

@ -25,8 +25,7 @@ Feature: A teacher can manage manually enrolled users in their course
| capability | permission | role | contextlevel | reference |
| moodle/site:viewfullnames | <permission> | editingteacher | Course | C1 |
When I log in as "teacher"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I click on "Enrol users" "link" in the "Manual enrolments" "table_row"
And I set the field "addselect_searchtext" to "First"
And I wait "1" seconds
@ -50,8 +49,7 @@ Feature: A teacher can manage manually enrolled users in their course
| user1 | C1 | student |
| user2 | C1 | student |
When I log in as "teacher"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I click on "Enrol users" "link" in the "Manual enrolments" "table_row"
And I set the field "removeselect_searchtext" to "First"
And I wait "1" seconds

View File

@ -37,25 +37,20 @@ Feature: Enrolments are synchronised with meta courses
And I am on course index
Scenario: Add meta enrolment instance without groups
When I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
When I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C1C1 |
And I am on "Course 3" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 3" "enrolled users" page
Then I should see "No groups" in the "Student 1" "table_row"
And I should see "No groups" in the "Student 4" "table_row"
Scenario: Add meta enrolment instance with groups
When I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
When I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C1C1 |
| Add to group | Groupcourse 1 |
And I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
And I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C2C2 |
| Add to group | Groupcourse 2 |
And I am on "Course 3" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 3" "enrolled users" page
Then I should see "Groupcourse 1" in the "Student 1" "table_row"
And I should see "Groupcourse 1" in the "Student 2" "table_row"
And I should see "Groupcourse 1" in the "Student 3" "table_row"
@ -66,26 +61,22 @@ Feature: Enrolments are synchronised with meta courses
And I should not see "Groupcourse 2" in the "Student 4" "table_row"
Scenario: Add meta enrolment instance with auto-created groups
When I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
When I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C1C1 |
| Add to group | Create new group |
And I am on "Course 3" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 3" "enrolled users" page
Then I should see "Course 1 course" in the "Student 1" "table_row"
And I should see "Course 1 course" in the "Student 2" "table_row"
And I should see "Course 1 course" in the "Student 3" "table_row"
And I should see "Course 1 course" in the "Student 4" "table_row"
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 3" "groups" page
And the "Groups" select box should contain "Course 1 course (4)"
Scenario: Backup and restore of meta enrolment instance
When I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
When I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C1C1 |
| Add to group | Groupcourse 1 |
And I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
And I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C2C2 |
When I backup "Course 3" course using this options:
| Confirmation | Filename | test_backup.mbz |
@ -98,12 +89,10 @@ Feature: Enrolments are synchronised with meta courses
And I press "Next"
And I press "Perform restore"
And I trigger cron
And I am on "Course 5 copy 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 5 copy 1" "enrolment methods" page
Then I should see "Course meta link (Course 1)"
And I should see "Course meta link (Course 2)"
And I am on "Course 5 copy 1" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 5 copy 1" "enrolled users" page
And I should see "Groupcourse 1" in the "Student 1" "table_row"
And I should see "Groupcourse 1" in the "Student 2" "table_row"
And I should see "Groupcourse 1" in the "Student 3" "table_row"
@ -112,8 +101,7 @@ Feature: Enrolments are synchronised with meta courses
And I should see "Course meta link (Course 2)" in the "Enrolment method" "table_row"
Scenario: Unenrol a user from the course participants page that was enrolled via course meta link.
Given I am on "Course 3" course homepage
And I add "Course meta link" enrolment method with:
Given I add "Course meta link" enrolment method in "Course 3" with:
| Link course | C4C4 |
And I navigate to course participants
# Suspended users can be unenrolled.

View File

@ -34,8 +34,7 @@ Feature: Users can be defined as key holders in courses where self enrolment is
@javascript
Scenario: The key holder name is displayed on site home page
Given I log in as "admin"
And I am on "Course 1" course homepage
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
| Enrolment key | moodle_rules |
And I log out

View File

@ -21,8 +21,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
@javascript
Scenario: Self-enrolment enabled as guest
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I add "Self enrolment" enrolment method with:
And I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
And I log out
When I am on "Course 1" course homepage
@ -33,8 +32,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
Scenario: Self-enrolment enabled
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
And I log out
And I log in as "student1"
@ -45,8 +43,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
Scenario: Self-enrolment enabled requiring an enrolment key
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
| Enrolment key | moodle_rules |
And I log out
@ -66,13 +63,11 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
Scenario: Self-enrolment enabled requiring a group enrolment key
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
| Enrolment key | moodle_rules |
| Use group enrolment keys | Yes |
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group 1 |
@ -91,8 +86,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
@javascript
Scenario: Edit a self-enrolled user's enrolment from the course participants page
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
And I log out
And I log in as "student1"
@ -112,8 +106,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
@javascript
Scenario: Unenrol a self-enrolled student from the course participants page
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
And I log out
And I log in as "student1"
@ -133,7 +126,7 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
Given the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I am on the "C1" "Course" page logged in as "teacher1"
When I add "Self enrolment" enrolment method with:
When I add "Self enrolment" enrolment method in "Course 1" with:
| Custom instance name | Test student enrolment |
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration

View File

@ -40,18 +40,15 @@ use Behat\Gherkin\Node\TableNode as TableNode;
class behat_enrol extends behat_base {
/**
* Adds the specified enrolment method to the current course filling the form with the provided data.
* Add the specified enrolment method to the specified course filling the form with the provided data.
*
* @Given /^I add "(?P<enrolment_method_name_string>(?:[^"]|\\")*)" enrolment method with:$/
* @param string $enrolmethod
* @param TableNode $table
* @Given /^I add "(?P<enrolment_method_name_string>(?:[^"]|\\")*)" enrolment method in "(?P<course_identifier_string>(?:[^"]|\\")*)" with:$/
* @param string $enrolmethod The enrolment method being used
* @param string $courseidentifier The courseidentifier such as short name
* @param TableNode $table Enrolment details
*/
public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {
// Navigate to enrolment method page.
$parentnodes = get_string('users', 'admin');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
array($parentnodes .' > '. get_string('type_enrol_plural', 'plugin'))
);
public function i_add_enrolment_method_for_with(string $enrolmethod, string $courseidentifier, TableNode $table): void {
$this->execute("behat_navigation::i_am_on_page_instance", [$courseidentifier, 'enrolment methods']);
// Select enrolment method.
$this->execute('behat_forms::i_select_from_the_singleselect',
@ -71,7 +68,6 @@ class behat_enrol extends behat_base {
// Save changes.
$this->execute("behat_forms::press_button", get_string('addinstance', 'enrol'));
}
/**
@ -87,10 +83,14 @@ class behat_enrol extends behat_base {
public function i_enrol_user_as($userfullname, $rolename) {
// Navigate to enrolment page.
$parentnodes = get_string('users', 'admin');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
array($parentnodes . ' > '. get_string('enrolledusers', 'enrol'))
);
try {
$parentnodes = get_string('users', 'admin');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
array($parentnodes . ' > '. get_string('enrolledusers', 'enrol'))
);
} catch (Exception $e) {
$this->execute("behat_general::i_click_on", [get_string('participants'), 'link']);
}
$this->execute("behat_forms::press_button", get_string('enrolusers', 'enrol'));

View File

@ -16,12 +16,11 @@ Feature: User can be enrolled into a course
Scenario: User can be enrolled without javascript
When I enrol "Studie One" user as "Student"
And I am on "Course 001" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 001" "Enrolled users" page
Then I should see "Studie One"
@javascript
Scenario: User can be enrolled with javascript enrol element
When I enrol "Studie One" user as "Student"
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 001" "Enrolled users" page
Then I should see "Studie One"

View File

@ -21,8 +21,7 @@ Feature: Test role visibility for the participants page
Scenario: Check the default roles are visible
Given I log in as "manager1"
And I am on "Course 1" course homepage
When I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 1" "enrolled users" page
Then "Learner 1" row "Roles" column of "participants" table should contain "Student"
And "Teacher 1" row "Roles" column of "participants" table should contain "Teacher"
And "Manager 1" row "Roles" column of "participants" table should contain "Manager"
@ -30,8 +29,7 @@ Feature: Test role visibility for the participants page
Scenario: Do not allow managers to view any roles but manager and check they are hidden
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 1" "enrolled users" page
Then "Learner 1" row "Roles" column of "participants" table should contain "Student"
And "Teacher 1" row "Roles" column of "participants" table should contain "Teacher"
And "Manager 1" row "Roles" column of "participants" table should not contain "Manager"

View File

@ -6,6 +6,7 @@ information provided here is intended especially for developers.
* Final deprecation of the following webservice:
* core_enrol_edit_user_enrolment
* External function core_enrol_external::get_users_courses now returns the last time a course was modified (timemodified field)
* The behat step i_add_enrolment_method_with() has been deprecated. Please use the new method i_add_enrolment_method_for_with()
=== 3.11 ===

View File

@ -2854,7 +2854,8 @@ function grade_button($type, $courseid, $object) {
function grade_extend_settings($plugininfo, $courseid) {
global $PAGE;
$gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER);
$gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER,
null, 'gradeadmin');
$strings = array_shift($plugininfo);

View File

@ -42,8 +42,7 @@ Feature: Average grades are displayed in the gradebook
And I press "Save changes"
And I turn editing mode off
# Suspend a user
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolled users" in current page administration
And I am on the "Course 1" "enrolled users" page
And I click on "Edit enrolment" "link" in the "Student 2" "table_row"
And I set the following fields to these values:
| Status | Suspended |

View File

@ -37,8 +37,7 @@ Feature: Automatic creation of groups
| student10 | C1 | student | 0 |
| suspendedstudent11 | C1 | student | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I press "Auto-create groups"
And I expand all fieldsets
@ -171,8 +170,7 @@ Feature: Automatic creation of groups
| moodle/course:viewsuspendedusers | Prevent |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I press "Auto-create groups"
Then I should not see "Include only active enrolments"
And I set the field "Group/member count" to "11"

View File

@ -24,8 +24,7 @@ Feature: Organize students into groups
| student2 | C1 | student |
| student3 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group 1 |
@ -77,8 +76,7 @@ Feature: Organize students into groups
And the following config values are set as admin:
| showuseridentity | email,country |
And I log in as "teacher"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group 1 |
@ -106,8 +104,7 @@ Feature: Organize students into groups
| moodle/course:changeidnumber | Prevent |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I press "Create group"
Then the "idnumber" "field" should be readonly
And I set the following fields to these values:
@ -128,8 +125,7 @@ Feature: Organize students into groups
| Course 1 | C1 | 0 | 1 |
| Course 2 | C2 | 0 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I press "Create group"
And I set the following fields to these values:
| Group name | Group A |
@ -150,8 +146,7 @@ Feature: Organize students into groups
| Enrolment key | Abcdef-2 |
And I press "Save changes"
And the "groups" select box should contain "Group B (0)"
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 2" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group A |

View File

@ -30,8 +30,8 @@ Feature: Custom profile fields in groups
@javascript
Scenario: Check the custom profile fields show up and can be searched on
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Users > Groups" in current page administration
When I am logged in as "admin"
And I am on the "Course 1" "groups" page
# Check the Overview page.
And I select "Overview" from the "jump" singleselect

View File

@ -15,8 +15,7 @@ Feature: Automatic deletion of groups and groupings
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group (without ID) |
@ -64,8 +63,7 @@ Feature: Automatic deletion of groups and groupings
| moodle/course:changeidnumber | Prevent |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I set the field "groups" to "Group (with ID) (0)"
Then the "Delete selected group" "button" should be disabled
And I set the field "groups" to "Group (without ID) (0)"

View File

@ -27,7 +27,7 @@ Feature: The description of a group can be viewed by students and teachers
And I set the following fields to these values:
| Group mode | Visible groups |
And I press "Save and display"
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group A |
@ -76,7 +76,7 @@ Feature: The description of a group can be viewed by students and teachers
And I set the following fields to these values:
| Group mode | Separate groups |
And I press "Save and display"
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group A |

View File

@ -20,8 +20,7 @@ Feature: Importing of groups and groupings
@javascript
Scenario: Import groups and groupings as teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
And I press "Import groups"
@ -55,8 +54,7 @@ Feature: Importing of groups and groupings
@javascript
Scenario: Import groups with idnumber when the user has proper permissions for the idnumber field
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
And I press "Import groups"
@ -91,14 +89,12 @@ Feature: Importing of groups and groupings
@javascript
Scenario: Import groups with idnumber when the user does not have proper permissions for the idnumber field
Given I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| moodle/course:changeidnumber | Prevent |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
And I press "Import groups"
@ -127,8 +123,7 @@ Feature: Importing of groups and groupings
@javascript
Scenario: Import groups into multiple courses as a teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import_multicourse.csv" file to "Import" filemanager
And I press "Import groups"
@ -144,8 +139,7 @@ Feature: Importing of groups and groupings
And I should see "group8"
And I should not see "group9"
And I should not see "group-will-not-be-created"
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 2" "groups" page
And I should see "group9"
And I should not see "group-will-not-be-created"
And I should not see "group7"

View File

@ -15,8 +15,7 @@ Feature: Uniqueness of Group ID number
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
Scenario: Group ID number uniqueness
Given I press "Create group"

View File

@ -57,8 +57,7 @@ Feature: Group overview
Scenario: Filter the overview in various different ways
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I select "Overview" from the "jump" singleselect
# Grouping All and Group All filter

View File

@ -29,8 +29,7 @@ Feature: Test role visibility for the groups management page
Scenario: Check the default roles are visible
Given I log in as "manager1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I set the field "groups" to "Group 1 (3)"
And I press "Show members for group"
Then "optgroup[label='No roles']" "css_element" should not exist in the "#members" "css_element"
@ -41,8 +40,7 @@ Feature: Test role visibility for the groups management page
Scenario: Do not allow managers to view any roles and check they are hidden
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
When I set the field "groups" to "Group 1 (3)"
And I press "Show members for group"
Then "optgroup[label='No roles']" "css_element" should exist in the "#members" "css_element"

View File

@ -15,8 +15,7 @@ Feature: Automatic updating of groups and groupings
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group (without ID) |
@ -71,8 +70,7 @@ Feature: Automatic updating of groups and groupings
| moodle/course:changeidnumber | Prevent |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I set the field "groups" to "Group (with ID)"
When I press "Edit group settings"
Then the "idnumber" "field" should be readonly
@ -108,8 +106,7 @@ Feature: Automatic updating of groups and groupings
| teacher1 | C2 | editingteacher |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I set the field "groups" to "Group (with ID)"
And I press "Edit group settings"
And I set the following fields to these values:
@ -133,8 +130,7 @@ Feature: Automatic updating of groups and groupings
| Enrolment key | Abcdef-2 |
And I press "Save changes"
And I should not see "This enrolment key is already used for another group."
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 2" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group A |

View File

@ -46,6 +46,8 @@ $string['aria:favourite'] = 'Course is starred';
$string['aria:favouritestab'] = 'Starred activities';
$string['aria:recommendedtab'] = 'Recommended activities';
$string['aria:modulefavourite'] = 'Star {$a} activity';
$string['browsecourseadminindex'] = 'Browse the course administration with this index.';
$string['browsesettingindex'] = 'Browse settings with this index.';
$string['completion_automatic:done'] = 'Done:';
$string['completion_automatic:failed'] = 'Failed:';
$string['completion_automatic:todo'] = 'To do:';

View File

@ -17,6 +17,7 @@
namespace core\navigation\views;
use navigation_node;
use url_select;
/**
* Class secondary_navigation_view.
@ -36,6 +37,9 @@ class secondary extends view {
/** @var int The maximum limit of navigation nodes displayed in the secondary navigation */
const MAX_DISPLAYED_NAV_NODES = 5;
/** @var navigation_node The course overflow node. */
protected $courseoverflownode = null;
/**
* Defines the default structure for the secondary nav in a course context.
*
@ -252,13 +256,15 @@ class secondary extends view {
if ($child->has_children()) {
$additionalchildren = true;
$urldata[][$child->text] = $additionalnode + $this->get_additional_child_nodes($child);
$text = (is_a($child->text, 'lang_string')) ? $child->text->out() : $child->text;
$urldata[][$text] = $additionalnode + $this->get_additional_child_nodes($child);
} else {
$initialchildren += $additionalnode;
}
}
if ($additionalchildren) {
$urldata[][$node->text] = $initialchildren;
$text = (is_a($node->text, 'lang_string')) ? $node->text->out() : $node->text;
$urldata[][$text] = $initialchildren;
} else {
$urldata = $initialchildren;
}
@ -326,6 +332,30 @@ class secondary extends view {
return $newnode;
}
/**
* Returns a list of all expected nodes in the course administration.
*
* @return array An array of keys for navigation nodes in the course administration.
*/
protected function get_expected_course_admin_nodes(): array {
$expectednodes = [];
foreach ($this->get_default_course_mapping()['settings'] as $value) {
foreach ($value as $nodekey => $notused) {
$expectednodes[] = $nodekey;
}
}
foreach ($this->get_default_course_mapping()['navigation'] as $value) {
foreach ($value as $nodekey => $notused) {
$expectednodes[] = $nodekey;
}
}
$othernodes = ['users', 'gradeadmin', 'coursereports', 'coursebadges'];
$leftovercourseadminnodes = ['backup', 'restore', 'import', 'copy', 'reset'];
$expectednodes = array_merge($expectednodes, $othernodes);
$expectednodes = array_merge($expectednodes, $leftovercourseadminnodes);
return $expectednodes;
}
/**
* Load the course secondary navigation. Since we are sourcing all the info from existing objects that already do
* the relevant checks, we don't do it again here.
@ -345,17 +375,9 @@ class secondary extends view {
$nodesordered += $this->get_leaf_nodes($navigation, $nodes['navigation'] ?? []);
$this->add_ordered_nodes($nodesordered);
$coursecontext = \context_course::instance($course->id);
if (has_capability('moodle/course:update', $coursecontext)) {
// All additional nodes will be available under the 'Course admin' page.
$text = get_string('courseadministration');
$url = new \moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
$this->add($text, $url, null, null, 'courseadmin', new \pix_icon('t/edit', $text));
}
// Try to get any custom nodes defined by a user which may include containers.
$expectedcourseadmin = ['editsettings', 'coursecompletion', 'users', 'coursereports', 'gradebooksetup', 'coursebadges',
'backup', 'restore', 'import', 'copy', 'reset', 'questionbank'];
$expectedcourseadmin = $this->get_expected_course_admin_nodes();
foreach ($settingsnav->children as $value) {
if ($value->key == 'courseadmin') {
foreach ($value->children as $other) {
@ -363,12 +385,76 @@ class secondary extends view {
$othernode = $this->get_first_action_for_node($other);
// Get the first node and check whether it's been added already.
if ($othernode && !$this->get($othernode->key)) {
$this->add_node(clone $othernode);
$this->add_node($othernode);
} else {
$this->add_node($other);
}
}
}
}
}
$coursecontext = \context_course::instance($course->id);
if (has_capability('moodle/course:update', $coursecontext)) {
$overflownode = $this->get_course_overflow_nodes();
if (is_null($overflownode)) {
return;
}
$actionnode = $this->get_first_action_for_node($overflownode);
// All additional nodes will be available under the 'Course admin' page.
$text = get_string('courseadministration');
$this->add($text, $actionnode->action, null, null, 'courseadmin', new \pix_icon('t/edit', $text));
}
}
/**
* Gets the overflow navigation nodes for the course administration category.
*
* @return navigation_node The course overflow nodes.
*/
protected function get_course_overflow_nodes(): ?navigation_node {
global $SITE;
// This gets called twice on some pages, and so trying to create this navigation node twice results in no children being
// present the second time this is called.
if (isset($this->courseoverflownode)) {
return $this->courseoverflownode;
}
// Start with getting the base node for the front page or the course.
$node = null;
if ($this->page->course == $SITE->id) {
$node = $this->page->settingsnav->find('frontpage', navigation_node::TYPE_SETTING);
} else {
$node = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
}
$coursesettings = $node->get_children_key_list();
$thissettings = $this->get_children_key_list();
$diff = array_diff($coursesettings, $thissettings);
// Remove our specific created elements (user - participants, badges - coursebadges, grades - gradebooksetup).
$shortdiff = array_filter($diff, function($value) {
return !($value == 'users' || $value == 'coursebadges' || $value == 'gradebooksetup');
});
// Permissions may be in play here that ultimately will show no overflow.
if (empty($shortdiff)) {
return null;
}
$firstitem = array_shift($shortdiff);
$navnode = $node->get($firstitem);
foreach ($shortdiff as $key) {
$courseadminnodes = $node->get($key);
if ($courseadminnodes) {
if ($courseadminnodes->parent->key == $node->key) {
$navnode->add_node($courseadminnodes);
}
}
}
$this->courseoverflownode = $navnode;
return $navnode;
}
/**
@ -398,28 +484,100 @@ class secondary extends view {
/**
* Returns a url_select object with overflow navigation nodes.
* This looks to see if the current page is within the course administration, or some other page that requires an overflow
* select object.
*
* @return \url_select|null The overflow menu data.
* @return url_select|null The overflow menu data.
*/
public function get_overflow_menu_data(): ?\url_select {
public function get_overflow_menu_data(): ?url_select {
$activenode = $this->find_active_node();
if ($activenode && $activenode->has_action() && $activenode->has_children() && $activenode->key != 'coursehome') {
// This needs to be expanded to does the active node have children and does the page url match any of the children.
$menunode = $this->page->settingsnav->find($activenode->key, null);
if ($menunode instanceof navigation_node) {
// Loop through all children and try and find a match to the current url.
$matchednode = $this->nodes_match_current_url($menunode);
if (is_null($matchednode)) {
return null;
}
if (!isset($menunode) || !$menunode->has_children()) {
return null;
}
$selectdata = $this->get_menu_array($menunode);
return new \url_select($selectdata, $matchednode->action->out(), null);
$incourseadmin = false;
if (!$activenode) {
// Could be in the course admin section.
$courseadmin = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
if (!$courseadmin) {
return null;
}
$activenode = $courseadmin->find_active_node();
if (!$activenode) {
return null;
}
$incourseadmin = true;
}
return null;
if ($activenode->key == 'courseadmin' || $incourseadmin) {
$courseoverflownode = $this->get_course_overflow_nodes();
if (is_null($courseoverflownode)) {
return null;
}
$menuarray = $this->get_menu_array($courseoverflownode);
if ($activenode->key != 'courseadmin') {
$inmenu = false;
foreach ($menuarray as $key => $value) {
if ($this->page->url->out(false) == $key) {
$inmenu = true;
}
}
if (!$inmenu) {
return null;
}
}
$menuselect = new url_select($menuarray, $this->page->url, null);
$menuselect->set_label(get_string('browsecourseadminindex', 'course'), ['class' => 'sr-only']);
return $menuselect;
} else {
return $this->get_other_overflow_menu_data($activenode);
}
}
/**
* Gets overflow menu data for third party plugin settings.
*
* @param navigation_node $activenode The node to gather the children for to put into the overflow menu.
* @return url_select|null The overflow menu in a url_select object.
*/
protected function get_other_overflow_menu_data(navigation_node $activenode): ?url_select {
if (!$activenode->has_action()) {
return null;
}
if (!$activenode->has_children()) {
return null;
}
// If the setting is extending the course navigation then the page being redirected to should be in the course context.
// It was decided on the issue that put this code here that plugins that extend the course navigation should have the pages
// that are redirected to, be in the course context or module context depending on which callback was used.
// Third part plugins were checked to see if any existing plugins had settings in a system context and none were found.
// The request of third party developers is to keep their settings within the specified context.
if ($this->page->context->contextlevel != CONTEXT_COURSE && $this->page->context->contextlevel != CONTEXT_MODULE) {
return null;
}
// These areas have their own code to retrieve added plugin navigation nodes.
if ($activenode->key == 'coursehome' || $activenode->key == 'questionbank' || $activenode->key == 'coursereports') {
return null;
}
$menunode = $this->page->settingsnav->find($activenode->key, null);
if (!$menunode instanceof navigation_node) {
return null;
}
// Loop through all children and try and find a match to the current url.
$matchednode = $this->nodes_match_current_url($menunode);
if (is_null($matchednode)) {
return null;
}
if (!isset($menunode) || !$menunode->has_children()) {
return null;
}
$selectdata = $this->get_menu_array($menunode);
$urlselect = new url_select($selectdata, $matchednode->action->out(), null);
$urlselect->set_label(get_string('browsesettingindex', 'course'), ['class' => 'sr_only']);
return $urlselect;
}
/**

View File

@ -131,7 +131,6 @@ abstract class view extends navigation_node {
// If node is one of the new views then set the active node to the child.
if (!$node instanceof view) {
$node->make_active();
$child->make_inactive();
$result = $node;
} else {
$child->make_active();

View File

@ -4561,6 +4561,12 @@ class settings_navigation extends navigation_node {
badges_add_course_navigation($coursenode, $course);
}
// Import data from other courses.
if ($adminoptions->import) {
$url = new moodle_url('/backup/import.php', array('id' => $course->id));
$coursenode->add(get_string('import'), $url, self::TYPE_SETTING, null, 'import', new pix_icon('i/import', ''));
}
// Backup this course
if ($adminoptions->backup) {
$url = new moodle_url('/backup/backup.php', array('id'=>$course->id));
@ -4573,12 +4579,6 @@ class settings_navigation extends navigation_node {
$coursenode->add(get_string('restore'), $url, self::TYPE_SETTING, null, 'restore', new pix_icon('i/restore', ''));
}
// Import data from other courses
if ($adminoptions->import) {
$url = new moodle_url('/backup/import.php', array('id'=>$course->id));
$coursenode->add(get_string('import'), $url, self::TYPE_SETTING, null, 'import', new pix_icon('i/import', ''));
}
// Copy this course.
if ($adminoptions->copy) {
$url = new moodle_url('/backup/copy.php', array('id' => $course->id));

View File

@ -148,4 +148,43 @@ class behat_deprecated extends behat_base {
$this->execute("behat_general::i_click_on", array($xpath, "xpath_element"));
$this->execute("behat_general::wait_until_the_page_is_ready");
}
/**
* Adds the specified enrolment method to the current course filling the form with the provided data.
*
* @Given /^I add "(?P<enrolment_method_name_string>(?:[^"]|\\")*)" enrolment method with:$/
* @param string $enrolmethod
* @param TableNode $table
*
* @deprecated since 4.0 MDL-72090. We now need the course to enrol in. Please use i_add_enrolment_method_for_with()
* @todo MDL-71733 This will be deleted in Moodle 4.4.
*/
public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {
$this->deprecated_message(['i_add_enrolment_method_for_with']);
// Navigate to enrolment method page.
$parentnodes = get_string('users', 'admin');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
array($parentnodes .' > '. get_string('type_enrol_plural', 'plugin'))
);
// Select enrolment method.
$this->execute('behat_forms::i_select_from_the_singleselect',
array($this->escape($enrolmethod), get_string('addinstance', 'enrol'))
);
// Wait again, for page to reloaded.
$this->execute('behat_general::i_wait_to_be_redirected');
// Set form fields.
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $table);
// Ensure we get button in focus, before pressing button.
if ($this->running_javascript()) {
$this->execute('behat_general::i_press_named_key', ['', 'tab']);
}
// Save changes.
$this->execute("behat_forms::press_button", get_string('addinstance', 'enrol'));
}
}

View File

@ -736,11 +736,20 @@ class behat_navigation extends behat_base {
* Recognised page names are:
* | Page type | Identifier meaning | description |
* | Category | category idnumber | List of courses in that category. |
* | Course | course shortname | Main course home pag |
* | Course | course shortname | Main course home page |
* | Activity | activity idnumber | Start page for that activity |
* | Activity editing | activity idnumber | Edit settings page for that activity |
* | [modname] Activity | activity name or idnumber | Start page for that activity |
* | [modname] Activity editing | activity name or idnumber | Edit settings page for that activity |
* | Backup | course shortname | Course to backup |
* | Import | course shortname | Course import from |
* | Restore | course shortname | Course to restore from |
* | Reset | course shortname | Course to reset |
* | Course copy | course shortname | Course to copy |
* | Groups | course shortname | Groups page for the course |
* | Permissions | course shortname | Permissions page for the course |
* | Enrolment methods | course shortname | Enrolment methods for the course |
* | Enrolled users | course shortname | The main participants page |
*
* Examples:
*
@ -787,6 +796,71 @@ class behat_navigation extends behat_base {
return new moodle_url('/course/modedit.php', [
'update' => $cm->id,
]);
case 'backup':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/backup/backup.php', ['id' => $courseid]);
case 'import':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/backup/import.php', ['id' => $courseid]);
case 'restore':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
$context = context_course::instance($courseid);
return new moodle_url('/backup/restorefile.php', ['contextid' => $context->id]);
case 'reset':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/course/reset.php', ['id' => $courseid]);
case 'course copy':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/backup/copy.php', ['id' => $courseid]);
case 'groups':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/group/index.php', ['id' => $courseid]);
case 'permissions':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
$context = context_course::instance($courseid);
return new moodle_url('/admin/roles/permissions.php', ['contextid' => $context->id]);
case 'enrolment methods':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/enrol/instances.php', ['id' => $courseid]);
case 'enrolled users':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/user/index.php', ['id' => $courseid]);
}
$parts = explode(' ', $type);

View File

@ -81,7 +81,12 @@ class behat_permissions extends behat_base {
);
if (!$this->running_javascript()) {
$this->execute("behat_general::i_click_on_in_the", [get_string('go'), 'button', "div.advancedoverride", 'css_element']);
$xpath = "//div[@class='advancedoverride']/div/form/noscript";
$this->execute("behat_general::i_click_on_in_the", [
get_string('go'), 'button',
$this->escape($xpath),
'xpath_element']
);
}
$this->execute("behat_permissions::i_fill_the_capabilities_form_with_the_following_permissions", $table);

View File

@ -16,8 +16,7 @@ Feature: Override permissions on a context
| teacher1 | C1 | editingteacher |
Scenario: Default system capabilities modification
Given I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Users > Permissions" in current page administration
Given I am on the "C1" "permissions" page logged in as "admin"
When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row"
And I press "Student"
Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student"

View File

@ -18,6 +18,7 @@ namespace core\navigation\views;
use navigation_node;
use ReflectionMethod;
use moodle_url;
/**
* Class core_secondary_testcase
@ -738,6 +739,8 @@ class secondary_test extends \advanced_testcase {
*/
public function test_get_overflow_menu_data(string $selectedurl, bool $expectednull, bool $emptynode = false) {
global $PAGE;
$this->resetAfterTest();
// Custom nodes - mimicing nodes added via 3rd party plugins.
$structure = [
'parentnode1' => [
@ -752,6 +755,11 @@ class secondary_test extends \advanced_testcase {
],
'parentnode2' => "/view/module.php"
];
$course = $this->getDataGenerator()->create_course();
$context = \context_course::instance($course->id);
$PAGE->set_context($context);
$PAGE->set_url($selectedurl);
navigation_node::override_active_url(new \moodle_url($selectedurl));
$node = $this->generate_node_tree_construct($structure, 'primarynode');
@ -815,4 +823,95 @@ class secondary_test extends \advanced_testcase {
],
];
}
/**
* Test the course administration settings return an overflow menu.
*
* @dataProvider test_get_overflow_menu_data_course_admin_provider
* @param string $url Url of the page we are testing.
* @param string $contextidentifier id or contextid or something similar.
* @param bool $expected The expected return. True to return the overflow menu otherwise false for nothing.
*/
public function test_get_overflow_menu_data_course_admin(string $url, string $contextidentifier, bool $expected): void {
global $PAGE;
$this->resetAfterTest();
$this->setAdminUser();
$pagecourse = $this->getDataGenerator()->create_course();
$contextrecord = \context_course::instance($pagecourse->id, MUST_EXIST);
$id = ($contextidentifier == 'contextid') ? $contextrecord->id : $pagecourse->id;
$pageurl = new \moodle_url($url, [$contextidentifier => $id]);
$PAGE->set_url($pageurl);
navigation_node::override_active_url($pageurl);
$PAGE->set_course($pagecourse);
$PAGE->set_context($contextrecord);
$node = new secondary($PAGE);
$node->initialise();
$result = $node->get_overflow_menu_data();
if ($expected) {
$this->assertInstanceOf('url_select', $result);
$this->assertTrue($pageurl->compare($result->selected));
} else {
$this->assertNull($result);
}
}
/**
* Data provider for the other half of the method thing
*
* @return array Provider information.
*/
public function test_get_overflow_menu_data_course_admin_provider(): array {
return [
"Backup page returns overflow" => [
'/backup/backup.php',
'id',
true
],
"Restore course page returns overflow" => [
'/backup/restorefile.php',
'contextid',
true
],
"Import course page returns overflow" => [
'/backup/import.php',
'id',
true
],
"Course copy page returns overflow" => [
'/backup/copy.php',
'id',
true
],
"Course reset page returns overflow" => [
'/course/reset.php',
'id',
true
],
// The following pages should not return the overflow menu.
"Course page returns nothing" => [
'/course/view.php',
'id',
false
],
"Question bank should return nothing" => [
'/question/edit.php',
'courseid',
false
],
"Reports should return nothing" => [
'/report/log/index.php',
'id',
false
],
"Participants page should return nothing" => [
'/user/index.php',
'id',
false
]
];
}
}

View File

@ -92,8 +92,7 @@ Feature: Create conversations for course's groups
Scenario: Check group conversation members are synced when a new group member is added
Given I log in as "teacher1"
Then I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
Then I am on the "Course 1" "groups" page
And I add "Student 4 (student4@example.com)" user to "Group 1" group members
And I add "Student 4 (student4@example.com)" user to "Group 2" group members
And I open messaging

View File

@ -46,8 +46,7 @@ Feature: Assign reset
And I am on the "Test assignment name" Activity page logged in as teacher1
And I follow "View all submissions"
And I should see "Submitted for grading"
And I am on "Course 1" course homepage
When I navigate to "Reset" in current page administration
When I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all submissions | 1 |
And I press "Reset course"
@ -72,8 +71,7 @@ Feature: Assign reset
| duedate[minute] | 00 |
And I press "Save"
And I should see "Sam1 Student1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
When I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all user overrides | 1 |
And I press "Reset course"
@ -98,8 +96,7 @@ Feature: Assign reset
| duedate[minute] | 00 |
And I press "Save"
And I should see "Group 1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all group overrides | 1 |
And I press "Reset course"
@ -120,8 +117,7 @@ Feature: Assign reset
And I select "Reveal student identities" from the "Grading action" singleselect
And I press "Continue"
And I should see "Sam1 Student1"
And I am on "Course 1" course homepage
When I navigate to "Reset" in current page administration
When I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all submissions | 1 |
And I press "Reset course"

View File

@ -14,8 +14,7 @@ Feature: Assignment with no calendar capabilites
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I am on the "C1" Course page logged in as admin
And I navigate to "Users > Permissions" in current page administration
And I am on the "C1" "permissions" page logged in as admin
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -38,8 +38,7 @@ Feature: Chat reset
| chattime[hour] | 12 |
| chattime[minute] | 00 |
And I press "Save and display"
And I am on "Course 1" course homepage
When I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| reset_start_date[enabled] | 1 |
| reset_start_date[day] | 1 |

View File

@ -22,8 +22,7 @@ Feature: Chat with no calendar capabilites
| intro | Test chat description |
| section | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -15,8 +15,7 @@ Feature: Choice with no calendar capabilites
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -15,8 +15,7 @@ Feature: Database with no calendar capabilites
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -15,8 +15,7 @@ Feature: Feedback with no calendar capabilites
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -53,8 +53,7 @@ Feature: Lesson reset
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
And I navigate to "Reports" in current page administration
And I should see "Sam1 Student1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all lesson attempts | 1 |
And I press "Reset course"
@ -74,8 +73,7 @@ Feature: Lesson reset
| Re-takes allowed | 1 |
And I press "Save"
And I should see "Sam1 Student1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all user overrides | 1 |
And I press "Reset course"
@ -93,8 +91,7 @@ Feature: Lesson reset
| Re-takes allowed | 1 |
And I press "Save"
And I should see "Group 1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all group overrides | 1 |
And I press "Reset course"

View File

@ -22,8 +22,7 @@ Feature: Lesson with no calendar capabilites
| intro | Test lesson description |
| section | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -66,8 +66,7 @@ Feature: Backup and restore of quizzes
@javascript @_file_upload
Scenario: Restore a Moodle 2.8 quiz backup
When I am on "Course 1" course homepage
And I navigate to "Restore" in current page administration
When I am on the "Course 1" "restore" page
And I press "Manage backup files"
And I upload "mod/quiz/tests/fixtures/moodle_28_quiz.mbz" file to "Files" filemanager
And I press "Save changes"

View File

@ -35,8 +35,7 @@ Feature: Quiz with no calendar capabilites
| id_timeclose_month | 2 |
| id_timeclose_year | 2017 |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -38,8 +38,7 @@ Feature: Quiz reset
Scenario: Use course reset to clear all attempt data
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all quiz attempts | 1 |
And I press "Reset course"
@ -52,8 +51,7 @@ Feature: Quiz reset
| quiz | user | attempts |
| Test quiz name | student1 | 2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the field "Delete all user overrides" to "1"
And I press "Reset course"
And I press "Continue"
@ -65,8 +63,7 @@ Feature: Quiz reset
| quiz | group | attempts |
| Test quiz name | G1 | 2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
And I set the following fields to these values:
| Delete all group overrides | 1 |
And I press "Reset course"

View File

@ -15,8 +15,7 @@ Feature: Scorm with no calendar capabilites
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |

View File

@ -39,8 +39,7 @@ Feature: Teachers can reset wiki pages, tags and files
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
And I should see "empty.txt"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
Scenario: Reset page, tags and files
Given I set the following fields to these values:

View File

@ -54,9 +54,14 @@ $blockshtml = $OUTPUT->blocks('side-pre');
$hasblocks = strpos($blockshtml, 'data-block=') !== false;
$secondarynavigation = false;
$overflow = '';
if ($PAGE->has_secondary_navigation()) {
$moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs');
$secondarynavigation = $moremenu->export_for_template($OUTPUT);
$overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
if (!is_null($overflowdata)) {
$overflow = $overflowdata->export_for_template($OUTPUT);
}
}
$primary = new core\navigation\output\primary($PAGE);
@ -79,6 +84,7 @@ $templatecontext = [
'langmenu' => $primarymenu['lang'],
'regionmainsettingsmenu' => $regionmainsettingsmenu,
'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
'overflow' => $overflow
];
$nav = $PAGE->flatnav;
$templatecontext['firstcollectionlabel'] = $nav->get_collectionlabel();

View File

@ -79,9 +79,14 @@ $bodyattributes = $OUTPUT->body_attributes($extraclasses);
$forceblockdraweropen = $OUTPUT->firstview_fakeblocks();
$secondarynavigation = false;
$overflow = '';
if ($PAGE->has_secondary_navigation()) {
$moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs');
$secondarynavigation = $moremenu->export_for_template($OUTPUT);
$overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
if (!is_null($overflowdata)) {
$overflow = $overflowdata->export_for_template($OUTPUT);
}
}
$primary = new core\navigation\output\primary($PAGE);
@ -108,6 +113,7 @@ $templatecontext = [
'forceblockdraweropen' => $forceblockdraweropen,
'regionmainsettingsmenu' => $regionmainsettingsmenu,
'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
'overflow' => $overflow
];
$nav = $PAGE->flatnav;

View File

@ -79,6 +79,9 @@
<div class="region_main_settings_menu_proxy"></div>
{{/hasregionmainsettingsmenu}}
{{{ output.course_content_header }}}
{{#overflow}}
{{> core/url_select}}
{{/overflow}}
{{{ output.main_content }}}
{{{ output.activity_navigation }}}
{{{ output.course_content_footer }}}

View File

@ -0,0 +1,42 @@
@javascript @theme_boost
Feature: Course administration navigation
As a teacher
I can navigate to course administration pages
Background:
Given the following "courses" exist:
| fullname | shortname | newsitems |
| Course 1 | C1 | 5 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: A Teacher can navigate to the course Import page.
Given I log in as "teacher1"
When I am on "Course 1" course homepage
And I navigate to "Course administration" in current page administration
Then I should see "Find a course to import data from:"
Scenario Outline: A Teacher can navigate to other course administration pages.
Given I log in as "teacher1"
When I am on "Course 1" course homepage
And I navigate to "Course administration" in current page administration
And I select "<adminpage>" from the "jump" singleselect
Then I should see "<title>"
Examples:
| adminpage | title |
| Backup | Backup settings |
| Restore | Import a backup file |
| Import | Find a course to import data from: |
| Reset | Reset course |
Scenario: An Administrator can view the course copy page.
Given I log in as "admin"
When I am on "Course 1" course homepage
And I navigate to "Course administration" in current page administration
And I select "Copy course" from the "jump" singleselect
Then I should see "This course will be duplicated and put into the selected course category"

View File

@ -28,7 +28,7 @@ Feature: Page administration menu
And I should see "Updating: Choice"
And I navigate to course participants
And I should see the page administration menu
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "Enrolment methods" page
And I should see "Enrolment methods"
And I log out

View File

@ -82,8 +82,7 @@ Feature: Edit user enrolment
And I log in as "admin"
And I navigate to "Plugins > Enrolments > Manage enrol plugins" in site administration
And I click on "Enable" "link" in the "Course meta link" "table_row"
And I am on "Course 1" course homepage
And I add "Course meta link" enrolment method with:
And I add "Course meta link" enrolment method in "Course 1" with:
| Link course | C2 |
And I log out
And I log in as "teacher1"

View File

@ -117,8 +117,7 @@ Feature: Access to full profiles of users
And I should see "The details of this user are not available to you"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group 1 |

View File

@ -276,9 +276,7 @@ Feature: View course participants
Scenario: Check status after disabling manual enrolment
Given I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to course participants
When I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I click on "Disable" "link" in the "Manual enrolments" "table_row"
Then I navigate to course participants
And I should see "Not current" in the "student0x" "table_row"