MDL-58520 block_myoverview: change display name to Course overview
[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
7a4ff165 7 Background:
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 12 | username | firstname | lastname | email |
0fe86bbd 13 | manager1 | Manager | 1 | manager1@example.com |
7a4ff165
MG
14 | teacher1 | teacher | 1 | teacher@example.com |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
759b323e 18 And the following "system role assigns" exist:
7fcf94cb
DM
19 | user | course | role |
20 | manager1 | Acceptance test site | manager |
7a4ff165
MG
21 # Allow at least one role assignment in the block context:
22 And I log in as "admin"
23 And I navigate to "Define roles" node in "Site administration > Users > Permissions"
24 And I follow "Edit Non-editing teacher role"
25 And I set the following fields to these values:
26 | Block | 1 |
27 And I press "Save changes"
28 And I log out
29
30 Scenario: Add and configure a block throughtout the site
31 Given I log in as "manager1"
46a2fbc4 32 And I am on site homepage
7fcf94cb
DM
33 And I follow "Turn editing on"
34 And I add the "Comments" block
3ee51425 35 And I configure the "Comments" block
f083d614 36 And I set the following fields to these values:
7fcf94cb
DM
37 | Page contexts | Display throughout the entire site |
38 And I press "Save changes"
fdeeaff9 39 When I am on "Course 1" course homepage
e9af3ed3
DM
40 Then I should see "Comments" in the "Comments" "block"
41 And I should see "Save comment" in the "Comments" "block"
46a2fbc4 42 And I am on site homepage
3ee51425 43 And I configure the "Comments" block
f083d614 44 And I set the following fields to these values:
7fcf94cb
DM
45 | Default weight | -10 (first) |
46 And I press "Save changes"
fdeeaff9 47 And I am on "Course 1" course homepage
7fcf94cb 48 # The first block matching the pattern should be top-left block
63e4df60 49 And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element"
29ac5a6b 50
c35cf9bf 51 Scenario: Blocks on the dashboard page can have roles assigned to them
7a4ff165 52 Given I log in as "manager1"
29ac5a6b 53 When I press "Customise this page"
e5287f9b 54 Then I should see "Assign roles in Private files block"
29ac5a6b
AN
55
56 Scenario: Blocks on courses can have roles assigned to them
7a4ff165 57 Given I log in as "teacher1"
fdeeaff9 58 And I am on "Course 1" course homepage with editing mode on
ba5c5083 59 And I add the "Search forums" block
29ac5a6b 60 Then I should see "Assign roles in Search forums block"
8721ed57
AN
61
62 @javascript
63 Scenario: Blocks can safely be customised
64 Given I log in as "admin"
e5287f9b 65 And I am on homepage
8721ed57
AN
66 And I press "Customise this page"
67 And I add the "HTML" block
68 And I configure the "(new HTML block)" block
69 And I set the following fields to these values:
32a904e0
JPG
70 | Block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" |
71 | Content | Example |
8721ed57 72 When I press "Save changes"
4671ae63 73 Then I should see "Course overview"