mirror of
https://github.com/moodle/moodle.git
synced 2025-01-16 21:18:33 +01:00
MDL-82373 behat: Stop calling ensure_node_is_visible before click
W3C WebDriver Element::Click, Element::Clear, and Element::SendKeys all state that the WebDriver implementation (chromedriver, geckodriver, edgedriver) should scroll the element into view if it is not already visible. It is wrong for us to check if the element is visible or not before calling these as it may not be but will during the click/clear/type event.
This commit is contained in:
parent
78bcf355c6
commit
32f1542b5e
@ -645,7 +645,6 @@ trait behat_session_trait {
|
||||
* @return void Throws an exception if it times out without the element being visible
|
||||
*/
|
||||
protected function ensure_node_is_visible($node) {
|
||||
|
||||
if (!$this->running_javascript()) {
|
||||
return;
|
||||
}
|
||||
@ -715,7 +714,6 @@ trait behat_session_trait {
|
||||
* @return NodeElement Throws an exception if it times out without being visible
|
||||
*/
|
||||
protected function ensure_element_is_visible($element, $selectortype) {
|
||||
|
||||
if (!$this->running_javascript()) {
|
||||
return;
|
||||
}
|
||||
|
@ -62,7 +62,6 @@ class behat_action_menu extends behat_base {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
@ -87,7 +86,6 @@ class behat_action_menu extends behat_base {
|
||||
// Gets the node based on the requested selector type and locator.
|
||||
$menuselector = ".moodle-actionmenu .dropdown.show .dropdown-menu";
|
||||
$node = $this->get_node_in_container("link", trim($menuitem), "css_element", $menuselector);
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
|
@ -777,7 +777,6 @@ class behat_forms extends behat_base {
|
||||
public function i_expand_the_autocomplete($field) {
|
||||
$csstarget = '.form-autocomplete-downarrow';
|
||||
$node = $this->get_node_in_container('css_element', $csstarget, 'form_row', $field);
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
|
@ -286,9 +286,7 @@ class behat_general extends behat_base {
|
||||
* @param string $link
|
||||
*/
|
||||
public function click_link($link) {
|
||||
|
||||
$linknode = $this->find_link($link);
|
||||
$this->ensure_node_is_visible($linknode);
|
||||
$linknode->click();
|
||||
}
|
||||
|
||||
@ -393,11 +391,8 @@ class behat_general extends behat_base {
|
||||
* @param string $selectortype The type of what we look for
|
||||
*/
|
||||
public function i_click_on($element, $selectortype) {
|
||||
|
||||
// Gets the node based on the requested selector type and locator.
|
||||
$node = $this->get_selected_node($selectortype, $element);
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
$this->get_selected_node($selectortype, $element)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -458,9 +453,7 @@ class behat_general extends behat_base {
|
||||
* @param string $nodeselectortype The type of selector where we look in
|
||||
*/
|
||||
public function i_click_on_in_the($element, $selectortype, $nodeelement, $nodeselectortype) {
|
||||
|
||||
$node = $this->get_node_in_container($selectortype, $element, $nodeselectortype, $nodeelement);
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
@ -502,7 +495,6 @@ class behat_general extends behat_base {
|
||||
}
|
||||
|
||||
$node = $this->get_node_in_container($selectortype, $element, $nodeselectortype, $nodeelement);
|
||||
$this->ensure_node_is_visible($node);
|
||||
|
||||
// KeyUP and KeyDown require the element to be displayed in the current window.
|
||||
$this->execute_js_on_node($node, '{{ELEMENT}}.scrollIntoView();');
|
||||
|
@ -626,7 +626,6 @@ class behat_mod_quiz extends behat_question_base {
|
||||
public function i_click_on_shuffle_for_section($heading) {
|
||||
$xpath = $this->get_xpath_for_shuffle_checkbox($heading);
|
||||
$checkbox = $this->find('xpath', $xpath);
|
||||
$this->ensure_node_is_visible($checkbox);
|
||||
$checkbox->click();
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,6 @@ class behat_filepicker extends behat_base {
|
||||
}
|
||||
|
||||
$selectfilebutton = $this->find_button(get_string('getfile', 'repository'));
|
||||
$this->ensure_node_is_visible($selectfilebutton);
|
||||
$selectfilebutton->click();
|
||||
|
||||
// We wait for all the JS to finish as it is performing an action.
|
||||
@ -297,7 +296,6 @@ class behat_filepicker extends behat_base {
|
||||
|
||||
if ($overwriteaction !== false) {
|
||||
$overwritebutton = $this->find_button($overwriteaction);
|
||||
$this->ensure_node_is_visible($overwritebutton);
|
||||
$overwritebutton->click();
|
||||
|
||||
// We wait for all the JS to finish.
|
||||
|
@ -175,7 +175,6 @@ class behat_repository_upload extends behat_base {
|
||||
|
||||
if ($overwriteaction !== false) {
|
||||
$overwritebutton = $this->find_button($overwriteaction);
|
||||
$this->ensure_node_is_visible($overwritebutton);
|
||||
$overwritebutton->click();
|
||||
|
||||
// We wait for all the JS to finish.
|
||||
|
Loading…
x
Reference in New Issue
Block a user