Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-02-20 08:57:10 +01:00
commit acfc301b51
6 changed files with 37 additions and 34 deletions

View File

@ -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;
}
}
?>
?>

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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."));
}
}
?>

View File

@ -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;

View File

@ -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!");
}
}
?>
?>