mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-57168 behat: Ensure drawer is open before clicking the link
This commit is contained in:
parent
3eabedbb92
commit
3df6e801b5
@ -573,6 +573,41 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the provided node has a attribute value set. This step can be used to check if specific
|
||||
* JS has finished modifying the node.
|
||||
*
|
||||
* @throws ExpectationException
|
||||
* @param NodeElement $node
|
||||
* @param string $attribute attribute name
|
||||
* @param string $attributevalue attribute value to check.
|
||||
* @return void Throws an exception if it times out without the element being visible
|
||||
*/
|
||||
protected function ensure_node_attribute_is_set($node, $attribute, $attributevalue) {
|
||||
|
||||
if (!$this->running_javascript()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Exception if it timesout and the element is still there.
|
||||
$msg = 'The "' . $node->getXPath() . '" xpath node is not visible and it should be visible';
|
||||
$exception = new ExpectationException($msg, $this->getSession());
|
||||
|
||||
// It will stop spinning once the $args[1]) == $args[2], and method returns true.
|
||||
$this->spin(
|
||||
function($context, $args) {
|
||||
if ($args[0]->getAttribute($args[1]) == $args[2]) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
array($node, $attribute, $attributevalue),
|
||||
self::EXTENDED_TIMEOUT,
|
||||
$exception,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the provided element is visible and we can interact with it.
|
||||
*
|
||||
|
@ -11,6 +11,19 @@ body.behat-site {
|
||||
.dropdown-item {
|
||||
margin-top: 4px !important; /* stylelint-disable declaration-no-important */
|
||||
}
|
||||
|
||||
// Remove following after MDL-57172 is fixed.
|
||||
&.drawer-ease {
|
||||
-webkit-transition: initial;
|
||||
-moz-transition: initial;
|
||||
transition: initial;
|
||||
}
|
||||
|
||||
[data-region="drawer"] {
|
||||
-webkit-transition: initial;
|
||||
-moz-transition: initial;
|
||||
transition: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.phpinfo table,
|
||||
|
@ -93,6 +93,7 @@ class behat_theme_boost_behat_navigation extends behat_navigation {
|
||||
$expanded = $node->getAttribute('aria-expanded');
|
||||
if ($expanded === 'false') {
|
||||
$node->click();
|
||||
$this->ensure_node_attribute_is_set($node, 'aria-expanded', 'true');
|
||||
$this->wait_for_pending_js();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user