Fix selenium tests related to Table
Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
This commit is contained in:
parent
f12182d261
commit
00f3d5701e
@ -1,5 +1,5 @@
|
||||
<input name="field_extra[{{ column_number }}]"
|
||||
id="field_{{ columnNumber }}_{{ ci - ci_offset }}"
|
||||
id="field_{{ column_number }}_{{ ci - ci_offset }}"
|
||||
{% if column_meta['Extra'] is defined and column_meta['Extra']|lower == 'auto_increment' -%}
|
||||
checked="checked"
|
||||
{%- endif %}
|
||||
|
||||
@ -49,6 +49,8 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->navigateTable('test_table');
|
||||
}
|
||||
@ -62,14 +64,12 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testSortRecords()
|
||||
{
|
||||
/* TODO: needs to be fixed */
|
||||
$this->markTestIncomplete(
|
||||
'Does not work with multi column sorting.'
|
||||
);
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
// case 1
|
||||
$this->byLinkText("name")->click();
|
||||
$this->waitForElementNotPresent("byId", "loading_parent");
|
||||
$this->sleep();
|
||||
$this->byPartialLinkText("name")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
usleep(1000000);
|
||||
|
||||
$this->assertEquals(
|
||||
"1",
|
||||
@ -87,9 +87,9 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
);
|
||||
|
||||
// case 2
|
||||
$this->byLinkText("name")->click();
|
||||
$this->waitForElementNotPresent("byId", "loading_parent");
|
||||
$this->sleep();
|
||||
$this->byPartialLinkText("name")->click();
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
|
||||
$this->assertEquals(
|
||||
"2",
|
||||
@ -108,9 +108,10 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
|
||||
// case 2
|
||||
$this->byLinkText("datetimefield")->click();
|
||||
$this->waitForElementNotPresent("byId", "loading_parent");
|
||||
$this->sleep();
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
|
||||
$this->getCellByTableClass('table_results', 1, 5);
|
||||
$this->assertEquals(
|
||||
"3",
|
||||
$this->getCellByTableClass('table_results', 1, 5)
|
||||
@ -127,9 +128,9 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
);
|
||||
|
||||
// case 4
|
||||
$this->byLinkText("datetimefield")->click();
|
||||
$this->waitForElementNotPresent("byId", "loading_parent");
|
||||
$this->sleep();
|
||||
$this->byPartialLinkText("datetimefield")->click();
|
||||
$this->waitForElementNotPresent("byId", "ajax_message_num_1");
|
||||
usleep(1000000);
|
||||
|
||||
$this->assertEquals(
|
||||
"2",
|
||||
@ -156,12 +157,19 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testChangeRecords()
|
||||
{
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->sleep();
|
||||
$this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(2) td:nth-child(2) a"
|
||||
)->click();
|
||||
$this->sleep();
|
||||
/* TODO: this occasionally fails, so there is probably something wrong */
|
||||
|
||||
$ele = $this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(2) td:nth-child(2)"
|
||||
);
|
||||
usleep(1000000);
|
||||
$this->moveto($ele);
|
||||
$this->click();
|
||||
|
||||
$this->waitForElement("byId", "insertForm");
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byId", "insertForm");
|
||||
|
||||
$this->assertEquals(
|
||||
@ -181,11 +189,15 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
|
||||
$this->byId("field_2_3")->clear();
|
||||
$this->byId("field_2_3")->value("foobar");
|
||||
|
||||
$this->sleep();
|
||||
$this->byId("field_3_3")->clear();
|
||||
$this->byId("field_3_3")->value("2009-01-20 02:00:02");
|
||||
|
||||
$this->sleep();
|
||||
$this->byId("buttonYes")->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$success = $this->waitForElement("byClassName", "success");
|
||||
$this->assertContains("1 row affected", $success->text());
|
||||
|
||||
@ -209,22 +221,30 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testChangeRecordsByDoubleClick()
|
||||
{
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$element = $this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(1) td:nth-child(6)"
|
||||
);
|
||||
usleep(1000000);
|
||||
|
||||
$this->moveto($element);
|
||||
$this->doubleclick();
|
||||
|
||||
$this->assertEquals(
|
||||
$this->byCssSelector("textarea.edit_box")->value(),
|
||||
$this->waitForElement(
|
||||
'byXPath',
|
||||
"//div[not(contains(@style,'display: none;'))]//textarea[contains(@class, 'edit_box')]"
|
||||
)->value(),
|
||||
"abcd"
|
||||
);
|
||||
|
||||
$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');
|
||||
$success = $this->waitForElement(
|
||||
"byCssSelector", "span.ajax_notification div.success"
|
||||
);
|
||||
@ -245,11 +265,15 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testCopyRecords()
|
||||
{
|
||||
$this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(3) td:nth-child(3) a"
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->sleep();
|
||||
|
||||
/* TODO: this occasionally fails, so there is probably something wrong */
|
||||
$ele = $this->byCssSelector(
|
||||
"table.table_results tbody tr:nth-child(3) td:nth-child(3)"
|
||||
);
|
||||
usleep(1000000);
|
||||
$this->moveto($ele);
|
||||
$this->click();
|
||||
$this->waitForElement("byId", "insertForm");
|
||||
|
||||
$this->assertEquals(
|
||||
@ -268,6 +292,8 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$this->byId("field_3_3")->value("2012-01-20 02:05:02");
|
||||
|
||||
$this->byId("buttonYes")->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$success = $this->waitForElement("byClassName", "success");
|
||||
$this->assertContains("1 row inserted", $success->text());
|
||||
|
||||
@ -291,16 +317,22 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testSearchRecords()
|
||||
{
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->expandMore();
|
||||
|
||||
$this->byLinkText("Search")->click();
|
||||
$this->byPartialLinkText("Search")->click();
|
||||
$this->waitForElement("byId", "tbl_search_form");
|
||||
|
||||
$this->byId("fieldID_1")->value("abcd");
|
||||
$select = $this->select($this->byName("criteriaColumnOperators[1]"));
|
||||
$select->selectOptionByLabel("LIKE %...%");
|
||||
|
||||
$this->byName("submit")->click();
|
||||
$this->scrollToBottom();
|
||||
$elem = $this->waitForElement('byCssSelector', ".tblFooters input[name=submit]");
|
||||
$this->moveto($elem);
|
||||
$elem->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$success = $this->waitForElement("byClassName", "success");
|
||||
$this->assertContains("Showing rows", $success->text());
|
||||
|
||||
@ -324,6 +356,8 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testDeleteRecords()
|
||||
{
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->byId("id_rows_to_delete1_left")->click();
|
||||
$this->byId("id_rows_to_delete2_left")->click();
|
||||
|
||||
@ -331,6 +365,8 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase
|
||||
$this->waitForElement("byCssSelector", "fieldset.confirmation");
|
||||
|
||||
$this->byId("buttonYes")->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$success = $this->waitForElement("byClassName", "success");
|
||||
$this->assertContains("Showing rows", $success->text());
|
||||
|
||||
|
||||
@ -18,6 +18,19 @@ require_once 'TestBase.php';
|
||||
*/
|
||||
class PMA_SeleniumTableCreateTest extends PMA_SeleniumBase
|
||||
{
|
||||
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->waitForElement('byPartialLinkText','Databases')->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
|
||||
// go to specific database page
|
||||
$this->waitForElement("byPartialLinkText", $this->database_name)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a table
|
||||
*
|
||||
@ -27,51 +40,78 @@ class PMA_SeleniumTableCreateTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testCreateTable()
|
||||
{
|
||||
$this->login();
|
||||
$this->waitForElement('byLinkText', $this->database_name)->click();
|
||||
$this->waitForElementNotPresent('byCssSelector', 'div#loading_parent');
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement('byId', 'create_table_form_minimal');
|
||||
$this->byCssSelector(
|
||||
"form#create_table_form_minimal input[name=table]"
|
||||
)->value("test_table");
|
||||
$this->byName("num_fields")->clear();
|
||||
$this->byName("num_fields")->value("4");
|
||||
$this->byCssSelector('input[value=Go]')->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement('byName', 'do_save_data');
|
||||
|
||||
// column details
|
||||
$column_text_details = array(
|
||||
"field_0_1" => "test_id",
|
||||
"field_0_3" => "14",
|
||||
"field_0_10" => "comm1",
|
||||
"field_0_9" => "comm1",
|
||||
"field_1_1" => "test_column",
|
||||
"field_1_3" => "10",
|
||||
"field_1_10" => "comm2",
|
||||
"field_1_9" => "comm2",
|
||||
);
|
||||
|
||||
foreach ($column_text_details as $field => $val) {
|
||||
$this->byId($field)->value($val);
|
||||
}
|
||||
|
||||
$this->byId("field_0_8")->click(); // auto increment
|
||||
$this->byId("field_1_6")->click(); // null
|
||||
|
||||
$this->sleep();
|
||||
|
||||
$column_dropdown_details = array(
|
||||
"field_0_6" => "UNSIGNED",
|
||||
"field_0_8" => "PRIMARY",
|
||||
"field_0_5" => "UNSIGNED",
|
||||
"field_1_2" => "VARCHAR",
|
||||
"field_1_5" => "utf8_general_ci",
|
||||
"field_1_4" => "As defined:"
|
||||
);
|
||||
|
||||
foreach ($column_dropdown_details as $selector => $value) {
|
||||
$sel = $this->select($this->byId($selector));
|
||||
$sel->selectOptionByLabel($value);
|
||||
$this->waitForElement(
|
||||
'byXPath',
|
||||
'//select[@id=\'' . $selector . '\']//option[contains(text(), \'' . $value . '\')]'
|
||||
)->click();
|
||||
}
|
||||
|
||||
$this->byName("field_default_value[1]")->value("def");
|
||||
$this->byId("field_0_9")->click(); // auto increment
|
||||
$this->byId("field_1_7")->click(); // null
|
||||
// Do this separately since this opens a dialog
|
||||
$this->waitForElement(
|
||||
'byXPath',
|
||||
'//select[@id=\'field_0_7\']//option[contains(text(), \'PRIMARY\')]'
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement('byXPath', '//button[contains(text(), \'Go\')]')->click();
|
||||
|
||||
$this->sleep();
|
||||
$this->byName("field_default_value[1]")->value("def");
|
||||
|
||||
$this->scrollToBottom();
|
||||
$ele = $this->waitForElement('byName', "do_save_data");
|
||||
$this->moveto($ele);
|
||||
// post
|
||||
$this->byName("do_save_data")->click();
|
||||
$this->waitForElement("byLinkText", "test_table");
|
||||
$ele->click();
|
||||
$this->waitForElement(
|
||||
'byCssSelector',
|
||||
'li.last.table'
|
||||
);
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElementNotPresent('byId', 'loading_parent');
|
||||
|
||||
$this->waitForElement("byPartialLinkText", "test_table");
|
||||
|
||||
$this->_tableStructureAssertions();
|
||||
}
|
||||
@ -83,9 +123,18 @@ class PMA_SeleniumTableCreateTest extends PMA_SeleniumBase
|
||||
*/
|
||||
private function _tableStructureAssertions()
|
||||
{
|
||||
$this->gotoHomepage();
|
||||
$this->waitForElementNotPresent('byId', 'loading_parent');
|
||||
|
||||
$this->navigateTable('test_table');
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'loading_parent');
|
||||
|
||||
// go to structure page
|
||||
$this->byLinkText("Structure")->click();
|
||||
$this->waitForElement('byPartialLinkText', "Structure")->click();
|
||||
|
||||
$this->waitForElement("byId", "tablestructure");
|
||||
$this->waitForElement('byId', 'table_strucuture_id');
|
||||
|
||||
// make assertions for first row
|
||||
$this->assertContains(
|
||||
@ -109,13 +158,17 @@ class PMA_SeleniumTableCreateTest extends PMA_SeleniumBase
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
"None",
|
||||
"",
|
||||
$this->getCellByTableId('tablestructure', 1, 8)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"comm1",
|
||||
$this->getCellByTableId('tablestructure', 1, 9)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
"AUTO_INCREMENT",
|
||||
$this->getCellByTableId('tablestructure', 1, 9)
|
||||
$this->getCellByTableId('tablestructure', 1, 10)
|
||||
);
|
||||
|
||||
$this->assertFalse(
|
||||
|
||||
@ -45,6 +45,8 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->navigateTable('test_table');
|
||||
}
|
||||
@ -62,19 +64,24 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
/* TODO: this should be fixed, but the cause is unclear to me */
|
||||
$this->markTestIncomplete('Fails with Safari');
|
||||
}
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->expandMore();
|
||||
|
||||
$this->byLinkText("Insert")->click();
|
||||
$this->byPartialLinkText("Insert")->click();
|
||||
$this->waitForElement("byId", "insertForm");
|
||||
|
||||
$this->byId("field_1_3")->value("1");
|
||||
$this->byId("field_2_3")->value("abcd");
|
||||
$this->byId("field_3_3")->value("2011-01-20 02:00:02");
|
||||
$this->sleep();
|
||||
|
||||
$this->byId("field_5_3")->value("foo");
|
||||
$this->byId("field_6_3")->value("2010-01-20 02:00:02");
|
||||
$this->sleep();
|
||||
|
||||
$select = $this->select($this->byName("after_insert"));
|
||||
$select->selectOptionByLabel("Insert another new row");
|
||||
$this->sleep();
|
||||
|
||||
// post
|
||||
$this->byId("buttonYes")->click();
|
||||
@ -83,6 +90,7 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
|
||||
$this->byId("field_2_3")->value("Abcd");
|
||||
$this->byId("field_3_3")->value("2012-01-20 02:00:02");
|
||||
$this->sleep();
|
||||
|
||||
// post
|
||||
$this->byCssSelector(
|
||||
@ -92,6 +100,8 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
$this->waitForElementNotPresent("byId", "loading_parent");
|
||||
$ele = $this->waitForElement("byClassName", "success");
|
||||
$this->assertContains("1 row inserted", $ele->text());
|
||||
|
||||
$this->sleep();
|
||||
$this->_assertDataPresent();
|
||||
}
|
||||
|
||||
@ -102,8 +112,10 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase
|
||||
*/
|
||||
private function _assertDataPresent()
|
||||
{
|
||||
$this->byLinkText("Browse")->click();
|
||||
$this->waitForElement("byId", "table_results");
|
||||
$this->byPartialLinkText("Browse")->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byCssSelector", "table.table_results");
|
||||
|
||||
$this->assertEquals(
|
||||
"1",
|
||||
|
||||
@ -26,16 +26,19 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// MYISAM ENGINE to allow for column-based order selection
|
||||
// while table also has a PRIMARY key
|
||||
$this->dbQuery(
|
||||
"CREATE TABLE `test_table` ("
|
||||
. " `id` int(11) NOT NULL AUTO_INCREMENT,"
|
||||
. " `val` int(11) NOT NULL,"
|
||||
. " `val2` int(11) NOT NULL,"
|
||||
. " PRIMARY KEY (`id`)"
|
||||
. ")"
|
||||
. ") ENGINE=MYISAM"
|
||||
);
|
||||
$this->dbQuery("INSERT INTO test_table (val) VALUES (22)");
|
||||
$this->dbQuery("INSERT INTO test_table (val) VALUES (33)");
|
||||
$this->dbQuery("INSERT INTO test_table (val, val2) VALUES (22, 33)");
|
||||
$this->dbQuery("INSERT INTO test_table (val, val2) VALUES (33, 44)");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,12 +48,17 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->navigateTable('test_table');
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->expandMore();
|
||||
$this->byXPath("//a[contains(., 'Operations')]")->click();
|
||||
$this->sleep();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//legend[contains(., 'Table maintenance')]"
|
||||
@ -66,10 +74,6 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testChangeTableOrder()
|
||||
{
|
||||
/* FIXME: Need to create table which will allow this */
|
||||
$this->markTestIncomplete(
|
||||
'Changing order is not supported for some tables.'
|
||||
);
|
||||
$this->select($this->byName("order_field"))
|
||||
->selectOptionByLabel("val");
|
||||
|
||||
@ -78,14 +82,18 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
"form#alterTableOrderby input[type='submit']"
|
||||
)->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//div[@class='success' and "
|
||||
. "contains(., 'Your SQL query has been executed successfully')]"
|
||||
);
|
||||
|
||||
$this->byLinkText("Browse")->click();
|
||||
$this->waitForElement("byId", "table_results");
|
||||
$this->byPartialLinkText("Browse")->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byCssSelector", "table.table_results");
|
||||
|
||||
$this->assertEquals(
|
||||
"2",
|
||||
@ -106,6 +114,7 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
->value("2");
|
||||
|
||||
$this->byCssSelector("form#moveTableForm input[type='submit']")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
@ -137,7 +146,9 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
|
||||
$this->byName("comment")->value("foobar");
|
||||
|
||||
$this->scrollIntoView('tableOptionsForm');
|
||||
$this->byCssSelector("form#tableOptionsForm input[type='submit']")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
@ -145,13 +156,6 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
. "contains(., 'Table test_table has been renamed to test_table2')]"
|
||||
);
|
||||
|
||||
$this->assertNotNull(
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//span[@id='span_table_comment' and contains(., 'foobar')]"
|
||||
)
|
||||
);
|
||||
|
||||
$result = $this->dbQuery("SHOW TABLES");
|
||||
$row = $result->fetch_assoc();
|
||||
$this->assertEquals(
|
||||
@ -169,9 +173,12 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testCopyTable()
|
||||
{
|
||||
$this->scrollIntoView('copyTable');
|
||||
|
||||
$this->byCssSelector("form#copyTable input[name='new_name']")->value("2");
|
||||
$this->byCssSelector("label[for='what_data']")->click();
|
||||
$this->byCssSelector("form#copyTable input[type='submit']")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
@ -198,8 +205,11 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testTruncateTable()
|
||||
{
|
||||
$this->scrollToBottom();
|
||||
|
||||
$this->byId("truncate_tbl_anchor")->click();
|
||||
$this->byXPath("//button[contains(., 'OK')]")->click();
|
||||
$this->byCssSelector("button.submitOK")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
@ -224,8 +234,11 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testDropTable()
|
||||
{
|
||||
$this->scrollToBottom();
|
||||
|
||||
$this->byId("drop_tbl_anchor")->click();
|
||||
$this->byXPath("//button[contains(., 'OK')]")->click();
|
||||
$this->byCssSelector("button.submitOK")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
|
||||
@ -43,9 +43,9 @@ class PMA_SeleniumTableStructureTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function setUpPage()
|
||||
{
|
||||
$this->login();
|
||||
$this->waitForElement('byLinkText', $this->database_name)->click();
|
||||
parent::setUpPage();
|
||||
|
||||
$this->login();
|
||||
$this->navigateTable('test_table');
|
||||
|
||||
$this->waitForElement(
|
||||
@ -65,31 +65,36 @@ class PMA_SeleniumTableStructureTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testAddColumn()
|
||||
{
|
||||
$this->byCssSelector("label[for='field_where_after']")->click();
|
||||
$this->byCssSelector("input[value='Go']")->click();
|
||||
$this->waitForElement(
|
||||
'byCssSelector',
|
||||
"#addColumns > input[value='Go']"
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byId', 'loading_parent');
|
||||
|
||||
$this->waitForElement("byClassName", "append_fields_form");
|
||||
|
||||
$this->byId("field_0_1")->value('val3');
|
||||
$this->byCssSelector("input[name='do_save_data']")->click();
|
||||
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement(
|
||||
"byXPath",
|
||||
"//div[@class='success' and contains(., "
|
||||
. "'Table test_table has been altered successfully')]"
|
||||
);
|
||||
|
||||
$this->byLinkText("Structure")->click();
|
||||
$this->byPartialLinkText("Structure")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
$this->waitForElement("byId", "tablestructure");
|
||||
|
||||
$this->assertEquals(
|
||||
"val3",
|
||||
$this->byCssSelector('label[for=checkbox_row_2]')->text()
|
||||
$this->byCssSelector('label[for=checkbox_row_4]')->text()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
"int(11)",
|
||||
$this->getCellByTableId('tablestructure', 2, 4)
|
||||
$this->getCellByTableId('tablestructure', 4, 4)
|
||||
);
|
||||
}
|
||||
|
||||
@ -102,7 +107,10 @@ class PMA_SeleniumTableStructureTest extends PMA_SeleniumBase
|
||||
*/
|
||||
public function testChangeColumn()
|
||||
{
|
||||
$this->byXPath("(//a[contains(., 'Change')])[2]")->click();
|
||||
$this->byCssSelector(
|
||||
"#tablestructure tbody tr:nth-child(2) td:nth-child(11)"
|
||||
)->click();
|
||||
$this->waitForElementNotPresent('byId', 'loading_parent');
|
||||
|
||||
$this->waitForElement("byClassName", "append_fields_form");
|
||||
|
||||
@ -117,9 +125,12 @@ class PMA_SeleniumTableStructureTest extends PMA_SeleniumBase
|
||||
. "'Table test_table has been altered successfully')]"
|
||||
);
|
||||
|
||||
$this->byLinkText("Structure")->click();
|
||||
$this->byPartialLinkText("Structure")->click();
|
||||
$this->waitForElementNotPresent('byId', 'ajax_message_num_1');
|
||||
|
||||
$this->waitForElement("byId", "tablestructure");
|
||||
|
||||
var_dump($this->byCssSelector('label[for=checkbox_row_2]')->text());
|
||||
$this->assertEquals(
|
||||
"val3",
|
||||
$this->byCssSelector('label[for=checkbox_row_2]')->text()
|
||||
|
||||
@ -57,11 +57,12 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
self::$_selenium_enabled = true;
|
||||
|
||||
$strategy = 'shared';
|
||||
$build_local = false;
|
||||
$build_local = true;
|
||||
$build_id = 'Manual';
|
||||
$project_name = 'phpMyAdmin';
|
||||
if (getenv('BUILD_TAG')) {
|
||||
$build_id = getenv('BUILD_TAG');
|
||||
$build_local = false;
|
||||
$strategy = 'isolated';
|
||||
$project_name = 'phpMyAdmin (Jenkins)';
|
||||
} elseif (getenv('TRAVIS_JOB_NUMBER')) {
|
||||
@ -464,7 +465,9 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
$element = $this->byCssSelector(
|
||||
$sel
|
||||
);
|
||||
return $element->text();
|
||||
$text = $element->attribute('innerText');
|
||||
|
||||
return ($text && is_string($text)) ? trim($text) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -483,7 +486,9 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
$element = $this->byCssSelector(
|
||||
$sel
|
||||
);
|
||||
return $element->text();
|
||||
$text = $element->attribute('innerText');
|
||||
|
||||
return ($text && is_string($text)) ? trim($text) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -626,12 +631,13 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
* Scrolls to a coordinate such that the element with given id is visible
|
||||
*
|
||||
* @param string $element_id Id of the element
|
||||
* @param int $offset Offset from Y-coordinate of element
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function scrollIntoView($element_id)
|
||||
public function scrollIntoView($element_id, $offset = 70)
|
||||
{
|
||||
// 70pt offset so that the topmenu does not cover the element
|
||||
// 70pt offset by-default so that the topmenu does not cover the element
|
||||
$this->execute(
|
||||
array(
|
||||
'script' => 'var element = document.getElementById("'
|
||||
@ -639,11 +645,11 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
. 'var position = element.getBoundingClientRect();'
|
||||
. 'var x = position.left;'
|
||||
. 'var y = position.top;'
|
||||
. 'window.scrollTo(x, y-70);',
|
||||
. 'window.scrollTo(x, y-(' . $offset . '));',
|
||||
'args' => array()
|
||||
)
|
||||
);
|
||||
usleep(10000);
|
||||
usleep(1000000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -659,6 +665,6 @@ abstract class PMA_SeleniumBase extends PHPUnit_Extensions_Selenium2TestCase
|
||||
'args' => array()
|
||||
)
|
||||
);
|
||||
usleep(10000);
|
||||
usleep(1000000);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user