MDL-66979 behat: Scroll nodes into view before hover

The W3C Specification does not require that a NodeElement be in the
current viewport before triggering a mouseOver. As a result the
mouseOver will generate an Exception because the element is not in the
viewport, and the X/Y co-ordinates are invalid.

To handle this the node is scrolled into view.
This commit is contained in:
Andrew Nicols
2021-01-22 14:52:17 +08:00
parent a6512819b3
commit 45b0f89d87
+1 -1
View File
@@ -346,9 +346,9 @@ class behat_general extends behat_base {
* @param string $selectortype The type of what we look for
*/
public function i_hover($element, $selectortype) {
// Gets the node based on the requested selector type and locator.
$node = $this->get_selected_node($selectortype, $element);
$this->execute_js_on_node($node, '{{ELEMENT}}.scrollIntoView();');
$node->mouseOver();
}