+{{/displaygroupingselector}}
diff --git a/blocks/myoverview/tests/behat/block_myoverview_adminsettings.feature b/blocks/myoverview/tests/behat/block_myoverview_adminsettings.feature
new file mode 100644
index 00000000000..5e692562ca0
--- /dev/null
+++ b/blocks/myoverview/tests/behat/block_myoverview_adminsettings.feature
@@ -0,0 +1,226 @@
+@block @block_myoverview @javascript
+Feature: The my overview block allows admins to easily configure the students' course list
+ In order to adapt the my overview block to my users' needs
+ As an admin
+ I can configure the appearance of the my overview block
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email | idnumber |
+ | student1 | Student | X | student1@example.com | S1 |
+ And the following "categories" exist:
+ | name | category | idnumber |
+ | Category 1 | 0 | CAT1 |
+ And the following "courses" exist:
+ | fullname | shortname | category | startdate | enddate |
+ | Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## |
+ | Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## |
+ | Course 3 | C3 | 0 | ##yesterday## | ##tomorrow## |
+ | Course 4 | C4 | CAT1 | ##yesterday## | ##tomorrow## |
+ | Course 5 | C5 | 0 | ##first day of next month## | ##last day of next month## |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | student1 | C1 | student |
+ | student1 | C2 | student |
+ | student1 | C3 | student |
+ | student1 | C4 | student |
+ | student1 | C5 | student |
+
+ Scenario: Enable 'All' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "All" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ # We have to check for the data attribute instead of the list element text as we would get false positives from the "All (except hidden)" element otherwise
+ Then "[data-value='allincludinghidden']" "css_element" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'All' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "All" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ # We have to check for the data attribute instead of the list element text as we would get false negatives "All (except hidden)" element otherwise
+ Then "[data-value='allincludinghidden']" "css_element" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Enable 'All (except hidden)' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "All (except hidden)" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "All (except hidden)" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'All (except hidden)' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "All (except hidden)" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ # 'All (except hidden)' option has been disabled, so the button is falling back to the 'In progress' option which is the next enabled option.
+ And I click on "In progress" "button" in the "Course overview" "block"
+ Then "All (except hidden)" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Enable 'In progress' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "In progress" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "In progress" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'In progress' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "In progress" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "In progress" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Enable 'Future' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Future" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Future" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'Future' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Future" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Future" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Enable 'Past' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Past" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Past" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'Past' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Past" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Past" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Enable 'Starred' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Starred" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Starred" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'Starred' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Starred" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Starred" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Enable 'Hidden' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Hidden" to "1"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Hidden" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable 'Hidden' course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "Hidden" to "0"
+ And I press "Save"
+ And I log out
+ Then I log in as "student1"
+ And I click on "All (except hidden)" "button" in the "Course overview" "block"
+ Then "Hidden" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
+ And I log out
+
+ Scenario: Disable all course filter options
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "All" to "0"
+ And I set the field "All (except hidden)" to "0"
+ And I set the field "In progress" to "0"
+ And I set the field "Future" to "0"
+ And I set the field "Past" to "0"
+ And I set the field "Starred" to "0"
+ And I set the field "Hidden" to "0"
+ And I press "Save"
+ And I log out
+ And I log in as "student1"
+ Then "button#groupingdropdown" "css_element" should not exist in the ".block_myoverview" "css_element"
+ And I should see "Course 1" in the "Course overview" "block"
+ And I should see "Course 2" in the "Course overview" "block"
+ And I should see "Course 3" in the "Course overview" "block"
+ And I should see "Course 4" in the "Course overview" "block"
+ And I should see "Course 5" in the "Course overview" "block"
+ And I log out
+
+ Scenario: Disable all but one course filter option
+ Given I log in as "admin"
+ And I navigate to "Plugins > Blocks > Course overview" in site administration
+ And I set the field "All" to "0"
+ And I set the field "All (except hidden)" to "0"
+ And I set the field "In progress" to "1"
+ And I set the field "Future" to "0"
+ And I set the field "Past" to "0"
+ And I set the field "Starred" to "0"
+ And I set the field "Hidden" to "0"
+ And I press "Save"
+ And I log out
+ And I log in as "student1"
+ Then "button#groupingdropdown" "css_element" should not exist in the ".block_myoverview" "css_element"
+ And I should see "Course 2" in the "Course overview" "block"
+ And I should see "Course 3" in the "Course overview" "block"
+ And I should see "Course 4" in the "Course overview" "block"
+ And I should not see "Course 1" in the "Course overview" "block"
+ And I should not see "Course 5" in the "Course overview" "block"
+ And I log out
diff --git a/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature b/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature
index a56b065347f..9101de8160d 100644
--- a/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature
+++ b/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature
@@ -71,7 +71,10 @@ Feature: The my overview block allows users to easily access their courses
And I log out
Scenario: View all (including hidden) courses
- Given I log in as "student1"
+ Given the following config values are set as admin:
+ | config | value | plugin |
+ | displaygroupingallincludinghidden | 1 | block_myoverview |
+ And I log in as "student1"
And I click on "All (except hidden)" "button" in the "Course overview" "block"
# We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except hidden)" element instead
When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
@@ -231,7 +234,10 @@ Feature: The my overview block allows users to easily access their courses
And I log out
Scenario: View all (including hidden) courses with hide persistent functionality
- Given I log in as "student1"
+ Given the following config values are set as admin:
+ | config | value | plugin |
+ | displaygroupingallincludinghidden | 1 | block_myoverview |
+ And I log in as "student1"
And I click on "All (except hidden)" "button" in the "Course overview" "block"
# We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except hidden)" element instead
When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
diff --git a/blocks/myoverview/tests/behat/block_myoverview_hidden.feature b/blocks/myoverview/tests/behat/block_myoverview_hidden.feature
index a4d19f739ed..e494c75e720 100644
--- a/blocks/myoverview/tests/behat/block_myoverview_hidden.feature
+++ b/blocks/myoverview/tests/behat/block_myoverview_hidden.feature
@@ -100,7 +100,10 @@ Feature: The my overview block allows users to hide their courses
And I log out
Scenario: Test a course is never hidden with "All (including hidden)" courses
- Given I log in as "student1"
+ Given the following config values are set as admin:
+ | config | value | plugin |
+ | displaygroupingallincludinghidden | 1 | block_myoverview |
+ And I log in as "student1"
And I click on "All (except hidden)" "button" in the "Course overview" "block"
# We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except hidden)" element instead
When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
diff --git a/blocks/myoverview/version.php b/blocks/myoverview/version.php
index 4c93e24f4e4..6b5751d8217 100644
--- a/blocks/myoverview/version.php
+++ b/blocks/myoverview/version.php
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2019070400; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2019070401; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2019051100; // Requires this Moodle version.
$plugin->component = 'block_myoverview'; // Full name of the plugin (used for diagnostics).