Merge pull request #13605 from devenbansod/selenium_minor_refactor
Minor refactoring in Selenium tests
This commit is contained in:
commit
8256945ec2
@ -81,7 +81,7 @@ class PMA_SeleniumCreateDropDatabaseTest extends PMA_SeleniumBase
|
||||
$this->byPartialLinkText('Databases')->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->scrollIntoView('tableslistcontainer');
|
||||
$this->scrollToBottom();
|
||||
$this->byCssSelector(
|
||||
"input[name='selected_dbs[]'][value='" . $this->database_name . "']"
|
||||
)->click();
|
||||
|
||||
@ -78,7 +78,7 @@ class PMA_SeleniumCreateRemoveUserTest extends PMA_SeleniumBase
|
||||
&& ! $this->isElementPresent('byId', 'ajax_message_num_1')
|
||||
) {
|
||||
$ele->click();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
@ -51,12 +51,7 @@ class PMA_SeleniumDbEventsTest extends PMA_SeleniumBase
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
$this->waitForElement('byPartialLinkText', $this->database_name)->click();
|
||||
$this->waitForElement(
|
||||
"byXPath", "//a[contains(., 'test_table')]"
|
||||
);
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
// Let the Database page load
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
@ -182,7 +177,7 @@ class PMA_SeleniumDbEventsTest extends PMA_SeleniumBase
|
||||
);
|
||||
$this->assertEquals(1, $result->num_rows);
|
||||
|
||||
usleep(2200000);
|
||||
sleep(2);
|
||||
$result = $this->dbQuery(
|
||||
"SELECT val FROM `" . $this->database_name . "`.`test_table`"
|
||||
);
|
||||
@ -214,7 +209,6 @@ class PMA_SeleniumDbEventsTest extends PMA_SeleniumBase
|
||||
$this->byName("item_interval_value")->clear();
|
||||
$this->byName("item_interval_value")->value("2");
|
||||
|
||||
$this->sleep();
|
||||
$this->byXPath("//button[contains(., 'Go')]")->click();
|
||||
|
||||
$ele = $this->waitForElement(
|
||||
@ -223,7 +217,7 @@ class PMA_SeleniumDbEventsTest extends PMA_SeleniumBase
|
||||
. "'Event `test_event` has been modified')]"
|
||||
);
|
||||
|
||||
usleep(2200000);
|
||||
sleep(2);
|
||||
$result = $this->dbQuery(
|
||||
"SELECT val FROM `" . $this->database_name . "`.`test_table`"
|
||||
);
|
||||
@ -255,7 +249,7 @@ class PMA_SeleniumDbEventsTest extends PMA_SeleniumBase
|
||||
|
||||
$this->waitForElement("byId", "nothing2display");
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$result = $this->dbQuery(
|
||||
"SHOW EVENTS WHERE Db='" . $this->database_name
|
||||
. "' AND Name='test_event'"
|
||||
|
||||
@ -33,9 +33,10 @@ class PMA_SeleniumDbOperationsTest extends PMA_SeleniumBase
|
||||
private function _getToDBOperations()
|
||||
{
|
||||
$this->gotoHomepage();
|
||||
$this->waitForElement('byLinkText', $this->database_name)->click();
|
||||
$this->waitForElement('byPartialLinkText', 'Structure');
|
||||
|
||||
$this->navigateDatabase($this->database_name);
|
||||
$this->expandMore();
|
||||
|
||||
$this->waitForElement('byPartialLinkText', 'Operations')->click();
|
||||
$this->waitForElement(
|
||||
'byXPath', '//legend[contains(., \'Rename database to\')]'
|
||||
|
||||
@ -48,15 +48,7 @@ class PMA_SeleniumDbProceduresTest extends PMA_SeleniumBase
|
||||
|
||||
$this->login();
|
||||
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
$this->waitForElement('byPartialLinkText', $this->database_name)->click();
|
||||
$this->waitForElement(
|
||||
"byXPath", "//a[contains(., 'test_table')]"
|
||||
);
|
||||
|
||||
// Let the Database page load
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->navigateDatabase($this->database_name);
|
||||
$this->expandMore();
|
||||
}
|
||||
|
||||
@ -189,7 +181,7 @@ class PMA_SeleniumDbProceduresTest extends PMA_SeleniumBase
|
||||
|
||||
$this->waitForElement("byId", "nothing2display");
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$result = $this->dbQuery(
|
||||
"SHOW PROCEDURE STATUS WHERE Db='" . $this->database_name . "'"
|
||||
);
|
||||
|
||||
@ -55,16 +55,7 @@ class PMA_SeleniumDbStructureTest extends PMA_SeleniumBase
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
$this->waitForElement('byPartialLinkText', $this->database_name)->click();
|
||||
$this->waitForElement(
|
||||
'byCssSelector',
|
||||
'li.last.table'
|
||||
);
|
||||
$this->waitForElement(
|
||||
"byXPath", "//a[contains(., 'test_table')]"
|
||||
);
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
// Let the Database page load
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
@ -56,13 +56,8 @@ class PMA_SeleniumDbTriggersTest extends PMA_SeleniumBase
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
$this->waitForElement('byPartialLinkText', $this->database_name)->click();
|
||||
$this->waitForElement(
|
||||
"byXPath", "//a[contains(., 'test_table')]"
|
||||
);
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
|
||||
$this->navigateDatabase($this->database_name);
|
||||
$this->expandMore();
|
||||
}
|
||||
|
||||
@ -207,8 +202,7 @@ class PMA_SeleniumDbTriggersTest extends PMA_SeleniumBase
|
||||
)->click();
|
||||
|
||||
$this->waitForElement("byId", "nothing2display");
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
// test trigger
|
||||
$this->dbQuery("INSERT INTO `test_table` (val) VALUES (1);");
|
||||
|
||||
@ -83,17 +83,7 @@ class PMA_SeleniumExportTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testDbExport($plugin, $expected)
|
||||
{
|
||||
// Go to server databases
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement("byPartialLinkText", $this->database_name)->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//a[@class='item' and contains(., 'Database: "
|
||||
. $this->database_name . "')]"
|
||||
);
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
$text = $this->_doExport('db', $plugin);
|
||||
|
||||
@ -167,21 +157,19 @@ class PMA_SeleniumExportTest extends PMA_SeleniumBase
|
||||
$this->expandMore();
|
||||
|
||||
$this->waitForElement('byPartialLinkText', "Export")->click();
|
||||
$this->sleep();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement("byId", "quick_or_custom");
|
||||
$this->byCssSelector("label[for=radio_custom_export]")->click();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->select($this->byId("plugins"))->selectOptionByLabel($plugin);
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
if ($type === 'server') {
|
||||
$this->scrollIntoView('databases_and_tables', 200);
|
||||
$this->waitForElement('byPartialLinkText', 'Unselect all')->click();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->waitForElement(
|
||||
'byCssSelector',
|
||||
@ -191,14 +179,13 @@ class PMA_SeleniumExportTest extends PMA_SeleniumBase
|
||||
|
||||
if ($type === 'table') {
|
||||
$this->byCssSelector("label[for=radio_allrows_0]")->click();
|
||||
$this->sleep();
|
||||
$this->byName("limit_to")->clear();
|
||||
$this->byName("limit_to")->value("1");
|
||||
}
|
||||
|
||||
$this->scrollIntoView('output', -150);
|
||||
$this->waitForElement('byCssSelector', "label[for=radio_view_as_text]")->click();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
if ($plugin == "SQL") {
|
||||
if ($type !== 'db') {
|
||||
@ -207,7 +194,7 @@ class PMA_SeleniumExportTest extends PMA_SeleniumBase
|
||||
'byCssSelector',
|
||||
"label[for=radio_sql_structure_or_data_structure_and_data]"
|
||||
)->click();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if ($type === 'server') {
|
||||
@ -226,7 +213,7 @@ class PMA_SeleniumExportTest extends PMA_SeleniumBase
|
||||
}
|
||||
|
||||
$this->scrollToBottom();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->waitForElement('byId', "buttonGo")->click();
|
||||
|
||||
|
||||
@ -56,19 +56,8 @@ class PMA_SeleniumImportTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testDbImport()
|
||||
{
|
||||
// Go to server databases
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->dbQuery("CREATE DATABASE " . $this->database_name);
|
||||
$this->waitForElement("byPartialLinkText", $this->database_name)->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//a[@class='item' and contains(., 'Database: "
|
||||
. $this->database_name . "')]"
|
||||
);
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
$this->_doImport("db");
|
||||
|
||||
@ -118,7 +107,7 @@ class PMA_SeleniumImportTest extends PMA_SeleniumBase
|
||||
$this->select($this->byName("local_import_file"))
|
||||
->selectOptionByLabel($type . "_import.sql");
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->scrollToBottom();
|
||||
$this->byId("buttonGo")->click();
|
||||
|
||||
@ -59,18 +59,7 @@ class PmaSeleniumQueryByExampleTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testQueryByExample()
|
||||
{
|
||||
// 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(
|
||||
'byCssSelector',
|
||||
'li.last.table'
|
||||
);
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
$this->waitForElement('byPartialLinkText', 'Query')->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
@ -35,7 +35,6 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
$this->waitForElement(
|
||||
"byXPath", "//a[@class='tabactive' and contains(., 'Settings')]"
|
||||
);
|
||||
$this->sleep();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,11 +53,18 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
$this->moveto($ele);
|
||||
$ele->click();
|
||||
|
||||
usleep(1000000);
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//div[@class='success' and contains(., 'Configuration has been saved')]"
|
||||
);
|
||||
$this->waitUntil(function() {
|
||||
if (
|
||||
$this->isElementPresent(
|
||||
"byXPath",
|
||||
"//div[@class='success' and contains(., 'Configuration has been saved')]"
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +149,6 @@ class PMA_SeleniumSettingsTest extends PMA_SeleniumBase
|
||||
|
||||
$this->byCssSelector("a[href='#NavigationDisplayLogo']")->click();
|
||||
$this->_saveConfig();
|
||||
$this->sleep();
|
||||
$this->assertTrue(
|
||||
$this->isElementPresent("byId", "imgpmalogo")
|
||||
);
|
||||
|
||||
@ -113,18 +113,7 @@ class PMA_SeleniumSqlQueryTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testDatabaseSqlQuery()
|
||||
{
|
||||
// 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(
|
||||
'byCssSelector',
|
||||
'li.last.table'
|
||||
);
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
$this->waitForElement('byPartialLinkText', 'SQL')->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
@ -55,7 +55,6 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$this->navigateTable('test_table');
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
usleep(1000000); // let the page load
|
||||
|
||||
// Dynamic wait
|
||||
$this->waitUntil(function () {
|
||||
@ -78,7 +77,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
// case 1
|
||||
$this->byPartialLinkText("name")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->assertEquals(
|
||||
"1",
|
||||
@ -98,7 +97,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
// case 2
|
||||
$this->byPartialLinkText("name")->click();
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->assertEquals(
|
||||
"2",
|
||||
@ -118,7 +117,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
// case 2
|
||||
$this->byLinkText("datetimefield")->click();
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->getCellByTableClass('table_results', 1, 5);
|
||||
$this->assertEquals(
|
||||
@ -139,7 +138,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
// case 4
|
||||
$this->byPartialLinkText("datetimefield")->click();
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->assertEquals(
|
||||
"2",
|
||||
@ -169,7 +168,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$ele = $this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(2) td:nth-child(2)"
|
||||
);
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$this->moveto($ele);
|
||||
$this->click();
|
||||
|
||||
@ -231,7 +230,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$element = $this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(1) td:nth-child(6)"
|
||||
);
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->moveto($element);
|
||||
$this->doubleclick();
|
||||
@ -247,7 +246,6 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$this->byCssSelector("textarea.edit_box")->clear();
|
||||
$this->byCssSelector("textarea.edit_box")->value("abcde");
|
||||
|
||||
$this->sleep();
|
||||
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::RETURN_);
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
@ -274,7 +272,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$ele = $this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(3) td:nth-child(3)"
|
||||
);
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$this->moveto($ele);
|
||||
$this->click();
|
||||
$this->waitForElement("byId", "insertForm");
|
||||
@ -296,7 +294,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
// automatically gets appended with 00:00:00
|
||||
$this->keys("2012-01-2");
|
||||
$this->byId("field_2_3")->value("ABCDEFG");
|
||||
usleep(1000000); // longer string takes longer to type
|
||||
sleep(1); // longer string takes longer to type
|
||||
|
||||
$this->waitForElement('byId', "buttonYes")->click();
|
||||
|
||||
|
||||
@ -90,7 +90,6 @@ class PMA_SeleniumTableCreateTest extends PMA_SeleniumBase
|
||||
)->click();
|
||||
}
|
||||
|
||||
$this->sleep();
|
||||
$this->byName("field_default_value[1]")->value("def");
|
||||
|
||||
$this->scrollToBottom();
|
||||
|
||||
@ -70,7 +70,7 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
$this->byPartialLinkText("Insert")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byId", "insertForm");
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->byId("field_3_3")->click();
|
||||
// shorter date to prevent error,
|
||||
@ -109,7 +109,7 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
)->click();
|
||||
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(2000000);
|
||||
sleep(2);
|
||||
|
||||
// New message
|
||||
$ele = $this->waitForElement(
|
||||
|
||||
@ -55,7 +55,6 @@ class PMA_SeleniumTableStructureTest extends PMA_SeleniumBase
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byId", "tablestructure");
|
||||
usleep(1000000);
|
||||
|
||||
// Dynamic wait
|
||||
$this->waitUntil(function () {
|
||||
|
||||
@ -57,19 +57,13 @@ class PMA_SeleniumTrackingTest extends PMA_SeleniumBase
|
||||
$this->login();
|
||||
$this->skipIfNotPMADB();
|
||||
|
||||
$this->waitForElement('byPartialLinkText', $this->database_name)->click();
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//a[@class='item' and contains(., 'Database: "
|
||||
. $this->database_name . "')]"
|
||||
);
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->navigateDatabase($this->database_name);
|
||||
$this->expandMore();
|
||||
|
||||
$this->waitForElement('byPartialLinkText', "Tracking")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$this->waitForElement("byPartialLinkText", "Track table");
|
||||
$this->byXPath("(//a[contains(., 'Track table')])[1]")->click();
|
||||
|
||||
@ -79,7 +73,7 @@ class PMA_SeleniumTrackingTest extends PMA_SeleniumBase
|
||||
&& $this->isElementPresent('byXPath', "(//a[contains(., 'Track table')])[1]")
|
||||
&& ! $this->isElementPresent('byId', 'ajax_message_num_1')
|
||||
) {
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
// If link still exists on page
|
||||
if ($this->isElementPresent("byXPath", "(//a[contains(., 'Track table')])[1]")) {
|
||||
$this->byXPath("(//a[contains(., 'Track table')])[1]")->click();
|
||||
@ -158,7 +152,7 @@ class PMA_SeleniumTrackingTest extends PMA_SeleniumBase
|
||||
$this->byCssSelector("input[value='Go']")->click();
|
||||
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->isElementPresent("byId", "ddl_versions")
|
||||
@ -203,15 +197,9 @@ class PMA_SeleniumTrackingTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testDropTracking()
|
||||
{
|
||||
$this->waitForElement(
|
||||
'byPartialLinkText',
|
||||
"Database: " . $this->database_name
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byId", "structureTable");
|
||||
|
||||
$this->navigateDatabase($this->database_name, true);
|
||||
$this->expandMore();
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
|
||||
$this->byPartialLinkText("Tracking")->click();
|
||||
|
||||
@ -223,10 +211,8 @@ class PMA_SeleniumTrackingTest extends PMA_SeleniumBase
|
||||
'table#versions tbody tr:nth-child(1) td:nth-child(7)'
|
||||
);
|
||||
$this->moveto($ele);
|
||||
$this->sleep();
|
||||
$this->click();
|
||||
|
||||
$this->sleep();
|
||||
$this->waitForElement(
|
||||
"byCssSelector",
|
||||
"button.submitOK"
|
||||
@ -300,7 +286,7 @@ class PMA_SeleniumTrackingTest extends PMA_SeleniumBase
|
||||
$this->byPartialLinkText("SQL")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$this->waitForElement("byId", "queryfieldscontainer");
|
||||
$this->typeInTextArea(
|
||||
";UPDATE test_table SET val = val + 1; "
|
||||
|
||||
@ -38,7 +38,7 @@ class PMA_SeleniumXSSTest extends PMA_SeleniumBase
|
||||
$this->waitForElement('byPartialLinkText', "SQL")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
$this->waitForElement("byId", "queryboxf");
|
||||
$this->byId("button_submit_query")->click();
|
||||
$this->assertEquals("Missing value in the form!", $this->alertText());
|
||||
|
||||
@ -411,19 +411,6 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sleeps while waiting for browser to perform an action.
|
||||
*
|
||||
* @todo This method should not be used, but rather there would be
|
||||
* explicit waiting for some elements.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sleep()
|
||||
{
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if element is present or not
|
||||
*
|
||||
@ -586,7 +573,18 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
$ele->click();
|
||||
$this->waitForElement('byCssSelector', 'li.submenuhover > a');
|
||||
|
||||
$this->sleep();
|
||||
$this->waitUntil(function () {
|
||||
if (
|
||||
$this->isElementPresent(
|
||||
'byCssSelector',
|
||||
'li.submenuhover.submenu.shown'
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -598,27 +596,14 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
*/
|
||||
public function navigateTable($table)
|
||||
{
|
||||
// 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(
|
||||
'byCssSelector',
|
||||
'li.last.table'
|
||||
);
|
||||
|
||||
/* TODO: Timing issue of expanding navigation tree */
|
||||
$this->sleep();
|
||||
$this->navigateDatabase($this->database_name);
|
||||
|
||||
// go to table page
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//th//a[contains(., '$table')]"
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
// Wait for it to load
|
||||
$this->waitForElement(
|
||||
@ -627,6 +612,37 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates browser to a database page.
|
||||
*
|
||||
* @param string $database Name of database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function navigateDatabase($database, $gotoHomepageRequired = false)
|
||||
{
|
||||
if ($gotoHomepageRequired) {
|
||||
$this->gotoHomepage();
|
||||
}
|
||||
|
||||
// Go to server databases
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
|
||||
// go to specific database page
|
||||
$this->waitForElement(
|
||||
'byXPath',
|
||||
'//tr[(contains(@class, "db-row"))]//a[contains(., "' . $this->database_name . '")]'
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'ajax_message_num_1');
|
||||
|
||||
// Wait for it to load
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//a[@class='tabactive' and contains(., 'Structure')]"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls to a coordinate such that the element with given id is visible
|
||||
*
|
||||
@ -649,7 +665,7 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
'args' => array()
|
||||
)
|
||||
);
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -665,9 +681,14 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
'args' => array()
|
||||
)
|
||||
);
|
||||
usleep(1000000);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark unsuccessful tests as 'Failures' on Browerstack
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onNotSuccessfulTest(Exception $e)
|
||||
{
|
||||
// If this is being run on Browerstack,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user