first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
@core @core_block
Feature: Add blocks
In order to add more functionality to pages
As a teacher
I need to add blocks to pages
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add the "Blog menu" block
Then I should see "View my entries about this course"
@javascript
Scenario: Add a block to a course with Javascript enabled
Scenario: Add a block to a course with Javascript disabled
@@ -0,0 +1,53 @@
@block @core_block @javascript @addablocklink
Feature: Add a block when main feature is enabled
In order to add a block to my course
As a teacher
Some blocks should be only added to courses if the main feature they are based on is enabled.
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And I am on the "C1" "course" page logged in as "admin"
Scenario Outline: The block can be added when main feature is enabled
Given the following config values are set as admin:
| <settingname1> | 1 | <settingplugin1> |
| <settingname2> | 1 | |
And I turn editing mode on
When I click on "Add a block" "link"
Then I should see "<blockname>"
Examples:
| blockname | settingname1 | settingname2 | settingplugin1 |
| Accessibility review | enableaccessibilitytools | | |
| Blog menu | enableblogs | | |
| Recent blog entries | enableblogs | | |
| Blog tags | enableblogs | usetags | |
| Comments | usecomments | | |
| Course completion status | enablecompletion | | |
| Global search | enableglobalsearch | | |
| Latest badges | enablebadges | | |
| Tags | usetags | | |
| Learning plans | enabled | | core_competency |
Scenario Outline: The block cannot be added when main feature is disabled
Given the following config values are set as admin:
| <settingname1> | 0 | <settingplugin1> |
| <settingname2> | 0 | |
And I turn editing mode on
When I click on "Add a block" "link"
Then I should not see "<blockname>"
Examples:
| blockname | settingname1 | settingname2 | settingplugin1 |
| Accessibility review | enableaccessibilitytools | | |
| Blog menu | enableblogs | | |
| Recent blog entries | enableblogs | | |
| Blog tags | enableblogs | usetags | |
| Comments | usecomments | | |
| Course completion status | enablecompletion | | |
| Global search | enableglobalsearch | | |
| Latest badges | enablebadges | | |
| Tags | usetags | | |
| Learning plans | enabled | | core_competency |
@@ -0,0 +1,101 @@
@block @core_block @javascript
Feature: Add a block when main feature is disabled
In order to add a block to my course
As a teacher
Some blocks should be only added to courses if the main feature they are based on is enabled.
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And I am on the "C1" "course" page logged in as "admin"
Scenario Outline: The block is displayed even when main feature is disabled
Given the following config values are set as admin:
| <settingname1> | 1 | <settingplugin1> |
And I turn editing mode on
And I add the "<blockname>" block
When the following config values are set as admin:
| <settingname1> | 0 | <settingplugin1> |
Then I should see "<blockname>"
Examples:
| blockname | settingname1 | settingplugin1 |
| Accessibility review | enableaccessibilitytools | |
| Blog menu | enableblogs | |
| Recent blog entries | enableblogs | |
| Comments | usecomments | |
| Course completion status | enablecompletion | |
| Global search | enableglobalsearch | |
| Latest badges | enablebadges | |
| Tags | usetags | |
| Learning plans | enabled | core_competency |
Scenario Outline: The block is displayed even when main feature is disabled (2 settings)
Given the following config values are set as admin:
| <settingname1> | 1 |
| <settingname2> | 1 |
And I turn editing mode on
And I add the "<blockname>" block
When the following config values are set as admin:
| <settingname1> | 0 |
| <settingname2> | 0 |
Then I should see "<blockname>"
Examples:
| blockname | settingname1 | settingname2 |
| Blog tags | enableblogs | usetags |
Scenario Outline: The block can be removed even when main feature is disabled
Given the following config values are set as admin:
| <settingname1> | 1 | <settingplugin1> |
And I turn editing mode on
And I add the "<blockname>" block
And I open the "<blockname>" blocks action menu
And I click on "Delete <blockname> block" "link" in the "<blockname>" "block"
And "Delete block?" "dialogue" should exist
And I click on "Cancel" "button" in the "Delete block?" "dialogue"
And I should see "<blockname>"
When the following config values are set as admin:
| <settingname1> | 0 | <settingplugin1> |
And I open the "<blockname>" blocks action menu
And I click on "Delete <blockname> block" "link" in the "<blockname>" "block"
And "Delete block?" "dialogue" should exist
And I click on "Delete" "button" in the "Delete block?" "dialogue"
Then I should not see "<blockname>"
Examples:
| blockname | settingname1 | settingplugin1 |
| Accessibility review | enableaccessibilitytools | |
| Blog menu | enableblogs | |
| Recent blog entries | enableblogs | |
| Comments | usecomments | |
| Course completion status | enablecompletion | |
| Global search | enableglobalsearch | |
| Latest badges | enablebadges | |
| Tags | usetags | |
| Learning plans | enabled | core_competency |
Scenario Outline: The block can be removed even when main feature is disabled (2 settings)
Given the following config values are set as admin:
| <settingname1> | 1 |
| <settingname2> | 1 |
And I turn editing mode on
And I add the "<blockname>" block
And I open the "<blockname>" blocks action menu
And I click on "Delete <blockname> block" "link" in the "<blockname>" "block"
And "Delete block?" "dialogue" should exist
And I click on "Cancel" "button" in the "Delete block?" "dialogue"
And I should see "<blockname>"
When the following config values are set as admin:
| <settingname1> | 0 |
| <settingname2> | 0 |
And I open the "<blockname>" blocks action menu
And I click on "Delete <blockname> block" "link" in the "<blockname>" "block"
And "Delete block?" "dialogue" should exist
And I click on "Delete" "button" in the "Delete block?" "dialogue"
Then I should not see "<blockname>"
Examples:
| blockname | settingname1 | settingname2 |
| Blog tags | enableblogs | usetags |
+200
View File
@@ -0,0 +1,200 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Steps definitions related with blocks.
*
* @package core_block
* @category test
* @copyright 2012 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
use Behat\Gherkin\Node\TableNode as TableNode;
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
/**
* Blocks management steps definitions.
*
* @package core_block
* @category test
* @copyright 2012 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_blocks extends behat_base {
/**
* Adds the selected block. Editing mode must be previously enabled.
*
* @Given /^I add the "(?P<block_name_string>(?:[^"]|\\")*)" block$/
* @param string $blockname
*/
public function i_add_the_block($blockname) {
$addblock = get_string('addblock');
$this->execute('behat_general::i_click_on_in_the', [$addblock, 'link_exact', '.add_block_button', 'css_element']);
if (!$this->running_javascript()) {
$this->execute('behat_general::i_click_on_in_the', [$blockname, 'link_exact', '#region-main', 'css_element']);
} else {
$this->execute('behat_general::i_click_on_in_the', [$blockname, 'link_exact', $addblock, 'dialogue']);
}
}
/**
* Adds the selected block to the specified region
*
* Editing mode must be previously enabled.
*
* @Given /^I add the "(?P<block_name_string>(?:[^"]|\\")*)" block to the "(?P<region_string>(?:[^"]|\\")*)" region$/
* @param string $blockname
* @param string $region
*/
public function i_add_the_block_to_the_region(string $blockname, string $region) {
if (!$this->running_javascript()) {
throw new coding_exception('Adding block to specific region is not possible with Javascript disabled');
}
if ($region === "default") {
$region = "";
}
$csselement = 'a[data-key="addblock"][data-blockregion='.behat_context_helper::escape($region).']';
$addblock = get_string('addblock');
$this->execute('behat_general::i_click_on', [$csselement, 'css_element']);
$this->execute('behat_general::i_click_on_in_the', [$blockname, 'link_exact', $addblock, 'dialogue']);
}
/**
* Adds the selected block to the specified region and fills configuration form.
*
* Editing mode must be previously enabled.
*
* @Given /^I add the "(?P<block_name_string>(?:[^"]|\\")*)" block to the (?P<region_string>(?:[^"]|\\")*) region with:$/
* @param string $blockname
* @param string $region
* @param TableNode $data
*/
public function i_add_the_block_to_the_region_with(string $blockname, string $region, TableNode $data) {
$blocklabel = get_string('textellipsis', 'moodle', $blockname);
$this->execute('behat_blocks::i_add_the_block_to_the_region', [$blocklabel, $region]);
$this->wait_for_pending_js();
$dialogname = get_string('addblock', 'core_block', $blockname);
$this->execute('behat_forms::i_set_the_following_fields_in_container_to_these_values',
[$dialogname, "dialogue", $data]);
$this->execute('behat_general::i_click_on_in_the', ["Save changes", 'button', $dialogname, 'dialogue']);
}
/**
* Adds the selected block if it is not already present. Editing mode must be previously enabled.
*
* @Given /^I add the "(?P<block_name_string>(?:[^"]|\\")*)" block if not present$/
* @param string $blockname
*/
public function i_add_the_block_if_not_present($blockname) {
try {
$this->get_text_selector_node('block', $blockname);
} catch (ElementNotFoundException $e) {
$this->execute('behat_blocks::i_add_the_block', [$blockname]);
}
}
/**
* Opens a block's actions menu if it is not already opened.
*
* @Given /^I open the "(?P<block_name_string>(?:[^"]|\\")*)" blocks action menu$/
* @throws DriverException The step is not available when Javascript is disabled
* @param string $blockname
*/
public function i_open_the_blocks_action_menu($blockname) {
if (!$this->running_javascript()) {
// Action menu does not need to be open if Javascript is off.
return;
}
// If it is already opened we do nothing.
$blocknode = $this->get_text_selector_node('block', $blockname);
if ($blocknode->hasClass('action-menu-shown')) {
return;
}
$this->execute('behat_general::i_click_on_in_the',
array("a[data-toggle='dropdown']", "css_element", $this->escape($blockname), "block")
);
}
/**
* Clicks on Configure block for specified block. Page must be in editing mode.
*
* Argument block_name may be either the name of the block or CSS class of the block.
*
* @Given /^I configure the "(?P<block_name_string>(?:[^"]|\\")*)" block$/
* @param string $blockname
*/
public function i_configure_the_block($blockname) {
// Note that since $blockname may be either block name or CSS class, we can not use the exact label of "Configure" link.
$this->execute("behat_blocks::i_open_the_blocks_action_menu", $this->escape($blockname));
$this->execute('behat_general::i_click_on_in_the',
array("Configure", "link", $this->escape($blockname), "block")
);
}
/**
* Ensures that block can be added to the page but does not actually add it.
*
* @Then /^the add block selector should contain "(?P<block_name_string>(?:[^"]|\\")*)" block$/
* @param string $blockname
*/
public function the_add_block_selector_should_contain_block($blockname) {
$addblock = get_string('addblock');
$this->execute('behat_general::i_click_on', [$addblock, 'link_exact']);
$cancelstr = get_string('cancel');
if (!$this->running_javascript()) {
$this->execute('behat_general::should_exist_in_the', [$blockname, 'link_exact', '#region-main', 'css_element']);
$this->execute('behat_general::i_click_on_in_the', [$cancelstr, 'link_exact', '#region-main', 'css_element']);
} else {
$this->execute('behat_general::should_exist_in_the', [$blockname, 'link_exact', $addblock, 'dialogue']);
$this->execute('behat_general::i_click_on_in_the', [$cancelstr, 'button', $addblock, 'dialogue']);
}
}
/**
* Ensures that block can not be added to the page.
*
* @Then /^the add block selector should not contain "(?P<block_name_string>(?:[^"]|\\")*)" block$/
* @param string $blockname
*/
public function the_add_block_selector_should_not_contain_block($blockname) {
$addblock = get_string('addblock');
$this->execute('behat_general::i_click_on', [$addblock, 'link_exact']);
$cancelstr = get_string('cancel');
if (!$this->running_javascript()) {
$this->execute('behat_general::should_not_exist_in_the', [$blockname, 'link_exact', '#region-main', 'css_element']);
$this->execute('behat_general::i_click_on_in_the', [$cancelstr, 'link_exact', '#region-main', 'css_element']);
} else {
$this->execute('behat_general::should_not_exist_in_the', [$blockname, 'link_exact', $addblock, 'dialogue']);
$this->execute('behat_general::i_click_on_in_the', [$cancelstr, 'button', $addblock, 'dialogue']);
}
}
}
@@ -0,0 +1,71 @@
@core @core_block
Feature: Add and configure blocks throughout the site
In order to maintain some patterns across all the site
As a manager
I need to set and configure blocks throughout the site
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| manager1 | Manager | 1 | manager1@example.com |
| teacher1 | teacher | 1 | teacher@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "system role assigns" exist:
| user | course | role |
| manager1 | Acceptance test site | manager |
# Allow at least one role assignment in the block context:
And I log in as "admin"
And I navigate to "Users > Permissions > Define roles" in site administration
And I follow "Edit Non-editing teacher role"
And I set the following fields to these values:
| Block | 1 |
And I press "Save changes"
And I log out
Scenario: Add and configure a block throughtout the site
Given I log in as "manager1"
And I am on site homepage
And I turn editing mode on
And I add the "Comments" block
And I configure the "Comments" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
When I am on "Course 1" course homepage
Then I should see "Comments" in the "Comments" "block"
And I should see "Save comment" in the "Comments" "block"
And I am on site homepage
And I configure the "Comments" block
And I set the following fields to these values:
| Default weight | -10 (first) |
And I press "Save changes"
And I am on "Course 1" course homepage
# The first block matching the pattern should be top-left block
And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" "xpath_element"
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 Recently accessed items block"
Scenario: Blocks on courses can have roles assigned to them
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Search forums" block
Then I should see "Assign roles in Search forums block"
@javascript
Scenario: Blocks can safely be customised
Given I log in as "admin"
And I am on homepage
And I turn editing mode on
And I add the "Text" block to the default region with:
| Text block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" |
| Content | Example |
Then I should see "Example" in the "block_html" "block"
Then I should see "document.getElementsByTagName"
+33
View File
@@ -0,0 +1,33 @@
@core @core_block
Feature: Block removal via modal
In order to remove blocks
As a teacher
I need to use a modal to confirm the block to delete
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| search_forums | Course | C1 | course-view-* | side-pre |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
@javascript
Scenario: Removing a block via modal should remove the block on the page
Given I open the "Search forums" blocks action menu
When I click on "Delete Search forums block" "link" in the "Search forums" "block"
Then "Delete block?" "dialogue" should exist
And I click on "Delete" "button" in the "Delete block?" "dialogue"
And I wait to be redirected
And "Search forums" "block" should not exist
@javascript
Scenario: Cancel removing a block via modal should retain the block on the page
Given I open the "Search forums" blocks action menu
When I click on "Delete Search forums block" "link" in the "Search forums" "block"
Then "Delete block?" "dialogue" should exist
And I click on "Cancel" "button" in the "Delete block?" "dialogue"
And I should not see "Delete block?"
And "Search forums" "block" should exist
@@ -0,0 +1,54 @@
@core @core_block
Feature: Show hidden blocks in a docked block region when editing
In order to edit blocks in a hidden region
As a teacher
I need to be able to see the blocks when editing is on
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| admin | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| search_forums | Course | C1 | course-view-* | side-pre |
| news_items | Course | C1 | course-view-* | side-pre |
| calendar_upcoming | Course | C1 | course-view-* | side-pre |
| recent_activity | Course | C1 | course-view-* | side-pre |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
# Hide all the blocks in the non-default region
And I configure the "Search forums" block
And I set the following fields to these values:
| Visible | No |
And I click on "Save changes" "button"
And I configure the "Latest announcements" block
And I set the following fields to these values:
| Visible | No |
And I click on "Save changes" "button"
And I configure the "Upcoming events" block
And I set the following fields to these values:
| Visible | No |
And I click on "Save changes" "button"
And I configure the "Recent activity" block
And I set the following fields to these values:
| Visible | No |
When I click on "Save changes" "button"
# Editing is on so they should be visible
Then I should see "Search forums"
And I should see "Latest announcements"
And I should see "Upcoming events"
And I should see "Recent activity"
And I turn editing mode off
# Editing is off, so they should no longer be visible
And I should not see "Search forums"
And I should not see "Latest announcements"
And I should not see "Upcoming events"
And I should not see "Recent activity"
@javascript
Scenario: Check that a region with only hidden blocks is not docked in editing mode (javascript enabled)
Scenario: Check that a region with only hidden blocks is not docked in editing mode (javascript disabled)
+29
View File
@@ -0,0 +1,29 @@
@core @core_block
Feature: Block visibility
In order to configure blocks visibility
As a teacher
I need to show and hide blocks on a page
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| search_forums | Course | C1 | course-view-* | side-pre |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
@javascript
Scenario: Hiding all blocks on the page should remove the column they're in
When I open the "Search forums" blocks action menu
And I click on "Configure Search forums block" "link" in the "Search forums" "block"
And I set the field "Region" to "Right"
And I press "Save changes"
And I turn editing mode off
Then ".empty-region-side-post" "css_element" should not exist in the "body" "css_element"
And I turn editing mode on
And I open the "Search forums" blocks action menu
And I click on "Hide Search forums block" "link" in the "Search forums" "block"
And I turn editing mode off
And ".empty-region-side-post" "css_element" should exist in the "body" "css_element"
+55
View File
@@ -0,0 +1,55 @@
@core @core_block
Feature: Block appearances
In order to configure blocks appearance
As a teacher
I need to add and modify block configuration for the page
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
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 |
And the following "activities" exist:
| activity | name | course | idnumber |
| assign | Test assign name | C1 | assign1 |
| book | Test book name | C1 | book1 |
And the following "mod_book > chapter" exists:
| book | Test book name |
| title | Book title |
| content | Book content test test |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| comments | Course | C1 | course-view-* | side-pre |
And I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I configure the "Comments" block
And I set the following fields to these values:
| Display on page types | Any page |
And I press "Save changes"
Scenario: Block settings can be modified so that a block apprears on any page
When I click on "Test assign name" "link" in the "region-main" "region"
Then I should see "Comments" in the "Comments" "block"
And I am on "Course 1" course homepage
And I configure the "Comments" block
And I set the following fields to these values:
| Display on page types | Any course page |
And I press "Save changes"
And I turn editing mode off
And I click on "Test assign name" "link" in the "region-main" "region"
And I should not see "Comments"
Scenario: Block settings can be modified so that a block can be hidden
When I click on "Test book name" "link" in the "region-main" "region"
And I configure the "Comments" block
And I set the following fields to these values:
| Visible | No |
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode off
And I click on "Test book name" "link" in the "region-main" "region"
Then I should not see "Comments"
+41
View File
@@ -0,0 +1,41 @@
@core @core_block
Feature: Block region moving
In order to configure blocks appearance
As a teacher
I need to modify block region for the page
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
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 |
And the following "activities" exist:
| activity | course | name |
| assign | C1 | Test assign name |
| book | C1 | Test book name |
And the following "mod_book > chapter" exists:
| book | Test book name |
| title | Book title |
| content | Book content test test |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| comments | Course | C1 | course-view-* | side-pre |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I configure the "Comments" block
And I set the following fields to these values:
| Display on page types | Any page |
And I press "Save changes"
Scenario: Block settings can be modified so that a block can be moved
When I follow "Test book name"
And I configure the "Comments" block
And I set the following fields to these values:
| Region | Right |
And I press "Save changes"
And I should see "Comments" in the "//*[@id='region-post' or @id='block-region-side-post']" "xpath_element"
@@ -0,0 +1,38 @@
@core @core_block
Feature: Allowed blocks controls
In order to prevent the use of some blocks
As an admin
I need to restrict some blocks to be used in courses
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: Blocks can be added with the default permissions
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I add the "Course completion status" block
And I add the "Activities" block
Then I should see "Activities" in the "Activities" "block"
And I should see "Course completion status" in the "Course completion status" "block"
Scenario: Blocks can not be added when the admin restricts the permissions
Given the following "role capability" exists:
| role | editingteacher |
| block/activity_modules:addinstance | prohibit |
And I log in as "admin"
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
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Then the add block selector should not contain "Activities" block
And the add block selector should not contain "Course completion status" block
@@ -0,0 +1,45 @@
@core @core_block
Feature: The context of a block can always be returned to it's original state.
In order to revert actions when configuring blocks
As an admin
I need to be able to return the block to original state
Scenario: Add and configure a block to display on every page and revert back
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Assignment1 | Description | C1 | 1 | assign1 |
| assign | Assignment2 | Description | C1 | 1 | assign1 |
And I log in as "admin"
When I am on "Course 1" course homepage with editing mode on
And I add the "Tags" block
Then I should see "Tags" in the "Tags" "block"
And I navigate to course participants
And I configure the "Tags" block
And I set the following fields to these values:
| Display on page types | Any page |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Assignment1"
And I configure the "Tags" block
And I set the following fields to these values:
| Display on page types | Any assignment module page |
And I press "Save changes"
And I should see "Tags" in the "Tags" "block"
And I am on "Course 1" course homepage
And "Tags" "block" should not exist
And I navigate to course participants
And "Tags" "block" should not exist
And I am on "Course 1" course homepage
And I follow "Assignment2"
And I should see "Tags" in the "Tags" "block"
And I configure the "Tags" block
And I set the following fields to these values:
| Display on page types | Any page |
And I press "Save changes"
And I am on "Course 1" course homepage
And I should see "Tags" in the "Tags" "block"
And I navigate to course participants
And I should see "Tags" in the "Tags" "block"