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 | ||
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 | 12 | | username | firstname | lastname | email | |
0fe86bbd | 13 | | manager1 | Manager | 1 | manager1@example.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" | |
46a2fbc4 | 18 | And I am on site homepage |
7fcf94cb DM |
19 | And I follow "Turn editing on" |
20 | And I add the "Comments" block | |
3ee51425 | 21 | And I configure the "Comments" block |
f083d614 | 22 | And I set the following fields to these values: |
7fcf94cb DM |
23 | | Page contexts | Display throughout the entire site | |
24 | And I press "Save changes" | |
25 | When I follow "Course 1" | |
e9af3ed3 DM |
26 | Then I should see "Comments" in the "Comments" "block" |
27 | And I should see "Save comment" in the "Comments" "block" | |
46a2fbc4 | 28 | And I am on site homepage |
3ee51425 | 29 | And I configure the "Comments" block |
f083d614 | 30 | And I set the following fields to these values: |
7fcf94cb DM |
31 | | Default weight | -10 (first) | |
32 | And I press "Save changes" | |
33 | And I follow "Course 1" | |
34 | # The first block matching the pattern should be top-left block | |
5df9e40c | 35 | 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 | 36 | |
81d7de1a | 37 | Scenario: Blocks on the dashboard page cannot have roles assigned to them |
29ac5a6b AN |
38 | Given the following "users" exist: |
39 | | username | firstname | lastname | email | | |
0fe86bbd | 40 | | manager1 | Manager | 1 | manager1@example.com | |
29ac5a6b | 41 | And I log in as "manager1" |
81d7de1a | 42 | And I click on "Dashboard" "link" in the "Navigation" "block" |
29ac5a6b AN |
43 | When I press "Customise this page" |
44 | Then I should not see "Assign roles in Navigation block" | |
45 | ||
46 | Scenario: Blocks on courses can have roles assigned to them | |
47 | Given the following "courses" exist: | |
48 | | fullname | shortname | category | | |
49 | | Course 1 | C1 | 0 | | |
50 | And the following "users" exist: | |
51 | | username | firstname | lastname | email | | |
52 | | teacher1 | teacher | 1 | teacher@example.com | | |
53 | And the following "course enrolments" exist: | |
54 | | user | course | role | | |
55 | | teacher1 | C1 | editingteacher | | |
56 | And I log in as "teacher1" | |
57 | And I follow "Course 1" | |
58 | And I follow "Turn editing on" | |
59 | Then I should see "Assign roles in Search forums block" | |
8721ed57 AN |
60 | |
61 | @javascript | |
62 | Scenario: Blocks can safely be customised | |
63 | Given I log in as "admin" | |
46a2fbc4 | 64 | And I click on "Dashboard" "link" in the "Navigation" "block" |
8721ed57 AN |
65 | And I press "Customise this page" |
66 | And I add the "HTML" block | |
67 | And I configure the "(new HTML block)" block | |
68 | And I set the following fields to these values: | |
69 | | Block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" | |
70 | | Content | Example | |
71 | When I press "Save changes" | |
72 | Then I should see "Course overview" |