MDL-38352 behat: Updating tests
[moodle.git] / blocks / tests / behat / restrict_available_blocks.feature
blob00cf8de40ae5e377b1308a79ab97d739476f6208
1 @blocks
2 Feature: Allowed blocks controls
3   In order to prevent the use of some blocks
4   As an admin
5   I need to restrict some blocks to be used in courses
7   Background:
8     Given the following "users" exists:
9       | username | firstname | lastname | email |
10       | teacher1 | Teacher | 1 | teacher1@asd.com |
11     And the following "courses" exists:
12       | fullname | shortname | category |
13       | Course $NASTYSTRING1 | C1 | 0 |
14     And the following "course enrolments" exists:
15       | user | course | role |
16       | teacher1 | C1 | editingteacher |
18   @javascript
19   Scenario: Blocks can be added with the default permissions
20     Given I log in as "teacher1"
21     And I follow "Course $NASTYSTRING1"
22     And I turn editing mode on
23     When I add the "Course completion status" block
24     And I add the "Activities" block
25     Then I should see "Activities"
26     And I should see "Course completion status"
28   @javascript
29   Scenario: Blocks can not be added when the admin restricts the permissions
30     Given I log in as "admin"
31     And I set the following system permissions of "Teacher" role:
32       | block/activity_modules:addinstance | Prohibit |
33     And I am on homepage
34     And I follow "Course $NASTYSTRING1"
35     And I expand "Users" node
36     And I follow "Permissions"
37     And I override the system permissions of "Teacher" role with:
38       | block/completionstatus:addinstance | Prohibit |
39     And I log out
40     When I log in as "teacher1"
41     And I follow "Course $NASTYSTRING1"
42     And I turn editing mode on
43     Then the "Add a block" select box should not contain "Activities"
44     And the "Add a block" select box should not contain "Course completion status"