Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Feb 20, 2013
2 parents 0831c64 + 885a571 commit acfc301
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 34 deletions.
7 changes: 3 additions & 4 deletions test/AllSeleniumTests.php
Expand Up @@ -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()
Expand All @@ -27,7 +26,7 @@ public static function main()

public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('phpMyAdmin');
$suite = new PHPUnit_Extensions_SeleniumTestSuite('phpMyAdmin');

$suite->addTestSuite('PmaSeleniumLoginTest');
$suite->addTestSuite('PmaSeleniumXssTest');
Expand All @@ -36,4 +35,4 @@ public static function suite()
return $suite;
}
}
?>
?>
3 changes: 1 addition & 2 deletions test/selenium/Helper.php
Expand Up @@ -26,8 +26,7 @@ public static function isLoggedIn($selenium)
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");
}
}

Expand Down
22 changes: 10 additions & 12 deletions test/selenium/PmaSeleniumCreateDropDatabaseTest.php
Expand Up @@ -22,20 +22,18 @@ public function setUp()
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");
}
}
31 changes: 20 additions & 11 deletions test/selenium/PmaSeleniumPrivilegesTest.php
Expand Up @@ -22,34 +22,43 @@ 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");
$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."));
}
}

?>
3 changes: 1 addition & 2 deletions test/selenium/PmaSeleniumTestCase.php
Expand Up @@ -60,8 +60,7 @@ public function isSuccessLogin()
*/
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;
Expand Down
5 changes: 2 additions & 3 deletions test/selenium/PmaSeleniumXssTest.php
Expand Up @@ -22,11 +22,10 @@ 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->waitForElementPresent("id=queryboxf");
$this->click("button_submit_query");
$this->assertAlert("Missing value in the form!");
}
}
?>
?>

0 comments on commit acfc301

Please sign in to comment.