From dff3b9627daa1e07bc7a341299c7d9e1bcf8be89 Mon Sep 17 00:00:00 2001 From: ayushchd Date: Tue, 27 Aug 2013 23:24:31 +0530 Subject: [PATCH 1/3] Selenium tests for export --- test/selenium/PmaSeleniumExportTest.php | 227 ++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 test/selenium/PmaSeleniumExportTest.php diff --git a/test/selenium/PmaSeleniumExportTest.php b/test/selenium/PmaSeleniumExportTest.php new file mode 100644 index 0000000000..c1e47c27dc --- /dev/null +++ b/test/selenium/PmaSeleniumExportTest.php @@ -0,0 +1,227 @@ +_helper = new Helper($this); + $this->setBrowser($this->_helper->getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + $this->_helper->dbConnect(); + $this->_dbname = 'pma_db_' . time(); + $this->_helper->dbQuery('CREATE DATABASE ' . $this->_dbname); + $this->_helper->dbQuery('USE ' . $this->_dbname); + $this->_helper->dbQuery( + "CREATE TABLE `test_table` (" + . " `id` int(11) NOT NULL AUTO_INCREMENT," + . " `val` int(11) NOT NULL," + . " PRIMARY KEY (`id`)" + . ")" + ); + $this->_helper->dbQuery( + "INSERT INTO `test_table` (val) VALUES (2);" + ); + } + + /** + * setUp function that can use the selenium session (called before each test) + * + * @return void + */ + public function setUpPage() + { + $this->_helper->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + } + + /** + * Test for server level export + * + * @param string $plugin Export format + * @param array $expected Array of expected strings + * + * @return void + * @dataProvider exportDataProvider + */ + public function testServerImport($plugin, $expected) + { + $text = $this->_doExport('server', $plugin); + + foreach ($expected as $str) { + $this->assertContains($str, $text); + } + + } + + /** + * Test for db level export + * + * @param string $plugin Export format + * @param array $expected Array of expected strings + * + * @return void + * @dataProvider exportDataProvider + */ + public function testDbExport($plugin, $expected) + { + $this->_helper->waitForElement("byLinkText", $this->_dbname)->click(); + $this->_helper->waitForElement( + "byXPath", + "//a[@class='item' and contains(., 'Database: ". $this->_dbname ."')]" + ); + + $text = $this->_doExport('db', $plugin); + + foreach ($expected as $str) { + $this->assertContains($str, $text); + } + } + + /** + * Test for table level export + * + * @param string $plugin Export format + * @param array $expected Array of expected strings + * + * @return void + * @dataProvider exportDataProvider + */ + public function testTableExport($plugin, $expected) + { + $this->_helper->dbQuery("INSERT INTO `test_table` (val) VALUES (3);"); + + // go to database page + $this->_helper->waitForElement("byLinkText", $this->_dbname)->click(); + + // got to table page + $this->_helper->waitForElement("byLinkText", "test_table")->click(); + $this->_helper->waitForElement( + "byXPath", + "//a[@class='tabactive' and contains(., 'Browse')]" + ); + + $text = $this->_doExport('table', $plugin); + + foreach ($expected as $str) { + $this->assertContains($str, $text); + } + } + + + /** + * Data provider for testServerExport + * + * @return array Test cases data + */ + public function exportDataProvider() + { + return array( + array( + 'CSV', + array('"1","2"') + ), + array( + 'SQL', + array( + "CREATE TABLE IF NOT EXISTS `test_table`", + "INSERT INTO `test_table` (`id`, `val`) VALUES (1, 2);" + ) + ), + array( + 'JSON', + array('[{"id":"1","val":"2"}]') + ) + ); + } + + /** + * Function that goes to the import page, uploads a file and submit form + * + * @param string $type level: server, db or import + * @param string $plugin format: csv, json, etc + * + * @return string export string + */ + private function _doExport($type, $plugin) + { + $this->byLinkText("Export")->click(); + + $this->_helper->waitForElement("byName", "dump"); + $this->byCssSelector("label[for=radio_custom_export]")->click(); + + if ($type == 'server') { + $this->byLinkText('Unselect All')->click(); + $this->byCssSelector("option[value=" . $this->_dbname . "]")->click(); + } + + if ($type == 'table') { + $this->byCssSelector("label[for=radio_allrows_0]")->click(); + $this->byName("limit_to")->clear(); + $this->byName("limit_to")->value("1"); + } + + $this->select($this->byId("plugins"))->selectOptionByLabel($plugin); + $this->byCssSelector("label[for=radio_view_as_text]")->click(); + + if ($plugin == "SQL") { + $this->byCssSelector( + "label[for=radio_sql_structure_or_data_structure_and_data]" + )->click(); + + if ($type != "table") { + $this->byCssSelector( + "label[for=checkbox_sql_create_database]" + )->click(); + } + } + + $this->byId("buttonGo")->click(); + + $text = $this->_helper->waitForElement("byId", "textSQLDUMP")->text(); + + return $text; + } + + /** + * Tear Down function for test cases + * + * @return void + */ + public function tearDown() + { + $this->_helper->dbQuery('DROP DATABASE IF EXISTS ' . $this->_dbname); + } + +} From b23eefacf0e16288a742841959eae50ca41b87e3 Mon Sep 17 00:00:00 2001 From: ayushchd Date: Wed, 28 Aug 2013 13:25:43 +0530 Subject: [PATCH 2/3] Selenium suite code standard compliance --- test/selenium/Helper.php | 46 +++++++++++++++++-- test/selenium/PmaSeleniumDbEventsTest.php | 8 ++-- test/selenium/PmaSeleniumDbOperationsTest.php | 2 +- test/selenium/PmaSeleniumDbProceduresTest.php | 17 ++++--- test/selenium/PmaSeleniumDbStructureTest.php | 5 +- test/selenium/PmaSeleniumDbTriggersTest.php | 11 +++-- test/selenium/PmaSeleniumTableBrowseTest.php | 4 +- test/selenium/PmaSeleniumTableCreateTest.php | 6 ++- test/selenium/PmaSeleniumTableInsertTest.php | 7 ++- .../PmaSeleniumTableOperationsTest.php | 3 +- .../PmaSeleniumTableStructureTest.php | 16 ++++--- 11 files changed, 92 insertions(+), 33 deletions(-) diff --git a/test/selenium/Helper.php b/test/selenium/Helper.php index d3b34a42a5..4db345e09b 100644 --- a/test/selenium/Helper.php +++ b/test/selenium/Helper.php @@ -209,6 +209,14 @@ class Helper return $browserString; } + /** + * Wait for an element to be present on the page + * + * @param string $func Locate using - byCss, byXPath, etc + * @param string $arg Selector + * + * @return PHPUnit_Extensions_Selenium2TestCase_Element Element waited for + */ public function waitForElement($func, $arg) { $this->_selenium->timeouts()->implicitWait(10000); @@ -219,18 +227,32 @@ class Helper return $element; } + /** + * Wait for an element to disappear + * + * @param string $func Locate using - byCss, byXPath, etc + * @param string $arg Selector + * + * @return bool Whether or not the element disappeared + */ public function waitForElementNotPresent($func, $arg) { - while(true) - { + while (true) { if (!$this->isElementPresent($func, $arg)) { return true; } - usleep(100); } } + /** + * Check if element is present or not + * + * @param string $func Locate using - byCss, byXPath, etc + * @param string $arg Selector + * + * @return bool Whether or not the element is present + */ public function isElementPresent($func, $arg) { try { @@ -246,19 +268,33 @@ class Helper return true; } + /** + * Get table cell data + * + * @param string $identifier Identifier: tableId.row.column + * + * @return text Data from the particular table cell + */ public function getTable($identifier) { list($tableID, $row, $column) = explode(".", $identifier); - $selector = "table#{$tableID} tbody tr:nth-child({$row}) td:nth-child({$column})"; + $sel = "table#{$tableID} tbody tr:nth-child({$row}) td:nth-child({$column})"; $element = $this->_selenium->byCssSelector( - $selector + $sel ); return $element->text(); } + /** + * Type text in textarea (CodeMirror enabled) + * + * @param string $text Text to type + * + * @return void + */ public function typeInTextArea($text) { $text = str_replace( diff --git a/test/selenium/PmaSeleniumDbEventsTest.php b/test/selenium/PmaSeleniumDbEventsTest.php index aa7d9c0f01..9a5b5125db 100644 --- a/test/selenium/PmaSeleniumDbEventsTest.php +++ b/test/selenium/PmaSeleniumDbEventsTest.php @@ -125,7 +125,8 @@ class PmaSeleniumDbEventsTest extends PHPUnit_Extensions_Selenium2TestCase $ele = $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Event `test_event` has been created')]" + "//div[@class='success' and contains(., " + . "'Event `test_event` has been created')]" ); $this->assertTrue( @@ -177,7 +178,8 @@ class PmaSeleniumDbEventsTest extends PHPUnit_Extensions_Selenium2TestCase $ele = $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Event `test_event` has been modified')]" + "//div[@class='success' and contains(., " + . "'Event `test_event` has been modified')]" ); usleep(2000000); @@ -209,7 +211,7 @@ class PmaSeleniumDbEventsTest extends PHPUnit_Extensions_Selenium2TestCase $this->byLinkText("Drop")->click(); $this->_helper->waitForElement( "byXPath", "//button[contains(., 'OK')]" - )->click(); + )->click(); $this->_helper->waitForElement("byId", "nothing2display"); diff --git a/test/selenium/PmaSeleniumDbOperationsTest.php b/test/selenium/PmaSeleniumDbOperationsTest.php index 1660419f64..1b69b9a94e 100644 --- a/test/selenium/PmaSeleniumDbOperationsTest.php +++ b/test/selenium/PmaSeleniumDbOperationsTest.php @@ -93,7 +93,7 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement( "byXPath", "//button[contains(., 'OK')]" - )->click(); + )->click(); $this->_helper->waitForElement( "byXPath", diff --git a/test/selenium/PmaSeleniumDbProceduresTest.php b/test/selenium/PmaSeleniumDbProceduresTest.php index a7169584c5..94ba28d9eb 100644 --- a/test/selenium/PmaSeleniumDbProceduresTest.php +++ b/test/selenium/PmaSeleniumDbProceduresTest.php @@ -102,14 +102,14 @@ class PmaSeleniumDbProceduresTest extends PHPUnit_Extensions_Selenium2TestCase $this->byName("item_param_name[0]")->value("inp"); $this->select( $this->byName("item_param_type[0]") - )->selectOptionByLabel("VARCHAR"); + )->selectOptionByLabel("VARCHAR"); $this->byName("item_param_length[0]")->value("10"); $this->byCssSelector("input[value='Add parameter']")->click(); $this->select( $this->byName("item_param_dir[1]") - )->selectOptionByLabel("OUT"); + )->selectOptionByLabel("OUT"); $ele = $this->_helper->waitForElement("byName", "item_param_name[1]"); $ele->value("outp"); @@ -118,13 +118,14 @@ class PmaSeleniumDbProceduresTest extends PHPUnit_Extensions_Selenium2TestCase $this->select( $this->byName("item_sqldataaccess") - )->selectOptionByLabel("READS SQL DATA"); + )->selectOptionByLabel("READS SQL DATA"); $this->byXPath("//button[contains(., 'Go')]")->click(); $ele = $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Routine `test_procedure` has been created')]" + "//div[@class='success' and contains(., " + . "'Routine `test_procedure` has been created')]" ); $result = $this->_helper->dbQuery( @@ -162,7 +163,8 @@ class PmaSeleniumDbProceduresTest extends PHPUnit_Extensions_Selenium2TestCase $ele = $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Routine `test_procedure` has been modified')]" + "//div[@class='success' and contains(., " + . "'Routine `test_procedure` has been modified')]" ); $this->_executeProcedure("abcabcabcabcabcabcabc", 12); @@ -189,7 +191,7 @@ class PmaSeleniumDbProceduresTest extends PHPUnit_Extensions_Selenium2TestCase $this->byLinkText("Drop")->click(); $this->_helper->waitForElement( "byXPath", "//button[contains(., 'OK')]" - )->click(); + )->click(); $this->_helper->waitForElement("byId", "nothing2display"); @@ -203,6 +205,9 @@ class PmaSeleniumDbProceduresTest extends PHPUnit_Extensions_Selenium2TestCase /** * Execute procedure * + * @param string $text String to pass as inp param + * @param int $length Expected output length + * * @return void */ private function _executeProcedure($text, $length) diff --git a/test/selenium/PmaSeleniumDbStructureTest.php b/test/selenium/PmaSeleniumDbStructureTest.php index 4d8c507b3e..81e4944855 100644 --- a/test/selenium/PmaSeleniumDbStructureTest.php +++ b/test/selenium/PmaSeleniumDbStructureTest.php @@ -89,12 +89,13 @@ class PmaSeleniumDbStructureTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement( "byXPath", "//button[contains(., 'OK')]" - )->click(); + )->click(); $this->assertNotNull( $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'MySQL returned an empty result')]" + "//div[@class='success' and contains(., " + . "'MySQL returned an empty result')]" ) ); diff --git a/test/selenium/PmaSeleniumDbTriggersTest.php b/test/selenium/PmaSeleniumDbTriggersTest.php index 717841c855..f4e0019b12 100644 --- a/test/selenium/PmaSeleniumDbTriggersTest.php +++ b/test/selenium/PmaSeleniumDbTriggersTest.php @@ -51,7 +51,8 @@ class PmaSeleniumDbTriggersTest extends PHPUnit_Extensions_Selenium2TestCase . " PRIMARY KEY (`id`)" . ")" ); - $this->_helper->dbQuery( + + $this->_helper->dbQuery( "CREATE TABLE `test_table2` (" . " `id` int(11) NOT NULL AUTO_INCREMENT," . " `val` int(11) NOT NULL," @@ -123,7 +124,8 @@ class PmaSeleniumDbTriggersTest extends PHPUnit_Extensions_Selenium2TestCase $ele = $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Trigger `test_trigger` has been created')]" + "//div[@class='success' and contains(., " + . "'Trigger `test_trigger` has been created')]" ); $this->assertTrue( @@ -172,7 +174,8 @@ class PmaSeleniumDbTriggersTest extends PHPUnit_Extensions_Selenium2TestCase $ele = $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Trigger `test_trigger` has been modified')]" + "//div[@class='success' and contains(., " + . "'Trigger `test_trigger` has been modified')]" ); // test trigger @@ -203,7 +206,7 @@ class PmaSeleniumDbTriggersTest extends PHPUnit_Extensions_Selenium2TestCase $this->byLinkText("Drop")->click(); $this->_helper->waitForElement( "byXPath", "//button[contains(., 'OK')]" - )->click(); + )->click(); $this->_helper->waitForElement("byId", "nothing2display"); diff --git a/test/selenium/PmaSeleniumTableBrowseTest.php b/test/selenium/PmaSeleniumTableBrowseTest.php index fb89ee2504..f70bbb39d5 100644 --- a/test/selenium/PmaSeleniumTableBrowseTest.php +++ b/test/selenium/PmaSeleniumTableBrowseTest.php @@ -171,7 +171,7 @@ class PmaSeleniumTableBrowseTest extends PHPUnit_Extensions_Selenium2TestCase { $this->byCssSelector( "table#table_results tbody tr:nth-child(2) td:nth-child(2) a" - )->click(); + )->click(); $this->_helper->waitForElement("byId", "insertForm"); $this->assertEquals( @@ -253,7 +253,7 @@ class PmaSeleniumTableBrowseTest extends PHPUnit_Extensions_Selenium2TestCase { $this->byCssSelector( "table#table_results tbody tr:nth-child(3) td:nth-child(3) a" - )->click(); + )->click(); $this->_helper->waitForElement("byId", "insertForm"); diff --git a/test/selenium/PmaSeleniumTableCreateTest.php b/test/selenium/PmaSeleniumTableCreateTest.php index d63f487478..dd2d69f0e4 100644 --- a/test/selenium/PmaSeleniumTableCreateTest.php +++ b/test/selenium/PmaSeleniumTableCreateTest.php @@ -146,7 +146,8 @@ class PmaSeleniumTableCreateTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertFalse( $this->_helper->isElementPresent( 'byCssSelector', - 'table#tablestructure tbody tr:nth-child(1) ul.table-structure-actions li.primary a' + 'table#tablestructure tbody tr:nth-child(1) " + . "ul.table-structure-actions li.primary a' ) ); @@ -178,7 +179,8 @@ class PmaSeleniumTableCreateTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertFalse( $this->_helper->isElementPresent( - 'byCssSelector', 'css=ul.table-structure-actions:nth-child(2) li.primary a' + 'byCssSelector', + 'css=ul.table-structure-actions:nth-child(2) li.primary a' ) ); } diff --git a/test/selenium/PmaSeleniumTableInsertTest.php b/test/selenium/PmaSeleniumTableInsertTest.php index 8d3cfd61ea..6eedab164c 100644 --- a/test/selenium/PmaSeleniumTableInsertTest.php +++ b/test/selenium/PmaSeleniumTableInsertTest.php @@ -98,7 +98,7 @@ class PmaSeleniumTableInsertTest extends PHPUnit_Extensions_Selenium2TestCase // post $this->byCssSelector( "input[value=Go]" - )->click(); + )->click(); $this->_helper->waitForElementNotPresent("byId", "loading_parent"); $ele = $this->_helper->waitForElement("byClassName", "success"); @@ -106,6 +106,11 @@ class PmaSeleniumTableInsertTest extends PHPUnit_Extensions_Selenium2TestCase $this->_assertDataPresent(); } + /** + * Assert various data present in results table + * + * @return void + */ private function _assertDataPresent() { $this->byLinkText("Browse")->click(); diff --git a/test/selenium/PmaSeleniumTableOperationsTest.php b/test/selenium/PmaSeleniumTableOperationsTest.php index c4753a37e5..820273dcdc 100644 --- a/test/selenium/PmaSeleniumTableOperationsTest.php +++ b/test/selenium/PmaSeleniumTableOperationsTest.php @@ -116,7 +116,8 @@ class PmaSeleniumTableOperationsTest extends PHPUnit_Extensions_Selenium2TestCas */ public function testMoveTable() { - $this->byCssSelector("form#moveTableForm input[name='new_name']")->value("2"); + $this->byCssSelector("form#moveTableForm input[name='new_name']") + ->value("2"); $this->byXPath("(//input[@value='Go'])[2]")->click(); diff --git a/test/selenium/PmaSeleniumTableStructureTest.php b/test/selenium/PmaSeleniumTableStructureTest.php index e8e96db6db..be15eb9d02 100644 --- a/test/selenium/PmaSeleniumTableStructureTest.php +++ b/test/selenium/PmaSeleniumTableStructureTest.php @@ -89,7 +89,8 @@ class PmaSeleniumTableStructureTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Table test_table has been altered successfully')]" + "//div[@class='success' and contains(., " + . "'Table test_table has been altered successfully')]" ); $this->byLinkText("Structure")->click(); @@ -124,7 +125,8 @@ class PmaSeleniumTableStructureTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Table test_table has been altered successfully')]" + "//div[@class='success' and contains(., " + . "'Table test_table has been altered successfully')]" ); $this->assertEquals( @@ -142,16 +144,18 @@ class PmaSeleniumTableStructureTest extends PHPUnit_Extensions_Selenium2TestCase { $this->byCssSelector('label[for=checkbox_row_2]')->click(); $this->byCssSelector('label[for=checkbox_row_3]')->click(); - $this->byXPath("//button[@class='mult_submit' and contains(., 'Drop')]")->click(); + $this->byXPath( + "//button[@class='mult_submit' and contains(., 'Drop')]" + )->click(); $this->_helper->waitForElement( "byCssSelector", "input[id='buttonYes']" - ) - ->click(); + )->click(); $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Your SQL query has been executed successfully')]" + "//div[@class='success' and contains(., " + . "'Your SQL query has been executed successfully')]" ); $this->assertFalse( From a970df1dfff9a527cc6e71a4b38ef922753f50e6 Mon Sep 17 00:00:00 2001 From: ayushchd Date: Wed, 28 Aug 2013 18:35:21 +0530 Subject: [PATCH 3/3] Tests for server settings tab --- .../PmaSeleniumServerSettingsTest.php | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 test/selenium/PmaSeleniumServerSettingsTest.php diff --git a/test/selenium/PmaSeleniumServerSettingsTest.php b/test/selenium/PmaSeleniumServerSettingsTest.php new file mode 100644 index 0000000000..1f68406d03 --- /dev/null +++ b/test/selenium/PmaSeleniumServerSettingsTest.php @@ -0,0 +1,164 @@ +_helper = new Helper($this); + $this->setBrowser($this->_helper->getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + $this->_helper->dbConnect(); + $this->_dbname = 'pma_db_' . time(); + $this->_helper->dbQuery('CREATE DATABASE ' . $this->_dbname); + $this->_helper->dbQuery('USE ' . $this->_dbname); + } + + /** + * setUp function that can use the selenium session (called before each test) + * + * @return void + */ + public function setUpPage() + { + $this->_helper->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + $more = $this->byLinkText("More"); + $this->moveto($more); + $this->_helper->waitForElement("byLinkText", "Settings")->click(); + $this->_helper->waitForElement( + "byXPath", "//a[@class='tabactive' and contains(., 'Settings')]" + ); + } + + /** + * Tests whether hiding a database works or not + * + * @return void + */ + public function testHideDatabase() + { + $this->byLinkText("Features")->click(); + + $this->_helper->waitForElement("byId", "Servers-1-hide_db") + ->value($this->_dbname); + $this->byName("submit_save")->click(); + $this->_helper->waitForElement( + "byXPath", + "//div[@class='success' and contains(., 'Configuration has been saved')]" + ); + $this->assertFalse( + $this->_helper->isElementPresent("byLinkText", $this->_dbname) + ); + + $this->byCssSelector("a[href='#Servers-1-hide_db']")->click(); + $this->byName("submit_save")->click(); + $this->_helper->waitForElement( + "byXPath", + "//div[@class='success' and contains(., 'Configuration has been saved')]" + ); + $this->assertTrue( + $this->_helper->isElementPresent("byLinkText", $this->_dbname) + ); + } + + /** + * Tests whether the various settings tabs are displayed when clicked + * + * @return void + */ + public function testSettingsTabsAreDisplayed() + { + $this->byLinkText("SQL queries")->click(); + $this->_helper->waitForElement('byClassName', 'tabs'); + + $this->byLinkText("SQL Query box")->click(); + $this->assertTrue( + $this->byId("Sql_box")->displayed() + ); + $this->assertFalse( + $this->byId("Sql_queries")->displayed() + ); + + $this->byCssSelector("a[href='#Sql_queries']")->click(); + $this->assertFalse( + $this->byId("Sql_box")->displayed() + ); + $this->assertTrue( + $this->byId("Sql_queries")->displayed() + ); + } + + /** + * Tests if hiding the logo works or not + * + * @return void + */ + public function testHideLogo() + { + $this->byLinkText("Navigation panel")->click(); + + $this->_helper->waitForElement("byName", "NavigationDisplayLogo") + ->click(); + $this->byName("submit_save")->click(); + $this->_helper->waitForElement( + "byXPath", + "//div[@class='success' and contains(., 'Configuration has been saved')]" + ); + $this->assertFalse( + $this->_helper->isElementPresent("byId", "imgpmalogo") + ); + + $this->byCssSelector("a[href='#NavigationDisplayLogo']")->click(); + $this->byName("submit_save")->click(); + $this->_helper->waitForElement( + "byXPath", + "//div[@class='success' and contains(., 'Configuration has been saved')]" + ); + $this->assertTrue( + $this->_helper->isElementPresent("byId", "imgpmalogo") + ); + } + + /** + * Tear Down function for test cases + * + * @return void + */ + public function tearDown() + { + $this->_helper->dbQuery('DROP DATABASE IF EXISTS ' . $this->_dbname); + } + +}