diff --git a/blocks/badges/tests/behat/block_badges_dashboard.feature b/blocks/badges/tests/behat/block_badges_dashboard.feature index a5184f2cee4..3c7b6c34f61 100644 --- a/blocks/badges/tests/behat/block_badges_dashboard.feature +++ b/blocks/badges/tests/behat/block_badges_dashboard.feature @@ -14,6 +14,9 @@ Feature: Enable Block Badges on the dashboard and view awarded badges And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | badges | System | 1 | my-index | side-post | And I log in as "teacher1" And I am on "Course 1" course homepage # Issue badge 1 of 2 diff --git a/blocks/calendar_month/db/upgrade.php b/blocks/calendar_month/db/upgrade.php index 06543539d56..fbb1189309a 100644 --- a/blocks/calendar_month/db/upgrade.php +++ b/blocks/calendar_month/db/upgrade.php @@ -43,7 +43,7 @@ * @param object $block */ function xmldb_block_calendar_month_upgrade($oldversion, $block) { - global $CFG; + global $CFG, $DB; // Automatically generated Moodle v3.6.0 release upgrade line. // Put any upgrade step following this. @@ -57,5 +57,39 @@ function xmldb_block_calendar_month_upgrade($oldversion, $block) { // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2022030200) { + $context = context_system::instance(); + + // Begin looking for any and all customised /my pages. + $pageselect = 'name = :name and private = :private'; + $pageparams['name'] = '__default'; + $pageparams['private'] = 1; + $pages = $DB->get_recordset_select('my_pages', $pageselect, $pageparams); + foreach ($pages as $subpage) { + $blockinstance = $DB->get_record('block_instances', ['blockname' => 'calendar_month', + 'pagetypepattern' => 'my-index', 'subpagepattern' => $subpage->id]); + + if (!$blockinstance) { + // Insert the calendar month into the default index page. + $blockinstance = new stdClass; + $blockinstance->blockname = 'calendar_month'; + $blockinstance->parentcontextid = $context->id; + $blockinstance->showinsubcontexts = false; + $blockinstance->pagetypepattern = 'my-index'; + $blockinstance->subpagepattern = $subpage->id; + $blockinstance->defaultregion = 'content'; + $blockinstance->defaultweight = 0; + $blockinstance->timecreated = time(); + $blockinstance->timemodified = time(); + $DB->insert_record('block_instances', $blockinstance); + } else if ($blockinstance->defaultregion !== 'content') { + $blockinstance->defaultregion = 'content'; + $DB->update_record('block_instances', $blockinstance); + } + } + $pages->close(); + upgrade_block_savepoint(true, 2022030200, 'calendar_month', false); + } + return true; } diff --git a/blocks/calendar_month/version.php b/blocks/calendar_month/version.php index 0cba274eb4d..eb2e4d66c53 100644 --- a/blocks/calendar_month/version.php +++ b/blocks/calendar_month/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2022030200; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2021052500; // Requires this Moodle version. $plugin->component = 'block_calendar_month'; // Full name of the plugin (used for diagnostics) diff --git a/blocks/classes/external.php b/blocks/classes/external.php index 291138d101b..5f1458bcbe9 100644 --- a/blocks/classes/external.php +++ b/blocks/classes/external.php @@ -282,6 +282,34 @@ class core_block_external extends external_api { $returninvisible = has_capability('moodle/my:manageblocks', $context) ? true : false; $allblocks = self::get_all_current_page_blocks($returninvisible, $params['returncontents']); + // Temporary hack to be removed in 4.1. + // Return always the course overview block so old versions of the app can list the user courses. + if ($mypage == MY_PAGE_DEFAULT && core_useragent::is_moodle_app()) { + $myoverviewfound = false; + + foreach ($allblocks as $block) { + if ($block['name'] == 'myoverview' && $block['visible']) { + $myoverviewfound = true; + break; + } + } + + if (!$myoverviewfound) { + // Include a course overview fake block. + $allblocks[] = [ + 'instanceid' => 0, + 'name' => 'myoverview', + 'region' => 'forced', + 'positionid' => null, + 'collapsible' => true, + 'dockable' => false, + 'weight' => 0, + 'visible' => true, + ]; + } + } + // End of the hack to be removed in 4.1 see MDL-73670. + return array( 'blocks' => $allblocks, 'warnings' => $warnings diff --git a/blocks/myoverview/db/upgrade.php b/blocks/myoverview/db/upgrade.php index 68708747529..f141f032a2e 100644 --- a/blocks/myoverview/db/upgrade.php +++ b/blocks/myoverview/db/upgrade.php @@ -174,8 +174,8 @@ function xmldb_block_myoverview_upgrade($oldversion) { )->id; // See if this block already somehow exists, it should not but who knows. - if (!$DB->get_record('block_instances', ['blockname' => 'myoverview', - 'pagetypepattern' => 'my-index', 'subpagepattern' => $subpagepattern])) { + if (!$DB->record_exists('block_instances', ['blockname' => 'myoverview', + 'pagetypepattern' => 'my-index', 'subpagepattern' => $subpagepattern])) { $page = new moodle_page(); $systemcontext = context_system::instance(); $page->set_context($systemcontext); diff --git a/blocks/private_files/tests/behat/block_private_files_dashboard.feature b/blocks/private_files/tests/behat/block_private_files_dashboard.feature index 3b6eb5c2d40..1cb284a9517 100644 --- a/blocks/private_files/tests/behat/block_private_files_dashboard.feature +++ b/blocks/private_files/tests/behat/block_private_files_dashboard.feature @@ -8,6 +8,9 @@ Feature: The private files block allows users to store files privately in moodle Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "teacher1" And "Private files" "block" should exist And I should see "No files available" in the "Private files" "block" diff --git a/blocks/recentlyaccesseditems/db/upgrade.php b/blocks/recentlyaccesseditems/db/upgrade.php index 0a178d3c667..3c36d085246 100644 --- a/blocks/recentlyaccesseditems/db/upgrade.php +++ b/blocks/recentlyaccesseditems/db/upgrade.php @@ -75,5 +75,39 @@ function xmldb_block_recentlyaccesseditems_upgrade($oldversion, $block) { // Automatically generated Moodle v3.9.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2022030200) { + $context = context_system::instance(); + + // Begin looking for any and all customised /my pages. + $pageselect = 'name = :name and private = :private'; + $pageparams['name'] = '__default'; + $pageparams['private'] = 1; + $pages = $DB->get_recordset_select('my_pages', $pageselect, $pageparams); + foreach ($pages as $subpage) { + $blockinstance = $DB->get_record('block_instances', ['blockname' => 'recentlyaccesseditems', + 'pagetypepattern' => 'my-index', 'subpagepattern' => $subpage->id]); + + if (!$blockinstance) { + // Insert the recentlyaccesseditems into the default index page. + $blockinstance = new stdClass; + $blockinstance->blockname = 'recentlyaccesseditems'; + $blockinstance->parentcontextid = $context->id; + $blockinstance->showinsubcontexts = false; + $blockinstance->pagetypepattern = 'my-index'; + $blockinstance->subpagepattern = $subpage->id; + $blockinstance->defaultregion = 'side-post'; + $blockinstance->defaultweight = -10; + $blockinstance->timecreated = time(); + $blockinstance->timemodified = time(); + $DB->insert_record('block_instances', $blockinstance); + } else if ($blockinstance->defaultregion !== 'side-post') { + $blockinstance->defaultregion = 'side-post'; + $DB->update_record('block_instances', $blockinstance); + } + } + $pages->close(); + upgrade_block_savepoint(true, 2022030200, 'recentlyaccesseditems', false); + } + return true; } diff --git a/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature b/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature index 6af5d32c930..f4e9693f246 100644 --- a/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature +++ b/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature @@ -22,8 +22,6 @@ Feature: The recently accessed items block allows users to easily access their m | idnumber | Test forum name | | name | Test forum name | And I log in as "student1" - And I turn editing mode on - And I add the "Recently accessed items" block Scenario: User has not accessed any item Then I should see "No recent items" in the "Recently accessed items" "block" diff --git a/blocks/recentlyaccesseditems/version.php b/blocks/recentlyaccesseditems/version.php index 0760701fbf6..392ebd0b130 100644 --- a/blocks/recentlyaccesseditems/version.php +++ b/blocks/recentlyaccesseditems/version.php @@ -22,6 +22,6 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2022030200; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2021052500; // Requires this Moodle version. $plugin->component = 'block_recentlyaccesseditems'; // Full name of the plugin (used for diagnostics). diff --git a/blocks/tests/behat/configure_block_throughout_site.feature b/blocks/tests/behat/configure_block_throughout_site.feature index fd9c4d91027..449c41298e9 100644 --- a/blocks/tests/behat/configure_block_throughout_site.feature +++ b/blocks/tests/behat/configure_block_throughout_site.feature @@ -51,7 +51,7 @@ Feature: Add and configure blocks throughout the site Scenario: Blocks on the dashboard page can have roles assigned to them Given I log in as "manager1" When I turn editing mode on - Then I should see "Assign roles in Private files block" + Then I should see "Assign roles in Recently accessed items block" Scenario: Blocks on courses can have roles assigned to them Given I log in as "teacher1" diff --git a/blocks/timeline/db/upgrade.php b/blocks/timeline/db/upgrade.php new file mode 100644 index 00000000000..ac1512ef7ef --- /dev/null +++ b/blocks/timeline/db/upgrade.php @@ -0,0 +1,94 @@ +. + +/** + * This file keeps track of upgrades to the timeline block + * + * Sometimes, changes between versions involve alterations to database structures + * and other major things that may break installations. + * + * The upgrade function in this file will attempt to perform all the necessary + * actions to upgrade your older installation to the current version. + * + * If there's something it cannot do itself, it will tell you what you need to do. + * + * The commands in here will all be database-neutral, using the methods of + * database_manager class + * + * Please do not forget to use upgrade_set_timeout() + * before any action that may take longer time to finish. + * + * @package block_timeline + * @copyright 2022 Peter Dias + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Upgrade the timeline block + * @param int $oldversion + * @param object $block + */ +function xmldb_block_timeline_upgrade($oldversion, $block) { + global $CFG, $DB; + + // Automatically generated Moodle v3.6.0 release upgrade line. + // Put any upgrade step following this. + + // Automatically generated Moodle v3.7.0 release upgrade line. + // Put any upgrade step following this. + + // Automatically generated Moodle v3.8.0 release upgrade line. + // Put any upgrade step following this. + + // Automatically generated Moodle v3.9.0 release upgrade line. + // Put any upgrade step following this. + + if ($oldversion < 2022030200) { + $context = context_system::instance(); + + // Begin looking for any and all customised /my pages. + $pageselect = 'name = :name and private = :private'; + $pageparams['name'] = '__default'; + $pageparams['private'] = 1; + $pages = $DB->get_recordset_select('my_pages', $pageselect, $pageparams); + foreach ($pages as $subpage) { + $blockinstance = $DB->get_record('block_instances', ['blockname' => 'timeline', + 'pagetypepattern' => 'my-index', 'subpagepattern' => $subpage->id]); + + if (!$blockinstance) { + // Insert the timeline into the default index page. + $blockinstance = new stdClass; + $blockinstance->blockname = 'timeline'; + $blockinstance->parentcontextid = $context->id; + $blockinstance->showinsubcontexts = false; + $blockinstance->pagetypepattern = 'my-index'; + $blockinstance->subpagepattern = $subpage->id; + $blockinstance->defaultregion = 'content'; + $blockinstance->defaultweight = -10; + $blockinstance->timecreated = time(); + $blockinstance->timemodified = time(); + $DB->insert_record('block_instances', $blockinstance); + } else if ($blockinstance->defaultregion !== 'content') { + $blockinstance->defaultregion = 'content'; + $DB->update_record('block_instances', $blockinstance); + } + } + $pages->close(); + upgrade_block_savepoint(true, 2022030200, 'timeline', false); + } + + return true; +} diff --git a/blocks/timeline/version.php b/blocks/timeline/version.php index b088df0d0c4..6509cef84cb 100644 --- a/blocks/timeline/version.php +++ b/blocks/timeline/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2022030200; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2021052500; // Requires this Moodle version. $plugin->component = 'block_timeline'; // Full name of the plugin (used for diagnostics). diff --git a/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature b/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature index 06f95093f4e..fcc31a0e0da 100644 --- a/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature +++ b/contentbank/contenttype/h5p/tests/behat/admin_upload_content.feature @@ -5,7 +5,10 @@ Feature: H5P file upload to content bank for admins I need to be able to upload a new .h5p file to content bank Background: - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I follow "Manage private files..." And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager And I click on "Save changes" "button" diff --git a/contentbank/contenttype/h5p/tests/behat/teacher_upload_content.feature b/contentbank/contenttype/h5p/tests/behat/teacher_upload_content.feature index 243caac4dfd..02aeb6fdc28 100644 --- a/contentbank/contenttype/h5p/tests/behat/teacher_upload_content.feature +++ b/contentbank/contenttype/h5p/tests/behat/teacher_upload_content.feature @@ -19,6 +19,9 @@ Feature: H5P file upload to content bank for non admins | user | course | role | | teacher1 | C1 | editingteacher | | teacher2 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "teacher1" And I follow "Manage private files..." And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager diff --git a/contentbank/tests/behat/delete_content.feature b/contentbank/tests/behat/delete_content.feature index 07502f03e2d..2e639898f43 100644 --- a/contentbank/tests/behat/delete_content.feature +++ b/contentbank/tests/behat/delete_content.feature @@ -5,7 +5,10 @@ Feature: Delete H5P file from the content bank I need to be able to delete any H5P content from the content bank Background: - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I follow "Manage private files..." And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager And I click on "Save changes" "button" diff --git a/contentbank/tests/behat/edit_content.feature b/contentbank/tests/behat/edit_content.feature index 4cf7b4cf748..cf2e5853ce5 100644 --- a/contentbank/tests/behat/edit_content.feature +++ b/contentbank/tests/behat/edit_content.feature @@ -5,7 +5,10 @@ Feature: Content bank use editor feature I need to be able to access the edition options Background: - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I am on site homepage And I turn editing mode on And the following config values are set as admin: diff --git a/contentbank/tests/behat/events.feature b/contentbank/tests/behat/events.feature index b68361f231d..6757d9d2133 100644 --- a/contentbank/tests/behat/events.feature +++ b/contentbank/tests/behat/events.feature @@ -5,7 +5,10 @@ Feature: Confirm content bank events are triggered I need to be able to check triggered events Background: - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I navigate to "H5P > Manage H5P content types" in site administration And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element" diff --git a/contentbank/tests/behat/view_preferences.feature b/contentbank/tests/behat/view_preferences.feature index c88af5cde6f..ab92d455578 100644 --- a/contentbank/tests/behat/view_preferences.feature +++ b/contentbank/tests/behat/view_preferences.feature @@ -5,7 +5,10 @@ Feature: Store the content bank view preference I need to be able to store my view preference Background: - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I follow "Manage private files..." And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager And I upload "h5p/tests/fixtures/greeting-card-887.h5p" file to "Files" filemanager diff --git a/customfield/field/textarea/tests/behat/default_value.feature b/customfield/field/textarea/tests/behat/default_value.feature index 48389c120bb..113ace626fb 100644 --- a/customfield/field/textarea/tests/behat/default_value.feature +++ b/customfield/field/textarea/tests/behat/default_value.feature @@ -21,6 +21,9 @@ Feature: Default value for the textarea custom field can contain images And the following "custom field categories" exist: | name | component | area | itemid | | Category for test | core_course | course | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | # Upload an image into the private files. And I log in as "admin" And I follow "Manage private files" diff --git a/customfield/tests/behat/edit_fields_settings.feature b/customfield/tests/behat/edit_fields_settings.feature index de16eecfbfb..90c9a32219b 100644 --- a/customfield/tests/behat/edit_fields_settings.feature +++ b/customfield/tests/behat/edit_fields_settings.feature @@ -24,6 +24,9 @@ Feature: Teachers can edit course custom fields And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | Scenario: Display custom fields on course edit form When I log in as "teacher1" diff --git a/files/tests/behat/license_help_modal.feature b/files/tests/behat/license_help_modal.feature index adde7b3f0e4..3cdbeaf9501 100644 --- a/files/tests/behat/license_help_modal.feature +++ b/files/tests/behat/license_help_modal.feature @@ -4,6 +4,11 @@ Feature: View licence links As a user I need to be able to navigate to a page containing licence terms from the file manager + Background: + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + @javascript Scenario: Uploading a file displays licence list modal Given I log in as "admin" diff --git a/filter/displayh5p/tests/behat/h5p_filter.feature b/filter/displayh5p/tests/behat/h5p_filter.feature index fe3fd469dd8..a5757150bde 100644 --- a/filter/displayh5p/tests/behat/h5p_filter.feature +++ b/filter/displayh5p/tests/behat/h5p_filter.feature @@ -18,6 +18,9 @@ Feature: Render H5P content using filters | activity | name | intro | introformat | course | content | contentformat | idnumber | | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | | page | PageName2 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And the "displayh5p" filter is "on" And the following config values are set as admin: | allowedsources | https://moodle.h5p.com/content/[id]/embed | filter_displayh5p | diff --git a/filter/displayh5p/tests/behat/inline_editing_content.feature b/filter/displayh5p/tests/behat/inline_editing_content.feature index 24adfbb13b1..abf97c6c266 100644 --- a/filter/displayh5p/tests/behat/inline_editing_content.feature +++ b/filter/displayh5p/tests/behat/inline_editing_content.feature @@ -30,6 +30,9 @@ Feature: Inline editing H5P content anywhere | capability | permission | role | contextlevel | reference | | moodle/course:update | Allow | teacher | System | | | moodle/course:update | Allow | student | System | | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | @javascript @mod @mod_page Scenario: Edit H5P content from a page using link to private file diff --git a/lib/blocklib.php b/lib/blocklib.php index 81e84fe4c03..c0635d274dc 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -2686,8 +2686,7 @@ function blocks_add_default_system_blocks() { $page->blocks->add_blocks([ BLOCK_POS_RIGHT => [ - 'private_files', - 'badges', + 'recentlyaccesseditems', ], 'content' => [ 'timeline', diff --git a/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature b/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature index 886c0a4b4dc..b2a2ef41dd8 100644 --- a/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature +++ b/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature @@ -18,6 +18,9 @@ Feature: Add h5ps to Atto And the "displayh5p" filter is "on" And the following config values are set as admin: | allowedsources | https://moodle.h5p.com/content/[id] | filter_displayh5p | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | @javascript @external Scenario: Insert an embedded h5p diff --git a/lib/editor/atto/plugins/image/tests/behat/image.feature b/lib/editor/atto/plugins/image/tests/behat/image.feature index 22d06f33285..1f4537c8d78 100644 --- a/lib/editor/atto/plugins/image/tests/behat/image.feature +++ b/lib/editor/atto/plugins/image/tests/behat/image.feature @@ -4,7 +4,10 @@ Feature: Add images to Atto @javascript Scenario: Insert an image - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager And I click on "Save changes" "button" diff --git a/lib/editor/atto/plugins/link/tests/behat/link.feature b/lib/editor/atto/plugins/link/tests/behat/link.feature index 7beed050caa..c61ef69cd25 100644 --- a/lib/editor/atto/plugins/link/tests/behat/link.feature +++ b/lib/editor/atto/plugins/link/tests/behat/link.feature @@ -4,7 +4,10 @@ Feature: Add links to Atto @javascript Scenario: Insert a links - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager And I click on "Save changes" "button" diff --git a/lib/editor/atto/plugins/media/tests/behat/media.feature b/lib/editor/atto/plugins/media/tests/behat/media.feature index 28235290e73..3f9b6114eff 100644 --- a/lib/editor/atto/plugins/media/tests/behat/media.feature +++ b/lib/editor/atto/plugins/media/tests/behat/media.feature @@ -3,7 +3,10 @@ Feature: Add media to Atto To write rich text - I need to add media. Background: - Given I log in as "admin" + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" And I change window size to "large" And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager diff --git a/lib/editor/atto/tests/behat/autosave.feature b/lib/editor/atto/tests/behat/autosave.feature index c45a4b2f6e9..f8f08dfd4ed 100644 --- a/lib/editor/atto/tests/behat/autosave.feature +++ b/lib/editor/atto/tests/behat/autosave.feature @@ -14,6 +14,9 @@ Feature: Atto Autosave | user | course | role | | teacher1 | C1 | editingteacher | | teacher2 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "admin" And I navigate to "Plugins > Text editors > Atto HTML editor > Atto toolbar settings" in site administration And I set the field "Autosave frequency" to "3" diff --git a/mod/h5pactivity/tests/behat/contentbank_link.feature b/mod/h5pactivity/tests/behat/contentbank_link.feature index fe6eed6c179..95f07da5260 100644 --- a/mod/h5pactivity/tests/behat/contentbank_link.feature +++ b/mod/h5pactivity/tests/behat/contentbank_link.feature @@ -17,6 +17,9 @@ Feature: Content bank link in the activity settings form And the following "contentbank content" exist: | contextlevel | reference | contenttype | user | contentname | filepath | | Course | C1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | @javascript Scenario: The content bank link should go to the course Content bank diff --git a/mod/h5pactivity/tests/behat/inline_editing_content.feature b/mod/h5pactivity/tests/behat/inline_editing_content.feature index 60f71a43fb7..4ebd54e617a 100644 --- a/mod/h5pactivity/tests/behat/inline_editing_content.feature +++ b/mod/h5pactivity/tests/behat/inline_editing_content.feature @@ -21,6 +21,9 @@ Feature: Inline editing H5P content And the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | moodle/h5p:updatelibraries | Allow | editingteacher | System | | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | @javascript Scenario: Add H5P activity using link to content bank file diff --git a/mod/lesson/tests/behat/duplicate_lesson_page.feature b/mod/lesson/tests/behat/duplicate_lesson_page.feature index 56887dc1b7f..4990ae94a3e 100644 --- a/mod/lesson/tests/behat/duplicate_lesson_page.feature +++ b/mod/lesson/tests/behat/duplicate_lesson_page.feature @@ -20,6 +20,9 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page | course | C1 | | activity | lesson | | name | Test lesson name | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "teacher1" And I follow "Manage private files" And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager diff --git a/mod/lesson/tests/behat/questions_images.feature b/mod/lesson/tests/behat/questions_images.feature index ee45b3ec372..a236153454f 100644 --- a/mod/lesson/tests/behat/questions_images.feature +++ b/mod/lesson/tests/behat/questions_images.feature @@ -20,6 +20,9 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ | course | C1 | | activity | lesson | | name | Test lesson name | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "teacher1" And I follow "Manage private files" And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager diff --git a/mod/quiz/tests/behat/manually_mark_question.feature b/mod/quiz/tests/behat/manually_mark_question.feature index c1d96dd3744..a8b27930165 100644 --- a/mod/quiz/tests/behat/manually_mark_question.feature +++ b/mod/quiz/tests/behat/manually_mark_question.feature @@ -28,6 +28,9 @@ Feature: Teachers can override the grade for any question And quiz "Quiz 1" contains the following questions: | question | page | | TF1 | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student1" And I press "Attempt quiz" And I follow "Finish attempt ..." diff --git a/mod/workshop/tests/behat/embedded_images.feature b/mod/workshop/tests/behat/embedded_images.feature index 52b36926b89..d4595b97d58 100644 --- a/mod/workshop/tests/behat/embedded_images.feature +++ b/mod/workshop/tests/behat/embedded_images.feature @@ -14,6 +14,9 @@ Feature: Teachers can embed images into instructions and conclusion fields And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "teacher1" # Upload an image into the private files. And I follow "Manage private files" diff --git a/my/tests/behat/add_blocks.feature b/my/tests/behat/add_blocks.feature index 8cc75d38382..d00158675cf 100644 --- a/my/tests/behat/add_blocks.feature +++ b/my/tests/behat/add_blocks.feature @@ -23,6 +23,6 @@ Feature: Add blocks to dashboard page And I add the "Latest announcements" block And I turn editing mode off Then I should see "Latest announcements" in the "Latest announcements" "block" - And I should see "Latest badges" in the "Latest badges" "block" + And I should see "Timeline" in the "Timeline" "block" And I should see "Calendar" in the "Calendar" "block" And I should not see "Upcoming events" diff --git a/my/tests/behat/reset_all_pages.feature b/my/tests/behat/reset_all_pages.feature index 21fb4974986..9b909857b95 100644 --- a/my/tests/behat/reset_all_pages.feature +++ b/my/tests/behat/reset_all_pages.feature @@ -45,8 +45,8 @@ Feature: Reset all personalised pages to default And I navigate to "Appearance > Default Dashboard page" in site administration And I turn editing mode on And I add the "Latest announcements" block - And I open the "Latest badges" blocks action menu - And I follow "Delete Latest badges block" + And I open the "Timeline" blocks action menu + And I follow "Delete Timeline block" And I press "Yes" And I turn editing mode off And I log out @@ -54,13 +54,13 @@ Feature: Reset all personalised pages to default And I log in as "student1" And I follow "Dashboard" And I should not see "Latest announcements" - And I should see "Latest badges" + And I should see "Timeline" And I log out And I log in as "student3" And I follow "Dashboard" And I should not see "Latest announcements" - And I should see "Latest badges" + And I should see "Timeline" And I log out And I log in as "admin" @@ -73,13 +73,13 @@ Feature: Reset all personalised pages to default And I follow "Dashboard" Then I should see "Latest announcements" And I should not see "Comments" - And I should not see "Latest badges" + And I should not see "Timeline" And I log out And I log in as "student3" And I follow "Dashboard" And I should see "Latest announcements" - And I should not see "Latest badges" + And I should not see "Timeline" And I log out # Check that this did not affect the customised profiles. diff --git a/my/tests/behat/reset_page.feature b/my/tests/behat/reset_page.feature index 0fe871b91ea..745189e841b 100644 --- a/my/tests/behat/reset_page.feature +++ b/my/tests/behat/reset_page.feature @@ -24,7 +24,7 @@ Feature: Reset dashboard page to default And I add the "Comments" block And I press "Reset page to default" Then I should not see "Latest announcements" - And I should see "Latest badges" + And I should see "Timeline" And I should see "Calendar" And I should not see "Upcoming events" And I should not see "Comments" diff --git a/question/type/essay/tests/behat/file_type_restriction.feature b/question/type/essay/tests/behat/file_type_restriction.feature index 4e1f280c6d5..b0351fb6677 100644 --- a/question/type/essay/tests/behat/file_type_restriction.feature +++ b/question/type/essay/tests/behat/file_type_restriction.feature @@ -28,6 +28,9 @@ I need to limit the submittable file types And quiz "Quiz 1" contains the following questions: | question | page | | TF1 | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | Given I am on the "Quiz 1" "mod_quiz > edit" page logged in as teacher1 And I click on "Edit question TF1" "link" And I set the field "Allow attachments" to "1" diff --git a/repository/recent/tests/behat/add_recent.feature b/repository/recent/tests/behat/add_recent.feature index e3416e5e304..c1459cbcc3f 100644 --- a/repository/recent/tests/behat/add_recent.feature +++ b/repository/recent/tests/behat/add_recent.feature @@ -9,6 +9,9 @@ Feature: Recent files repository lists the recently used files Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "admin" And I follow "Manage private files" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager diff --git a/repository/tests/behat/cancel_add_file.feature b/repository/tests/behat/cancel_add_file.feature index 76c43595259..9e82ec9aa7a 100644 --- a/repository/tests/behat/cancel_add_file.feature +++ b/repository/tests/behat/cancel_add_file.feature @@ -9,6 +9,9 @@ Feature: A selected file can be cancelled Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | And I log in as "admin" And I follow "Manage private files" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager diff --git a/repository/tests/behat/create_shortcut.feature b/repository/tests/behat/create_shortcut.feature index 71f07a5f2a3..3063a037b80 100644 --- a/repository/tests/behat/create_shortcut.feature +++ b/repository/tests/behat/create_shortcut.feature @@ -15,6 +15,9 @@ Feature: Create shortcuts And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | When I log in as "teacher1" And I follow "Manage private files" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager diff --git a/repository/tests/behat/delete_files.feature b/repository/tests/behat/delete_files.feature index c1627fa7d83..9cc85176f9b 100644 --- a/repository/tests/behat/delete_files.feature +++ b/repository/tests/behat/delete_files.feature @@ -4,6 +4,11 @@ Feature: Delete files and folders from the file manager As a user I need to delete files from file areas + Background: + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + @javascript @_bug_phantomjs Scenario: Delete a file and a folder Given I log in as "admin" diff --git a/repository/tests/behat/edit_file.feature b/repository/tests/behat/edit_file.feature index d58204df408..67e73f812d8 100644 --- a/repository/tests/behat/edit_file.feature +++ b/repository/tests/behat/edit_file.feature @@ -8,11 +8,14 @@ Feature: Edit file feature Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" @javascript Scenario: Select file from "Files" filemanager using "icons" view and edit the name - Given I log in as "admin" - And I follow "Manage private files" + Given I follow "Manage private files" And I click on "Display folder with file icons" "link" in the ".filemanager" "css_element" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager And I should see "empty.txt" in the ".fp-content .fp-file" "css_element" @@ -26,8 +29,7 @@ Feature: Edit file feature @javascript Scenario: Select file from "Files" filemanager using "list" view and edit the name - Given I log in as "admin" - And I follow "Manage private files" + Given I follow "Manage private files" And I click on "Display folder with file details" "link" in the ".filemanager" "css_element" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager And I should see "empty.txt" in the ".fp-content .fp-filename" "css_element" @@ -41,8 +43,7 @@ Feature: Edit file feature @javascript Scenario: Select file from "Files" filemanager using "tree" view and edit the name - Given I log in as "admin" - And I follow "Manage private files" + Given I follow "Manage private files" And I click on "Display folder as file tree" "link" in the ".filemanager" "css_element" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager And I should see "empty.txt" in the ".fp-content .fp-hascontextmenu .fp-filename" "css_element" diff --git a/repository/tests/behat/overwrite_file.feature b/repository/tests/behat/overwrite_file.feature index 2d2c677132a..b98c813e565 100644 --- a/repository/tests/behat/overwrite_file.feature +++ b/repository/tests/behat/overwrite_file.feature @@ -15,6 +15,9 @@ Feature: Overwrite file feature And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | When I log in as "teacher1" And I follow "Manage private files" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager diff --git a/repository/tests/behat/select_file.feature b/repository/tests/behat/select_file.feature index fbd095a8746..7ba17891766 100644 --- a/repository/tests/behat/select_file.feature +++ b/repository/tests/behat/select_file.feature @@ -8,11 +8,14 @@ Feature: Select file feature Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | my-index | side-post | + And I log in as "admin" @javascript Scenario: Select a file from the "Recent files" repository using "icons" view - Given I log in as "admin" - And I am on "Course 1" course homepage with editing mode on + Given I am on "Course 1" course homepage with editing mode on And I add a "Folder" to section "1" And I set the following fields to these values: | Name | Test folder | @@ -32,8 +35,7 @@ Feature: Select file feature @javascript Scenario: Select a file from the "Recent files" repository using "list" view - Given I log in as "admin" - And I am on "Course 1" course homepage with editing mode on + Given I am on "Course 1" course homepage with editing mode on And I add a "Folder" to section "1" And I set the following fields to these values: | Name | Test folder | @@ -53,8 +55,7 @@ Feature: Select file feature @javascript Scenario: Select a file from the "Recent files" repository using "tree" view - Given I log in as "admin" - And I am on "Course 1" course homepage with editing mode on + Given I am on "Course 1" course homepage with editing mode on And I add a "Folder" to section "1" And I set the following fields to these values: | Name | Test folder |