From 826553d9eb98df238d7c230c1ac4f44dc0774710 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 12 Jul 2023 17:57:31 +0100 Subject: [PATCH 1/2] MDL-78587 behat: page instance resolvers for group overview/groupings. --- lib/tests/behat/behat_navigation.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index e88374efcfa..9dd3b0e74c9 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -754,6 +754,8 @@ class behat_navigation extends behat_base { * | Reset | course shortname | Course to reset | * | Course copy | course shortname | Course to copy | * | Groups | course shortname | Groups page for the course | + * | Groups overview | course shortname | Groups overview page for the course | + * | Groupings | course shortname | Groupings 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 | @@ -853,6 +855,20 @@ class behat_navigation extends behat_base { $identifier . '" does not exist'); } return new moodle_url('/group/index.php', ['id' => $courseid]); + case 'groups overview': + $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/overview.php', ['id' => $courseid]); + case 'groupings': + $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/groupings.php', ['id' => $courseid]); case 'permissions': $courseid = $this->get_course_id($identifier); if (!$courseid) { From 1125af7857fe91acb35383f97e519871a1acddc6 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 27 Jun 2023 09:14:29 +0100 Subject: [PATCH 2/2] MDL-78587 course: use tertiary nav selector on participant pages. --- admin/tests/behat/assign.feature | 4 +-- admin/tests/behat/check.feature | 4 +-- .../behat/tests/behat/data_generators.feature | 2 +- .../tests/behat/basic_functionality.feature | 3 +- .../tests/behat/upload_users.feature | 4 +-- .../util/ui/tests/behat/import_groups.feature | 4 +-- .../templates/participants_actionbar.mustache | 31 ++++++++--------- .../tests/behat/category_management.feature | 3 +- .../behat/course_category_breadcrumbs.feature | 4 +-- enrol/cohort/tests/behat/enrolcohorts.feature | 4 +-- enrol/instances.php | 1 - enrol/renameroles.php | 1 - group/groupings.php | 3 +- group/index.php | 1 - group/overview.php | 4 +-- group/tests/behat/auto_creation.feature | 2 +- group/tests/behat/bulk_messaging.feature | 18 +++------- group/tests/behat/create_groups.feature | 2 +- group/tests/behat/custom_fields.feature | 4 +-- group/tests/behat/delete_groups.feature | 34 ++++++------------- group/tests/behat/groups_import.feature | 2 +- group/tests/behat/id_uniqueness.feature | 7 ++-- group/tests/behat/overview.feature | 5 +-- group/tests/behat/update_groups.feature | 8 ++--- .../output/participants_action_bar.php | 14 ++++---- .../behat/category_role_assignment.feature | 4 +-- user/index.php | 2 -- 27 files changed, 72 insertions(+), 103 deletions(-) diff --git a/admin/tests/behat/assign.feature b/admin/tests/behat/assign.feature index 300ae378eec..8aa107c5d6b 100644 --- a/admin/tests/behat/assign.feature +++ b/admin/tests/behat/assign.feature @@ -56,7 +56,7 @@ Feature: Staff can assign user roles Scenario: Enrol at activity level using custom field search When I am on the "page1" "Activity" page logged in as "admin" And I navigate to "Permissions" in current page administration - And I select "Locally assigned roles" from the "jump" singleselect + And I set the field "Participants tertiary navigation" to "Locally assigned roles" And I follow "Teacher" And I set the field "addselect_searchtext" to "Kermit" # The Behat 'I should see' step doesn't work for optgroup labels. @@ -72,7 +72,7 @@ Feature: Staff can assign user roles | user1 | editingteacher | Activity module | page1 | When I am on the "page1" "Activity" page logged in as "admin" And I navigate to "Permissions" in current page administration - And I select "Locally assigned roles" from the "jump" singleselect + And I set the field "Participants tertiary navigation" to "Locally assigned roles" And I follow "Teacher" And I set the field "removeselect_searchtext" to "Kermit" # The Behat 'I should see' step doesn't work for optgroup labels. diff --git a/admin/tests/behat/check.feature b/admin/tests/behat/check.feature index 4e3050c1da5..1e5aae5e3b3 100644 --- a/admin/tests/behat/check.feature +++ b/admin/tests/behat/check.feature @@ -28,7 +28,7 @@ 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" "permissions" page logged in as "admin" - And I select "Check permissions" from the "jump" singleselect + And I set the field "Participants tertiary navigation" to "Check permissions" 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 @@ -42,7 +42,7 @@ 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" "permissions" page logged in as "admin" - And I select "Check permissions" from the "jump" singleselect + And I set the field "Participants tertiary navigation" to "Check permissions" 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 diff --git a/admin/tool/behat/tests/behat/data_generators.feature b/admin/tool/behat/tests/behat/data_generators.feature index 79046bfd763..fb8933f4281 100644 --- a/admin/tool/behat/tests/behat/data_generators.feature +++ b/admin/tool/behat/tests/behat/data_generators.feature @@ -58,7 +58,7 @@ Feature: Set up contextual data for tests 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 + And I set the field "Participants tertiary navigation" to "Groupings" And I should see "Grouping 1" And I should see "Grouping 2" diff --git a/admin/tool/recyclebin/tests/behat/basic_functionality.feature b/admin/tool/recyclebin/tests/behat/basic_functionality.feature index bddc912874b..11f462316d0 100644 --- a/admin/tool/recyclebin/tests/behat/basic_functionality.feature +++ b/admin/tool/recyclebin/tests/behat/basic_functionality.feature @@ -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 the "Course 2" "groups" page - And I select "Overview" from the "jump" singleselect + And I am on the "Course 2" "groups overview" page And "Student 1" "text" should exist in the "Group A" "table_row" And "Student 2" "text" should exist in the "Group A" "table_row" And "Student 2" "text" should exist in the "Group B" "table_row" diff --git a/admin/tool/uploaduser/tests/behat/upload_users.feature b/admin/tool/uploaduser/tests/behat/upload_users.feature index 18b00b8f6c8..d8d187c2a6e 100644 --- a/admin/tool/uploaduser/tests/behat/upload_users.feature +++ b/admin/tool/uploaduser/tests/behat/upload_users.feature @@ -240,7 +240,7 @@ Feature: Upload users And I am on site homepage And I navigate to "Courses > Manage courses and categories" in site administration And I click on "permissions" action for "MGMT" in management category listing - And I select "Assign roles" from the "jump" singleselect + And I set the field "Participants tertiary navigation" to "Assign roles" And I should see "Manager" And I should see "Tom Jones" And I should see "Trent Reznor" @@ -249,7 +249,7 @@ Feature: Upload users And I am on site homepage And I navigate to "Courses > Manage courses and categories" in site administration And I click on "permissions" action for "Film" in management category listing - And I select "Assign roles" from the "jump" singleselect + And I set the field "Participants tertiary navigation" to "Assign roles" And I should see "Course creator" And I should see "Federico Fellini" diff --git a/backup/util/ui/tests/behat/import_groups.feature b/backup/util/ui/tests/behat/import_groups.feature index 722931ffa3d..78ed1c4faec 100644 --- a/backup/util/ui/tests/behat/import_groups.feature +++ b/backup/util/ui/tests/behat/import_groups.feature @@ -33,7 +33,7 @@ Feature: Option to include groups and groupings when importing a course to anoth 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 + And I am on the "Course 2" "groupings" page And I should see "Grouping 1" And I should see "Grouping 2" @@ -43,6 +43,6 @@ Feature: Option to include groups and groupings when importing a course to anoth 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 + And I am on the "Course 2" "groupings" page And I should not see "Grouping 1" And I should not see "Grouping 2" diff --git a/course/templates/participants_actionbar.mustache b/course/templates/participants_actionbar.mustache index 8b265269fa8..8a3ef8e0b24 100644 --- a/course/templates/participants_actionbar.mustache +++ b/course/templates/participants_actionbar.mustache @@ -22,16 +22,9 @@ Example context (json): { - "urlselect" : { - "formid": "url_select_f61834256d7754158", - "classes": "urlselect", - "label": "", - "disabled": false, - "title":null, - "id":"url_select61834256d7754159", - "sesskey":"LWILINyZMH", - "action":"http:\/\/localhost\/stable_master\/course\/jumpto.php", - "showbutton":null, + "navigation" : { + "baseid": "select-menuf61834256d7754158", + "label": "Participant navigation", "options": [ { "name":"Enrolments", @@ -92,20 +85,26 @@ ] } ], - "labelattributes":[], - "helpicon":false, - "attributes":[] + "selectedoption":"Enrolled users", + "name":"participantsnavigation", + "value":"\/user\/index.php?id=4", + "labelattributes":[ + { + "name":"class", + "value":"sr-only" + } + ] }, "renderedcontent":"
<\/div>" } }}
- {{#urlselect}} + {{#navigation}} - {{/urlselect}} + {{/navigation}} {{#renderedcontent}}