From c97b00e190de79b2f1c4db45761bdae7cb25aeb1 Mon Sep 17 00:00:00 2001 From: Spun Nakandala Date: Fri, 22 Feb 2013 12:23:51 +0530 Subject: [PATCH] Selenium Test added to test the creation and removal of a user with all privileges --- test/AllSeleniumTests.php | 2 + .../PmaSeleniumCreateRemoveUserTest.php | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 test/selenium/PmaSeleniumCreateRemoveUserTest.php diff --git a/test/AllSeleniumTests.php b/test/AllSeleniumTests.php index c9a27c3772..71401068bb 100644 --- a/test/AllSeleniumTests.php +++ b/test/AllSeleniumTests.php @@ -16,6 +16,7 @@ require_once dirname(__FILE__).'/selenium/PmaSeleniumLoginTest.php'; require_once dirname(__FILE__).'/selenium/PmaSeleniumXssTest.php'; require_once dirname(__FILE__).'/selenium/PmaSeleniumPrivilegesTest.php'; require_once dirname(__FILE__).'/selenium/PmaSeleniumCreateDropDatabaseTest.php'; +require_once dirname(__FILE__).'/selenium/PmaSeleniumCreateRemoveUserTest.php'; class AllSeleniumTests { public static function main() @@ -32,6 +33,7 @@ class AllSeleniumTests $suite->addTestSuite('PmaSeleniumXssTest'); $suite->addTestSuite('PmaSeleniumPrivilegesTest'); $suite->addTestSuite('PmaSeleniumCreateDropDatabaseTest'); + $suite->addTestSuite('PmaSeleniumCreateRemoveUserTest'); return $suite; } } diff --git a/test/selenium/PmaSeleniumCreateRemoveUserTest.php b/test/selenium/PmaSeleniumCreateRemoveUserTest.php new file mode 100644 index 0000000000..45f14f1f83 --- /dev/null +++ b/test/selenium/PmaSeleniumCreateRemoveUserTest.php @@ -0,0 +1,60 @@ +setBrowser(Helper::getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + $this->_txtUsername = 'pma_user'; + $this->_txtPassword = 'abc_123'; + } + + public function testCreateRemoveUser() + { + $log = new PmaSeleniumTestCase($this); + $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + $this->click("link=Users"); + $this->waitForElementPresent("fieldset_add_user"); + $this->click("link=Add user"); + $this->waitForElementPresent("fieldset_add_user_login"); + $this->type("name=username", $this->_txtUsername); + $this->select("id=select_pred_hostname", "label=Local"); + $this->click("id=button_generate_password"); + $this->assertNotEquals("", $this->getValue("text_pma_pw")); + $this->assertNotEquals("", $this->getValue("text_pma_pw2")); + $this->assertNotEquals("", $this->getValue("generated_pw")); + $this->type("id=text_pma_pw", $this->_txtPassword); + $this->type("id=text_pma_pw2", $this->_txtPassword); + $this->waitForElementPresent("fieldset_add_user_database"); + $this->click("id=createdb-1"); + $this->click("id=createdb-2"); + $this->waitForElementPresent("fieldset_user_global_rights"); + $this->click("link=Check All"); + $this->waitForElementPresent("fieldset_add_user_footer"); + $this->click("name=adduser_submit"); + $this->waitForElementPresent("css=span.ajax_notification"); + $this->assertElementPresent("css=span.ajax_notification div.success"); + $this->waitForElementPresent("usersForm"); + $temp = $this->_txtUsername."localhost"; + $this->click("xpath=(//input[@name='selected_usr[]'])[@value='".$temp."']"); + $this->click("id=checkbox_drop_users_db"); + $this->getConfirmation(); + $this->click("id=buttonGo"); + $this->waitForElementPresent("css=span.ajax_notification"); + $this->assertElementPresent("css=span.ajax_notification div.success"); + } +}