From 5f32194b4f8a63e0b42470507b66285a0e3f2435 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Fri, 23 Jan 2015 15:16:09 +0530 Subject: [PATCH 1/4] Select by Id rather than text Signed-off-by: Madhura Jayaratne --- libraries/server_privileges.lib.php | 6 +++--- test/selenium/PmaSeleniumCreateRemoveUserTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 5f08ea40e3..18938ace83 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -2684,7 +2684,7 @@ function PMA_getHtmlForUserRights($db_rights, $dbname, ) { $html_output = ''; $found_rows = array(); - + // display rows if (count($db_rights) < 1) { $html_output .= '' . "\n" @@ -3813,12 +3813,12 @@ function PMA_getAddUserHtmlFieldset($db = '', $table = '') return '
' . "\n" . '' . _pgettext('Create new user', 'New') . '' - . '' . "\n" + . '>' . "\n" . PMA_Util::getIcon('b_usradd.png') . ' ' . __('Add user') . '' . "\n" . '
' . "\n"; diff --git a/test/selenium/PmaSeleniumCreateRemoveUserTest.php b/test/selenium/PmaSeleniumCreateRemoveUserTest.php index f13be74c4f..089ecee0a0 100644 --- a/test/selenium/PmaSeleniumCreateRemoveUserTest.php +++ b/test/selenium/PmaSeleniumCreateRemoveUserTest.php @@ -59,7 +59,7 @@ class PMA_SeleniumCreateRemoveUserTest extends PMA_SeleniumBase $this->login(); $this->waitForElement('byLinkText', "Users")->click(); - $link = $this->waitForElement("byLinkText", "Add user"); + $link = $this->waitForElement("byId", "add_user_anchor"); $link->click(); $userField = $this->waitForElement("byName", "username"); From bdf3ae8445460cf8eff3c7e9431f32cfa007c5d7 Mon Sep 17 00:00:00 2001 From: Deven Bhooshan Date: Fri, 23 Jan 2015 15:18:05 +0530 Subject: [PATCH 2/4] Alert happens only after submitting Signed-off-by: Madhura Jayaratne --- test/selenium/PmaSeleniumCreateRemoveUserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/selenium/PmaSeleniumCreateRemoveUserTest.php b/test/selenium/PmaSeleniumCreateRemoveUserTest.php index 089ecee0a0..49184a6eaf 100644 --- a/test/selenium/PmaSeleniumCreateRemoveUserTest.php +++ b/test/selenium/PmaSeleniumCreateRemoveUserTest.php @@ -92,8 +92,8 @@ class PMA_SeleniumCreateRemoveUserTest extends PMA_SeleniumBase )->click(); $this->byId("checkbox_drop_users_db")->click(); - $this->acceptAlert(); $this->byId("buttonGo")->click(); + $this->acceptAlert(); $success = $this->waitForElement("byCssSelector", "div.success"); $this->assertContains( From 8e49e0ba4329b86f391ac26b95f627df0ea2cd5f Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Fri, 23 Jan 2015 15:34:26 +0530 Subject: [PATCH 3/4] Add classes to buttons in confirmation dialog Signed-off-by: Madhura Jayaratne --- js/functions.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/js/functions.js b/js/functions.js index 11640867de..a2dde56406 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2410,17 +2410,25 @@ jQuery.fn.PMA_confirm = function (question, url, callbackFn) { * @var button_options Object that stores the options passed to jQueryUI * dialog */ - var button_options = {}; - button_options[PMA_messages.strOK] = function () { - $(this).dialog("close"); - - if ($.isFunction(callbackFn)) { - callbackFn.call(this, url); + var button_options = [ + { + text: PMA_messages.strOK, + 'class': 'submitOK', + click: function () { + $(this).dialog("close"); + if ($.isFunction(callbackFn)) { + callbackFn.call(this, url); + } + } + }, + { + text: PMA_messages.strCancel, + 'class': 'submitCancel', + click: function () { + $(this).dialog("close"); + } } - }; - button_options[PMA_messages.strCancel] = function () { - $(this).dialog("close"); - }; + ]; $('
', {'id': 'confirm_dialog'}) .prepend(question) From 6cc36bd9e4d0b01488a38696fbf6a6e4819206b5 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Fri, 23 Jan 2015 15:34:59 +0530 Subject: [PATCH 4/4] Click OK on confirm dialog Signed-off-by: Madhura Jayaratne --- test/selenium/PmaSeleniumCreateRemoveUserTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/selenium/PmaSeleniumCreateRemoveUserTest.php b/test/selenium/PmaSeleniumCreateRemoveUserTest.php index 49184a6eaf..629606e87a 100644 --- a/test/selenium/PmaSeleniumCreateRemoveUserTest.php +++ b/test/selenium/PmaSeleniumCreateRemoveUserTest.php @@ -93,6 +93,7 @@ class PMA_SeleniumCreateRemoveUserTest extends PMA_SeleniumBase $this->byId("checkbox_drop_users_db")->click(); $this->byId("buttonGo")->click(); + $this->waitForElement("byCssSelector", "button.confirmOK")->click(); $this->acceptAlert(); $success = $this->waitForElement("byCssSelector", "div.success");