Merge pull request #13476 from devenbansod/fix_selenium_tests_1
Fix more selenium tests
This commit is contained in:
commit
eac003d957
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Selenium TestCase for privilege related tests
|
||||
* Selenium TestCase for change password related tests
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
* @subpackage Selenium
|
||||
@ -16,7 +16,7 @@ require_once 'TestBase.php';
|
||||
* @subpackage Selenium
|
||||
* @group selenium
|
||||
*/
|
||||
class PMA_SeleniumPrivilegesTest extends PMA_SeleniumBase
|
||||
class PMA_SeleniumChangePasswordTest extends PMA_SeleniumBase
|
||||
{
|
||||
/**
|
||||
* Tests the changing of the password
|
||||
@ -28,42 +28,46 @@ class PMA_SeleniumPrivilegesTest extends PMA_SeleniumBase
|
||||
public function testChangePassword()
|
||||
{
|
||||
$this->login();
|
||||
$this->waitForElement('byLinkText', "Change password")->click();
|
||||
|
||||
$e = $this->waitForElement("byId", "change_password_anchor");
|
||||
$e->click();
|
||||
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement('byXpath', "//span[contains(., 'Change password')]");
|
||||
try {
|
||||
$ele = $this->waitForElement("byId", "text_pma_pw");
|
||||
$ele = $this->waitForElement("byName", "pma_pw");
|
||||
$this->assertEquals("", $ele->value());
|
||||
} catch (PHPUnit_Framework_AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
}
|
||||
try {
|
||||
$ele = $this->waitForElement("byId", "text_pma_pw2");
|
||||
$ele = $this->waitForElement("byName", "pma_pw2");
|
||||
$this->assertEquals("", $ele->value());
|
||||
} catch (PHPUnit_Framework_AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
}
|
||||
try {
|
||||
$ele = $this->waitForElement("byId", "generated_pw");
|
||||
$ele = $this->waitForElement("byName", "generated_pw");
|
||||
$this->assertEquals("", $ele->value());
|
||||
} catch (PHPUnit_Framework_AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
}
|
||||
$this->byId("button_generate_password")->click();
|
||||
$this->assertNotEquals("", $this->byId("text_pma_pw")->value());
|
||||
$this->assertNotEquals("", $this->byId("text_pma_pw2")->value());
|
||||
$this->assertNotEquals("", $this->byId("generated_pw")->value());
|
||||
$this->assertNotEquals("", $this->byName("pma_pw")->value());
|
||||
$this->assertNotEquals("", $this->byName("pma_pw2")->value());
|
||||
$this->assertNotEquals("", $this->byName("generated_pw")->value());
|
||||
|
||||
if ($GLOBALS['TESTSUITE_PASSWORD'] != "") {
|
||||
$this->byId("text_pma_pw")->clear();
|
||||
$this->byId("text_pma_pw2")->clear();
|
||||
$this->byId("text_pma_pw")->value($GLOBALS['TESTSUITE_PASSWORD']);
|
||||
$this->byId("text_pma_pw2")->value($GLOBALS['TESTSUITE_PASSWORD']);
|
||||
$this->byName("pma_pw")->clear();
|
||||
$this->byName("pma_pw2")->clear();
|
||||
$this->byName("pma_pw")->value($GLOBALS['TESTSUITE_PASSWORD']);
|
||||
$this->byName("pma_pw2")->value($GLOBALS['TESTSUITE_PASSWORD']);
|
||||
} else {
|
||||
$this->byId("nopass_1")->click();
|
||||
}
|
||||
|
||||
$this->byCssSelector("span.ui-button-text:nth-child(1)")->click();
|
||||
$this->byXpath("//button[contains(., 'Go')]")->click();
|
||||
$ele = $this->waitForElement("byCssSelector", "div.success");
|
||||
$this->assertEquals(
|
||||
"The profile has been updated.",
|
||||
@ -18,6 +18,11 @@ require_once 'TestBase.php';
|
||||
*/
|
||||
class PMA_SeleniumLoginTest extends PMA_SeleniumBase
|
||||
{
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
$this->logOutIfLoggedIn();
|
||||
}
|
||||
/**
|
||||
* Test for successful login
|
||||
*
|
||||
@ -27,7 +32,6 @@ class PMA_SeleniumLoginTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testSuccessfulLogin()
|
||||
{
|
||||
$this->logOutIfLoggedIn();
|
||||
$this->login();
|
||||
$this->waitForElement("byXPath", "//*[@id=\"serverinfo\"]");
|
||||
$this->assertTrue($this->isSuccessLogin());
|
||||
@ -43,7 +47,6 @@ class PMA_SeleniumLoginTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testLoginWithWrongPassword()
|
||||
{
|
||||
$this->logOutIfLoggedIn();
|
||||
$this->login("Admin", "Admin");
|
||||
$this->waitForElement("byCssSelector", "div.error");
|
||||
$this->assertTrue($this->isUnsuccessLogin());
|
||||
|
||||
@ -43,14 +43,19 @@ class PMA_SeleniumNormalizationTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->navigateTable('test_table');
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"(//a[contains(., 'Structure')])"
|
||||
)->click();
|
||||
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
|
||||
$this->waitForElement("byId", "tablestructure");
|
||||
$this->byLinkText('Improve table structure')->click();
|
||||
$this->byPartialLinkText('Normalize')->click();
|
||||
$this->waitForElement("byId", "normalizeTable");
|
||||
}
|
||||
|
||||
|
||||
@ -25,9 +25,13 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->expandMore();
|
||||
$this->waitForElement("byLinkText", "Settings")->click();
|
||||
$this->waitForElement("byPartialLinkText", "Settings")->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath", "//a[@class='tabactive' and contains(., 'Settings')]"
|
||||
);
|
||||
@ -41,8 +45,16 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
private function _saveConfig()
|
||||
{
|
||||
$this->byName("submit_save")->click();
|
||||
$this->sleep();
|
||||
// Submit the form
|
||||
$ele = $this->waitForElement(
|
||||
'byXPath',
|
||||
"//fieldset[not(contains(@style,'display: none;'))]//input[@value='Apply']"
|
||||
);
|
||||
$this->scrollToBottom();
|
||||
$this->moveto($ele);
|
||||
$ele->click();
|
||||
|
||||
usleep(1000000);
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//div[@class='success' and contains(., 'Configuration has been saved')]"
|
||||
@ -58,13 +70,15 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testHideDatabase()
|
||||
{
|
||||
/* FIXME: This test fails even though it is same as testHideLogo */
|
||||
$this->markTestIncomplete('Currently broken');
|
||||
$this->byPartialLinkText("Features")->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
$this->byLinkText("Features")->click();
|
||||
$this->waitForElement('byXPath', "//a[contains(@href, '#Databases')]")->click();
|
||||
|
||||
$ele = $this->waitForElement("byName", "Servers-1-hide_db");
|
||||
$this->moveto($ele);
|
||||
$ele->value($this->database_name);
|
||||
|
||||
$this->waitForElement("byName", "Servers-1-hide_db")
|
||||
->value($this->database_name);
|
||||
$this->_saveConfig();
|
||||
$this->assertFalse(
|
||||
$this->isElementPresent("byLinkText", $this->database_name)
|
||||
@ -86,10 +100,12 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testSettingsTabsAreDisplayed()
|
||||
{
|
||||
$this->byLinkText("SQL queries")->click();
|
||||
$this->byPartialLinkText("SQL queries")->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement('byClassName', 'tabs');
|
||||
|
||||
$this->byLinkText("SQL Query box")->click();
|
||||
$this->byPartialLinkText("SQL Query box")->click();
|
||||
$this->assertTrue(
|
||||
$this->byId("Sql_box")->displayed()
|
||||
);
|
||||
@ -115,7 +131,8 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testHideLogo()
|
||||
{
|
||||
$this->byLinkText("Navigation panel")->click();
|
||||
$this->byPartialLinkText("Navigation panel")->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement("byName", "NavigationDisplayLogo")
|
||||
->click();
|
||||
@ -126,6 +143,7 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
|
||||
$this->byCssSelector("a[href='#NavigationDisplayLogo']")->click();
|
||||
$this->_saveConfig();
|
||||
$this->sleep();
|
||||
$this->assertTrue(
|
||||
$this->isElementPresent("byId", "imgpmalogo")
|
||||
);
|
||||
|
||||
@ -593,8 +593,12 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function navigateTable($table)
|
||||
{
|
||||
// go to database page
|
||||
$this->waitForElement("byLinkText", $this->database_name)->click();
|
||||
// Go to server databases
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
|
||||
// go to specific database page
|
||||
$this->waitForElement("byPartialLinkText", $this->database_name)->click();
|
||||
|
||||
/* Wait for loading and expanding tree */
|
||||
$this->waitForElement(
|
||||
@ -608,7 +612,7 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
// go to table page
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//*[@id='pma_navigation_tree_content']//a[contains(., '$table')]"
|
||||
"//th//a[contains(., '$table')]"
|
||||
)->click();
|
||||
|
||||
// Wait for it to load
|
||||
@ -641,4 +645,20 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
);
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll to the bottom of page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function scrollToBottom()
|
||||
{
|
||||
$this->execute(
|
||||
array(
|
||||
'script' => 'window.scrollTo(0,document.body.scrollHeight);',
|
||||
'args' => array()
|
||||
)
|
||||
);
|
||||
usleep(10000);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user