diff --git a/blocks/html/tests/behat/configuring_html_block.feature b/blocks/html/tests/behat/configuring_html_block.feature new file mode 100644 index 00000000000..ad255309f35 --- /dev/null +++ b/blocks/html/tests/behat/configuring_html_block.feature @@ -0,0 +1,38 @@ +@block @block_html @core_block +Feature: Adding and configuring HTML blocks + In order to have custom blocks on a page + As admin + I need to be able to create, configure and change HTML blocks + + @javascript + Scenario: Configuring the HTML block with Javascript on + Given I log in as "admin" + When I click on "Turn editing on" "link" in the "Administration" "block" + And I add the "HTML" block + And I configure the "(new HTML block)" block + And I set the field "Content" to "Static text without a header" + And I press "Save changes" + Then I should not see "(new HTML block)" + And I configure the "block_html" block + And I set the field "Block title" to "The HTML block header" + And I set the field "Content" to "Static text with a header" + And I press "Save changes" + And "block_html" "block" should exist + And "The HTML block header" "block" should exist + And I should see "Static text with a header" in the "The HTML block header" "block" + + Scenario: Configuring the HTML block with Javascript off + Given I log in as "admin" + When I click on "Turn editing on" "link" in the "Administration" "block" + And I add the "HTML" block + And I configure the "(new HTML block)" block + And I set the field "Content" to "Static text without a header" + And I press "Save changes" + Then I should not see "(new HTML block)" + And I configure the "block_html" block + And I set the field "Block title" to "The HTML block header" + And I set the field "Content" to "Static text with a header" + And I press "Save changes" + And "block_html" "block" should exist + And "The HTML block header" "block" should exist + And I should see "Static text with a header" in the "The HTML block header" "block" diff --git a/blocks/html/tests/behat/course_block.feature b/blocks/html/tests/behat/course_block.feature new file mode 100644 index 00000000000..c44a758d1fa --- /dev/null +++ b/blocks/html/tests/behat/course_block.feature @@ -0,0 +1,36 @@ +@block @block_html +Feature: HTML blocks in a course + In order to have one or multiple HTML blocks in a course + As a teacher + I need to be able to create and change such blocks + + Scenario: Adding HTML block in a course + Given the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Terry1 | Teacher1 | teacher@asd.com | + | student1 | Sam1 | Student1 | student1@asd.com | + And the following "courses" exist: + | fullname | shortname | + | Course 1 | C1 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + When I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add the "HTML" block + And I configure the "(new HTML block)" block + And I set the field "Content" to "First block content" + And I set the field "Block title" to "First block header" + And I press "Save changes" + And I add the "HTML" block + And I configure the "(new HTML block)" block + And I set the field "Content" to "Second block content" + And I set the field "Block title" to "Second block header" + And I press "Save changes" + And I log out + And I log in as "student1" + And I follow "Course 1" + And I should see "First block content" in the "First block header" "block" + And I should see "Second block content" in the "Second block header" "block" \ No newline at end of file diff --git a/blocks/html/tests/behat/multiple_instances.feature b/blocks/html/tests/behat/multiple_instances.feature new file mode 100644 index 00000000000..45b608f35ec --- /dev/null +++ b/blocks/html/tests/behat/multiple_instances.feature @@ -0,0 +1,41 @@ +@block @block_html +Feature: Adding and configuring HTML blocks + In order to have one or multiple HTML blocks on a page + As admin + I need to be able to create, configure and change HTML blocks + + Background: + Given I log in as "admin" + When I click on "Turn editing on" "link" in the "Administration" "block" + And I add the "HTML" block + + Scenario: Other users can not see HTML block that has not been configured + Then "(new HTML block)" "block" should exist + And I log out + And "(new HTML block)" "block" should not exist + And "block_html" "block" should not exist + + Scenario: Other users can see HTML block that has been configured even when it has no header + And I configure the "(new HTML block)" block + And I set the field "Content" to "Static text without a header" + And I press "Save changes" + Then I should not see "(new HTML block)" + And I log out + And I am on homepage + And "block_html" "block" should exist + And I should see "Static text without a header" in the "block_html" "block" + And I should not see "(new HTML block)" + + Scenario: Adding multiple instances of HTML block on a page + And I configure the "block_html" block + And I set the field "Block title" to "The HTML block header" + And I set the field "Content" to "Static text with a header" + And I press "Save changes" + And I add the "HTML" block + And I configure the "(new HTML block)" block + And I set the field "Block title" to "The second HTML block header" + And I set the field "Content" to "Second block contents" + And I press "Save changes" + And I log out + Then I should see "Static text with a header" in the "The HTML block header" "block" + And I should see "Second block contents" in the "The second HTML block header" "block"