MDL-52970 behat: Navigation step improvement
If navigation node to expand is a link then first click on it and navigate to next page where it is expanded, and then click on link within. This is needed as some drivers click on link and don't open the navigation node which are links
This commit is contained in:
@@ -262,7 +262,20 @@ class behat_navigation extends behat_base {
|
||||
$nodetoexpand = $node->find('xpath', $xpath);
|
||||
|
||||
$this->ensure_node_is_visible($nodetoexpand);
|
||||
$nodetoexpand->click();
|
||||
|
||||
// If node is a link then some driver click in the middle of the node, which click on link and
|
||||
// page gets redirected. To ensure expansion works in all cases, check if the node to expand is a
|
||||
// link and if yes then click on link and wait for it to navigate to next page with node expanded.
|
||||
$nodetoexpandliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($parentnodes[$i]);
|
||||
$nodetoexpandxpathlink = $xpath . "/a[normalize-space(.)=" . $nodetoexpandliteral . "]";
|
||||
|
||||
if ($nodetoexpandlink = $node->find('xpath', $nodetoexpandxpathlink)) {
|
||||
$behatgeneralcontext = behat_context_helper::get('behat_general');
|
||||
$nodetoexpandlink->click();
|
||||
$behatgeneralcontext->wait_until_the_page_is_ready();
|
||||
} else {
|
||||
$nodetoexpand->click();
|
||||
}
|
||||
|
||||
// Wait for node to load, if not loaded before.
|
||||
if ($nodetoexpand->hasAttribute('data-loaded') && $nodetoexpand->getAttribute('data-loaded') == 0) {
|
||||
|
||||
Reference in New Issue
Block a user