MDL-41030 behat: Dock blocks compatible with both selenium and phantomjs
This commit is contained in:
@@ -39,7 +39,7 @@ Feature: Page contents assertions
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I follow "Course 1"
|
||||
When I click on "Move this to the dock" "button" in the "Administration" "block"
|
||||
When I dock "Administration" block
|
||||
Then I should not see "Question bank" in the "region-pre" "region"
|
||||
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
|
||||
|
||||
@@ -49,5 +49,5 @@ Feature: Page contents assertions
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
When I click on "Move this to the dock" "button" in the "Administration" "block"
|
||||
When I dock "Administration" block
|
||||
Then I should not see "Turn editing on" in the "region-pre" "region"
|
||||
|
||||
@@ -58,6 +58,20 @@ class behat_blocks extends behat_base {
|
||||
return $steps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Docks a block. Editing mode should be previously enabled.
|
||||
*
|
||||
* @Given /^I dock "(?P<block_name_string>(?:[^"]|\\")*)" block$/
|
||||
* @param string $blockname
|
||||
* @return Given
|
||||
*/
|
||||
public function i_dock_block($blockname) {
|
||||
|
||||
// Looking for both title and alt.
|
||||
$xpath = "//input[@type='image'][@title='" . get_string('dockblock', 'block', $blockname) . "' or @alt='" . get_string('addtodock', 'block') . "']";
|
||||
return new Given('I click on " ' . $xpath . '" "xpath_element" in the "' . $this->escape($blockname) . '" "block"');
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a block's actions menu if it is not already opened.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user