diff --git a/blocks/tests/behat/behat_blocks.php b/blocks/tests/behat/behat_blocks.php index 215c72e8691..180317a2c17 100644 --- a/blocks/tests/behat/behat_blocks.php +++ b/blocks/tests/behat/behat_blocks.php @@ -58,4 +58,18 @@ class behat_blocks extends behat_base { return $steps; } + /** + * Clicks on Configure block for specified block. Page must be in editing mode. + * + * Argument block_name may be either the name of the block or CSS class of the block. + * + * @Given /^I configure the "(?P(?:[^"]|\\")*)" block$/ + * @param string $blockname + */ + public function i_configure_the_block($blockname) { + // Note that since $blockname may be either block name or CSS class, we can not use the exact label of "Configure" link. + return array( + new Given('I click on "Configure" "link" in the "'.$this->escape($blockname).'" "block"') + ); + } } diff --git a/blocks/tests/behat/configure_block_throughout_site.feature b/blocks/tests/behat/configure_block_throughout_site.feature index 0eabb379bd2..a34f7937e61 100644 --- a/blocks/tests/behat/configure_block_throughout_site.feature +++ b/blocks/tests/behat/configure_block_throughout_site.feature @@ -4,7 +4,6 @@ Feature: Add and configure blocks throughout the site As a manager I need to set and configure blocks throughout the site - @javascript Scenario: Add and configure a block throughtout the site Given the following "courses" exists: | fullname | shortname | category | @@ -18,7 +17,7 @@ Feature: Add and configure blocks throughout the site And I log in as "manager1" And I follow "Turn editing on" And I add the "Comments" block - And I follow "Configure Comments block" + And I configure the "Comments" block And I fill the moodle form with: | Page contexts | Display throughout the entire site | And I press "Save changes" @@ -26,7 +25,7 @@ Feature: Add and configure blocks throughout the site Then I should see "Comments" in the "Comments" "block" And I should see "Save comment" in the "Comments" "block" And I am on homepage - And I follow "Configure Comments block" + And I configure the "Comments" block And I fill the moodle form with: | Default weight | -10 (first) | And I press "Save changes" diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index e671a313eaf..112b1a9e599 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -42,17 +42,16 @@ Feature: Block appearances And I follow "Course 1" And I follow "Turn editing on" And I add the "Comments" block - And I follow "Configure Comments block" + And I configure the "Comments" block And I fill the moodle form with: | Display on page types | Any page | And I press "Save changes" - @javascript Scenario: Block settings can be modified so that a block apprears on any page When I follow "Test survey name" Then I should see "Comments" in the "Comments" "block" And I follow "Course 1" - And I follow "Configure Comments block" + And I configure the "Comments" block And I fill the moodle form with: | Display on page types | Any course page | And I press "Save changes" @@ -60,10 +59,9 @@ Feature: Block appearances And I follow "Test survey name" And I should not see "Comments" - @javascript Scenario: Block settings can be modified so that a block can be hidden or moved When I follow "Test book name" - And I follow "Configure Comments block" + And I configure the "Comments" block And I fill the moodle form with: | Visible | No | And I press "Save changes" @@ -72,7 +70,7 @@ Feature: Block appearances Then I should not see "Comments" And I expand "Course administration" node And I follow "Turn editing on" - And I follow "Configure Comments block" + And I configure the "Comments" block And I fill the moodle form with: | Visible | Yes | | Region | Right | diff --git a/blocks/tests/behat/restrict_available_blocks.feature b/blocks/tests/behat/restrict_available_blocks.feature index 58656a59e76..e8460f4ec24 100644 --- a/blocks/tests/behat/restrict_available_blocks.feature +++ b/blocks/tests/behat/restrict_available_blocks.feature @@ -15,7 +15,6 @@ Feature: Allowed blocks controls | user | course | role | | teacher1 | C1 | editingteacher | - @javascript Scenario: Blocks can be added with the default permissions Given I log in as "teacher1" And I follow "Course 1" diff --git a/blocks/tests/behat/return_block_original_state.feature b/blocks/tests/behat/return_block_original_state.feature index 07baab86d15..8457401dae5 100644 --- a/blocks/tests/behat/return_block_original_state.feature +++ b/blocks/tests/behat/return_block_original_state.feature @@ -4,7 +4,6 @@ Feature: The context of a block can always be returned to it's original state. As an admin I need to be able to return the block to original state - @javascript Scenario: Add and configure a block to display on every page and revert back Given the following "courses" exists: | fullname | shortname | category | @@ -15,7 +14,7 @@ Feature: The context of a block can always be returned to it's original state. And I add the "Tags" block Then I should see "Tags" in the "Tags" "block" And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element" - And I follow "Configure Tags block" + And I configure the "Tags" block And I fill the moodle form with: | Display on page types | Any page | And I press "Save changes" @@ -24,7 +23,7 @@ Feature: The context of a block can always be returned to it's original state. | Assignment name | Assignment1 | | Description | Description | And I follow "Assignment1" - And I follow "Configure Tags block" + And I configure the "Tags" block And I fill the moodle form with: | Display on page types | Any assignment module page | And I press "Save changes" @@ -39,7 +38,7 @@ Feature: The context of a block can always be returned to it's original state. | Description | Description | And I follow "Assignment2" And I should see "Tags" in the "Tags" "block" - And I follow "Configure Tags block" + And I configure the "Tags" block And I fill the moodle form with: | Display on page types | Any page | And I press "Save changes"