Commit | Line | Data |
---|---|---|
550d842e | 1 | @core @core_block |
7fcf94cb DM |
2 | Feature: 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" | |
39 | When I follow "Course 1" | |
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" | |
47 | And I follow "Course 1" | |
48 | # The first block matching the pattern should be top-left block | |
5df9e40c | 49 | 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 | 50 | |
c35cf9bf | 51 | Scenario: Blocks on the dashboard page can have roles assigned to them |
7a4ff165 | 52 | Given I log in as "manager1" |
81d7de1a | 53 | And I click on "Dashboard" "link" in the "Navigation" "block" |
29ac5a6b | 54 | When I press "Customise this page" |
c35cf9bf | 55 | Then I should see "Assign roles in Navigation block" |
29ac5a6b AN |
56 | |
57 | Scenario: Blocks on courses can have roles assigned to them | |
7a4ff165 | 58 | Given I log in as "teacher1" |
29ac5a6b AN |
59 | And I follow "Course 1" |
60 | And I follow "Turn editing on" | |
61 | Then I should see "Assign roles in Search forums block" | |
8721ed57 AN |
62 | |
63 | @javascript | |
64 | Scenario: Blocks can safely be customised | |
65 | Given I log in as "admin" | |
46a2fbc4 | 66 | And I click on "Dashboard" "link" in the "Navigation" "block" |
8721ed57 AN |
67 | And I press "Customise this page" |
68 | And I add the "HTML" block | |
69 | And I configure the "(new HTML block)" block | |
70 | And I set the following fields to these values: | |
71 | | Block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" | |
72 | | Content | Example | |
73 | When I press "Save changes" | |
74 | Then I should see "Course overview" |