Merge branch 'MDL-47911-master' of git://github.com/damyon/moodle
[moodle.git] / blocks / tests / behat / configure_block_throughout_site.feature
CommitLineData
550d842e 1@core @core_block
7fcf94cb
DM
2Feature: Add and configure blocks throughout the site
3 In order to maintain some patterns across all the site
5d7b6307 4 As a manager
7fcf94cb
DM
5 I need to set and configure blocks throughout the site
6
7fcf94cb 7 Scenario: Add and configure a block throughtout the site
759b323e 8 Given the following "courses" exist:
7fcf94cb
DM
9 | fullname | shortname | category |
10 | Course 1 | C1 | 0 |
759b323e 11 And the following "users" exist:
7fcf94cb
DM
12 | username | firstname | lastname | email |
13 | manager1 | Manager | 1 | manager1@asd.com |
759b323e 14 And the following "system role assigns" exist:
7fcf94cb
DM
15 | user | course | role |
16 | manager1 | Acceptance test site | manager |
17 And I log in as "manager1"
18 And I follow "Turn editing on"
19 And I add the "Comments" block
3ee51425 20 And I configure the "Comments" block
f083d614 21 And I set the following fields to these values:
7fcf94cb
DM
22 | Page contexts | Display throughout the entire site |
23 And I press "Save changes"
24 When I follow "Course 1"
e9af3ed3
DM
25 Then I should see "Comments" in the "Comments" "block"
26 And I should see "Save comment" in the "Comments" "block"
7fcf94cb 27 And I am on homepage
3ee51425 28 And I configure the "Comments" block
f083d614 29 And I set the following fields to these values:
7fcf94cb
DM
30 | Default weight | -10 (first) |
31 And I press "Save changes"
32 And I follow "Course 1"
33 # The first block matching the pattern should be top-left block
5df9e40c 34 And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element"
29ac5a6b
AN
35
36 Scenario: Blocks on the my home page cannot have roles assigned to them
37 Given the following "users" exist:
38 | username | firstname | lastname | email |
39 | manager1 | Manager | 1 | manager1@asd.com |
40 And I log in as "manager1"
41 And I click on "My home" "link" in the "Navigation" "block"
42 When I press "Customise this page"
43 Then I should not see "Assign roles in Navigation block"
44
45 Scenario: Blocks on courses can have roles assigned to them
46 Given the following "courses" exist:
47 | fullname | shortname | category |
48 | Course 1 | C1 | 0 |
49 And the following "users" exist:
50 | username | firstname | lastname | email |
51 | teacher1 | teacher | 1 | teacher@example.com |
52 And the following "course enrolments" exist:
53 | user | course | role |
54 | teacher1 | C1 | editingteacher |
55 And I log in as "teacher1"
56 And I follow "Course 1"
57 And I follow "Turn editing on"
58 Then I should see "Assign roles in Search forums block"