diff --git a/test/AllSeleniumTests.php b/test/AllSeleniumTests.php index 89e83c64a7..8efb1d9b5c 100644 --- a/test/AllSeleniumTests.php +++ b/test/AllSeleniumTests.php @@ -30,8 +30,8 @@ class AllSeleniumTests $suite = new PHPUnit_Framework_TestSuite('phpMyAdmin'); $suite->addTestSuite('PmaSeleniumLoginTest'); - //$suite->addTestSuite('PmaSeleniumXssTest'); - //$suite->addTestSuite('PmaSeleniumPrivilegesTest'); + $suite->addTestSuite('PmaSeleniumXssTest'); + $suite->addTestSuite('PmaSeleniumPrivilegesTest'); return $suite; } } diff --git a/test/selenium/PmaSeleniumPrivilegesTest.php b/test/selenium/PmaSeleniumPrivilegesTest.php index 9ef5cc65b2..92fb890915 100644 --- a/test/selenium/PmaSeleniumPrivilegesTest.php +++ b/test/selenium/PmaSeleniumPrivilegesTest.php @@ -1,4 +1,5 @@ setBrowser(Helper::getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + } + + public function testChangePassword() { + $log = new PmaSeleniumTestCase($this); + $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + $this->selectFrame("frame_content"); + $this->click("link=Change password"); + $this->waitForPageToLoad("20000"); + try { + $this->assertEquals("", $this->getValue("text_pma_pw")); + } catch (PHPUnit_Framework_AssertionFailedError $e) { + array_push($this->verificationErrors, $e->toString()); + } + try { + $this->assertEquals("", $this->getValue("text_pma_pw2")); + } catch (PHPUnit_Framework_AssertionFailedError $e) { + array_push($this->verificationErrors, $e->toString()); + } + try { + $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->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("")); + + } -class PmaSeleniumPrivilegesTest extends PmaSeleniumTestCase -{ - public function testChangePassword() - { - $this->doLogin(); - $this->selectFrame("frame_content"); - $this->click("link=Change password"); - $this->waitForPageToLoad("30000"); - try { - $this->assertEquals("", $this->getValue("text_pma_pw")); - } catch (PHPUnit_Framework_AssertionFailedError $e) { - array_push($this->verificationErrors, $e->toString()); - } - try { - $this->assertEquals("", $this->getValue("text_pma_pw2")); - } catch (PHPUnit_Framework_AssertionFailedError $e) { - array_push($this->verificationErrors, $e->toString()); - } - try { - $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->type("text_pma_pw", $this->cfg['Test']['testuser']['password']); - $this->type("text_pma_pw2", $this->cfg['Test']['testuser']['password']); - $this->click("change_pw"); - $this->waitForPageToLoad("30000"); - $this->assertTrue($this->isTextPresent("")); - $this->assertTrue($this->isTextPresent("")); - } } + ?> diff --git a/test/selenium/PmaSeleniumXssTest.php b/test/selenium/PmaSeleniumXssTest.php index f0771a1724..62ba65a945 100644 --- a/test/selenium/PmaSeleniumXssTest.php +++ b/test/selenium/PmaSeleniumXssTest.php @@ -1,4 +1,5 @@ setBrowser(Helper::getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + } + + public function testQueryTabWithNullValue() { + $log = new PmaSeleniumTestCase($this); + $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + $this->selectFrame("frame_content"); + $this->click("link=SQL"); + $this->waitForPageToLoad("30000"); + $this->click("button_submit_query"); + $this->assertAlert("Missing value in the form!"); + } -class PmaSeleniumXSSTest extends PmaSeleniumTestCase -{ - public function testXssQueryTab() - { - $this->doLogin(); - $this->selectFrame("frame_content"); - $this->click("link=SQL"); - $this->waitForPageToLoad("30000"); - $this->type("sqlquery", "'\">"); - $this->click("SQL"); - // If an alert pops up the test fails, since we don't handle an alert. - } } + ?>