From ddf36bf5aa0c57e813b422eb57dd1a49a31b0c44 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 19 Jul 2016 09:23:44 +0800 Subject: [PATCH] MDL-55258 behat: Set focus on button before clicking it Set the focus on button to ensure it is in viewport before clicking on it. --- lib/tests/behat/behat_forms.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 23459628364..d681d2ccfbf 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -54,6 +54,10 @@ class behat_forms extends behat_base { // Ensures the button is present. $buttonnode = $this->find_button($button); + // Focus on button to ensure it is in viewport, before pressing it. + if ($this->running_javascript()) { + $buttonnode->focus(); + } $buttonnode->press(); }