diff --git a/test/AllSeleniumTests.php b/test/AllSeleniumTests.php index e1b6982a89..c9a27c3772 100644 --- a/test/AllSeleniumTests.php +++ b/test/AllSeleniumTests.php @@ -10,13 +10,12 @@ /** * */ -require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; require_once dirname(__FILE__).'/selenium/PmaSeleniumTestCase.php'; 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'; class AllSeleniumTests { public static function main() @@ -27,7 +26,7 @@ class AllSeleniumTests public static function suite() { - $suite = new PHPUnit_Framework_TestSuite('phpMyAdmin'); + $suite = new PHPUnit_Extensions_SeleniumTestSuite('phpMyAdmin'); $suite->addTestSuite('PmaSeleniumLoginTest'); $suite->addTestSuite('PmaSeleniumXssTest'); @@ -36,4 +35,4 @@ class AllSeleniumTests return $suite; } } -?> +?> \ No newline at end of file diff --git a/test/selenium/Helper.php b/test/selenium/Helper.php index 4146690f41..5d7058e897 100644 --- a/test/selenium/Helper.php +++ b/test/selenium/Helper.php @@ -26,8 +26,7 @@ class Helper public static function logOutIfLoggedIn($selenium) { if (self::isLoggedIn($selenium)) { - $selenium->selectFrame("frame_navigation"); - $selenium->clickAndWait("css=img.icon.ic_b_home"); + $selenium->clickAndWait("css=img.icon.ic_s_loggoff"); } } diff --git a/test/selenium/PmaSeleniumCreateDropDatabaseTest.php b/test/selenium/PmaSeleniumCreateDropDatabaseTest.php index d408158c39..fc4c847504 100644 --- a/test/selenium/PmaSeleniumCreateDropDatabaseTest.php +++ b/test/selenium/PmaSeleniumCreateDropDatabaseTest.php @@ -22,20 +22,18 @@ class PmaSeleniumCreateDropDatabaseTest extends PHPUnit_Extensions_SeleniumTestC public function testCreateDropDatabase() { $log = new PmaSeleniumTestCase($this); + $dbname = "pma_testdb".time(); $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); - $this->selectFrame("frame_content"); $this->click("link=Databases"); - $this->waitForPageToLoad("30000"); - $this->type("id=text_create_db", "pma"); + $this->waitForElementPresent("id=text_create_db"); + $this->type("id=text_create_db", $dbname); $this->click("id=buttonGo"); - $this->assertTrue($this->isTextPresent("pma")); - - $this->click("link=pma"); - $this->waitForPageToLoad("30000"); - $this->click("link=Operations"); - $this->waitForPageToLoad("30000"); - $this->click("id=drop_db_anchor"); - $this->click("//button[@type='button']"); - + $this->waitForElementPresent("css=span.ajax_notification"); + $this->assertElementPresent("css=span.ajax_notification div.success"); + $this->click("xpath=(//input[@name='selected_dbs[]'])[@value='".$dbname."']"); + $this->click("css=button.mult_submit.ajax"); + $this->click("css=button:contains('OK')"); + $this->waitForElementPresent("css=span.ajax_notification"); + $this->assertElementPresent("css=span.ajax_notification div.success"); } } diff --git a/test/selenium/PmaSeleniumPrivilegesTest.php b/test/selenium/PmaSeleniumPrivilegesTest.php index 331b329c7e..40f45e3435 100644 --- a/test/selenium/PmaSeleniumPrivilegesTest.php +++ b/test/selenium/PmaSeleniumPrivilegesTest.php @@ -22,34 +22,43 @@ class PmaSeleniumPrivilegesTest extends PHPUnit_Extensions_SeleniumTestCase { $log = new PmaSeleniumTestCase($this); $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); - $this->selectFrame("frame_content"); $this->click("link=Change password"); - $this->waitForPageToLoad("20000"); + $this->waitForElementPresent("id=change_password_anchor"); try { + $this->waitForElementPresent("id=text_pma_pw"); $this->assertEquals("", $this->getValue("text_pma_pw")); } catch (PHPUnit_Framework_AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } try { + $this->waitForElementPresent("id=text_pma_pw2"); $this->assertEquals("", $this->getValue("text_pma_pw2")); } catch (PHPUnit_Framework_AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } try { + $this->waitForElementPresent("id=generated_pw"); $this->assertEquals("", $this->getValue("generated_pw")); } catch (PHPUnit_Framework_AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } - $this->click("button_generate_password"); - $this->assertNotEquals("", $this->getValue("text_pma_pw")); - $this->assertNotEquals("", $this->getValue("text_pma_pw2")); - $this->assertNotEquals("", $this->getValue("generated_pw")); + $this->click("button_generate_password"); + $this->assertNotEquals("", $this->getValue("text_pma_pw")); + $this->assertNotEquals("", $this->getValue("text_pma_pw2")); + $this->assertNotEquals("", $this->getValue("generated_pw")); + + if (TESTSUITE_PASSWORD != "") { $this->type("text_pma_pw", TESTSUITE_PASSWORD); $this->type("text_pma_pw2", TESTSUITE_PASSWORD); - $this->click("//button[@type='button']"); - $this->waitForPageToLoad("20000"); - $this->assertTrue($this->isTextPresent("")); - $this->assertTrue($this->isTextPresent("")); - } + $this->click("css=button:contains('Go')"); + } else { + $this->click("id=nopass_1"); + $this->click("css=button:contains('Go')"); + } + + $this->waitForElementPresent("id=result_query"); + $this->assertTrue($this->isTextPresent("The profile has been updated.")); + } } + ?> diff --git a/test/selenium/PmaSeleniumTestCase.php b/test/selenium/PmaSeleniumTestCase.php index 8f6ccbee23..1a822b732f 100644 --- a/test/selenium/PmaSeleniumTestCase.php +++ b/test/selenium/PmaSeleniumTestCase.php @@ -60,8 +60,7 @@ class PmaSeleniumTestCase */ public function isUnsuccessLogin() { - $val = $this->_selenium->getValue('input_go'); - if ($this->_selenium->isElementPresent("//html/body/div/div[@class='error']")) { + if ($this->_selenium->isElementPresent("css=div.error")) { return true; } else { return false; diff --git a/test/selenium/PmaSeleniumXssTest.php b/test/selenium/PmaSeleniumXssTest.php index 899700b1c2..f27aaca45d 100644 --- a/test/selenium/PmaSeleniumXssTest.php +++ b/test/selenium/PmaSeleniumXssTest.php @@ -22,11 +22,10 @@ class PmaSeleniumXSSTest extends PHPUnit_Extensions_SeleniumTestCase { $log = new PmaSeleniumTestCase($this); $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); - $this->selectFrame("frame_content"); $this->click("link=SQL"); - $this->waitForPageToLoad("30000"); + $this->waitForElementPresent("id=queryboxf"); $this->click("button_submit_query"); $this->assertAlert("Missing value in the form!"); } } -?> +?> \ No newline at end of file