From b3502be32095b1f4acfdf74c3e892201061cd4f0 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 23 Nov 2016 09:07:26 +0800 Subject: [PATCH] MDL-56898 behat: Ensure we have button in viewport and page is stable --- admin/tool/behat/tests/behat/manipulate_forms.feature | 1 + auth/tests/behat/behat_auth.php | 4 ++++ enrol/tests/behat/behat_enrol.php | 3 +++ 3 files changed, 8 insertions(+) diff --git a/admin/tool/behat/tests/behat/manipulate_forms.feature b/admin/tool/behat/tests/behat/manipulate_forms.feature index ed978997e4a..a26fd203efd 100644 --- a/admin/tool/behat/tests/behat/manipulate_forms.feature +++ b/admin/tool/behat/tests/behat/manipulate_forms.feature @@ -15,6 +15,7 @@ Feature: Forms manipulation Then the field "First name" matches value "Field value" And the "Select a country" select box should contain "Japan" And the field "New password" matches value "TestPass" + And I take focus off "Update profile" "button" And I press "Update profile" @javascript diff --git a/auth/tests/behat/behat_auth.php b/auth/tests/behat/behat_auth.php index 685503cca70..27ebd411dff 100644 --- a/auth/tests/behat/behat_auth.php +++ b/auth/tests/behat/behat_auth.php @@ -61,6 +61,10 @@ class behat_auth extends behat_base { * @Given /^I log out$/ */ public function i_log_out() { + + // Wait for page to be loaded. + $this->wait_for_pending_js(); + // Click on logout link in footer, as it's much faster. $this->execute('behat_general::i_click_on_in_the', array(get_string('logout'), 'link', '#page-footer', "css_element")); } diff --git a/enrol/tests/behat/behat_enrol.php b/enrol/tests/behat/behat_enrol.php index 281843018b8..6218b31b8dd 100644 --- a/enrol/tests/behat/behat_enrol.php +++ b/enrol/tests/behat/behat_enrol.php @@ -64,6 +64,9 @@ class behat_enrol extends behat_base { // Set form fields. $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $table); + // Ensure we get button in focus, before pressing button. + $this->execute("behat_general::i_take_focus_off_field", array(get_string('addinstance', 'enrol'), "button")); + // Save changes. $this->execute("behat_forms::press_button", get_string('addinstance', 'enrol'));