diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2021-09-15 20:22:39 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2021-09-15 23:05:40 +0300 |
commit | f00d70cccb65b01504afc8c1a1a2ce8042f4c3fe (patch) | |
tree | d425a6c17c523a7580617b696cc8c861927bc14d /test/selenium | |
parent | 70c43a98633dc475834a0a8d008d96e846dd2ec3 (diff) |
Remove useless whitespaces
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test/selenium')
-rw-r--r-- | test/selenium/CreateDropDatabaseTest.php | 13 | ||||
-rw-r--r-- | test/selenium/CreateRemoveUserTest.php | 4 | ||||
-rw-r--r-- | test/selenium/Database/EventsTest.php | 15 | ||||
-rw-r--r-- | test/selenium/Database/OperationsTest.php | 14 | ||||
-rw-r--r-- | test/selenium/Database/ProceduresTest.php | 24 | ||||
-rw-r--r-- | test/selenium/Database/QueryByExampleTest.php | 5 | ||||
-rw-r--r-- | test/selenium/Database/StructureTest.php | 10 | ||||
-rw-r--r-- | test/selenium/Database/TriggersTest.php | 15 | ||||
-rw-r--r-- | test/selenium/NormalizationTest.php | 25 | ||||
-rw-r--r-- | test/selenium/ServerSettingsTest.php | 5 | ||||
-rw-r--r-- | test/selenium/Table/BrowseTest.php | 17 | ||||
-rw-r--r-- | test/selenium/Table/CreateTest.php | 9 | ||||
-rw-r--r-- | test/selenium/Table/InsertTest.php | 4 | ||||
-rw-r--r-- | test/selenium/Table/OperationsTest.php | 19 | ||||
-rw-r--r-- | test/selenium/Table/StructureTest.php | 25 | ||||
-rw-r--r-- | test/selenium/TestBase.php | 109 | ||||
-rw-r--r-- | test/selenium/TrackingTest.php | 20 |
17 files changed, 68 insertions, 265 deletions
diff --git a/test/selenium/CreateDropDatabaseTest.php b/test/selenium/CreateDropDatabaseTest.php index 13473acd25..ad8f543a5d 100644 --- a/test/selenium/CreateDropDatabaseTest.php +++ b/test/selenium/CreateDropDatabaseTest.php @@ -27,9 +27,7 @@ class CreateDropDatabaseTest extends TestBase */ public function testCreateDropDatabase(): void { - $this->dbQuery( - 'DROP DATABASE IF EXISTS `' . $this->databaseName . '`;' - ); + $this->dbQuery('DROP DATABASE IF EXISTS `' . $this->databaseName . '`;'); $this->waitForElement('partialLinkText', 'Databases')->click(); $this->waitAjax(); @@ -65,9 +63,7 @@ class CreateDropDatabaseTest extends TestBase $this->scrollToBottom(); - $dbElement = $this->byCssSelector( - "input[name='selected_dbs[]'][value='" . $this->databaseName . "']" - ); + $dbElement = $this->byCssSelector("input[name='selected_dbs[]'][value='" . $this->databaseName . "']"); $this->scrollToElement($dbElement, 0, 20); $dbElement->click(); @@ -81,10 +77,7 @@ class CreateDropDatabaseTest extends TestBase "input[name='selected_dbs[]'][value='" . $this->databaseName . "']" ); - $this->waitForElement( - 'cssSelector', - 'span.ajax_notification .alert-success' - ); + $this->waitForElement('cssSelector', 'span.ajax_notification .alert-success'); $this->dbQuery( 'SHOW DATABASES LIKE \'' . $this->databaseName . '\';', diff --git a/test/selenium/CreateRemoveUserTest.php b/test/selenium/CreateRemoveUserTest.php index 8162140386..333ee8b889 100644 --- a/test/selenium/CreateRemoveUserTest.php +++ b/test/selenium/CreateRemoveUserTest.php @@ -98,9 +98,7 @@ class CreateRemoveUserTest extends TestBase $this->waitForElement('id', 'usersForm'); $temp = $this->txtUsername . '&#27;localhost'; - $this->byXPath( - "(//input[@name='selected_usr[]'])[@value='" . $temp . "']" - )->click(); + $this->byXPath("(//input[@name='selected_usr[]'])[@value='" . $temp . "']")->click(); $this->scrollIntoView('deleteUserCard'); $this->byId('dropUsersDbCheckbox')->click(); diff --git a/test/selenium/Database/EventsTest.php b/test/selenium/Database/EventsTest.php index c047aadba5..9066e8c531 100644 --- a/test/selenium/Database/EventsTest.php +++ b/test/selenium/Database/EventsTest.php @@ -169,10 +169,7 @@ class EventsTest extends TestBase $this->waitForElement('partialLinkText', 'Events')->click(); $this->waitAjax(); - $this->waitForElement( - 'xpath', - '//div[contains(., "Event scheduler status")]' - ); + $this->waitForElement('xpath', '//div[contains(., "Event scheduler status")]'); $this->byPartialLinkText('Edit')->click(); @@ -211,16 +208,10 @@ class EventsTest extends TestBase $this->waitForElement('partialLinkText', 'Events')->click(); $this->waitAjax(); - $this->waitForElement( - 'xpath', - '//div[contains(., "Event scheduler status")]' - ); + $this->waitForElement('xpath', '//div[contains(., "Event scheduler status")]'); $this->byPartialLinkText('Drop')->click(); - $this->waitForElement( - 'className', - 'submitOK' - )->click(); + $this->waitForElement('className', 'submitOK')->click(); $this->waitAjaxMessage(); diff --git a/test/selenium/Database/OperationsTest.php b/test/selenium/Database/OperationsTest.php index 1753785c29..fdcf2cca61 100644 --- a/test/selenium/Database/OperationsTest.php +++ b/test/selenium/Database/OperationsTest.php @@ -29,10 +29,7 @@ class OperationsTest extends TestBase $this->navigateDatabase($this->databaseName); $this->expandMore(); $this->waitForElement('partialLinkText', 'Operations')->click(); - $this->waitForElement( - 'xpath', - '//div[contains(., \'Rename database to\')]' - ); + $this->waitForElement('xpath', '//div[contains(., \'Rename database to\')]'); } /** @@ -46,9 +43,7 @@ class OperationsTest extends TestBase $this->getToDBOperations(); $this->byName('comment')->sendKeys('comment_foobar'); - $this->byCssSelector( - "form#formDatabaseComment input[type='submit']" - )->click(); + $this->byCssSelector("form#formDatabaseComment input[type='submit']")->click(); $this->assertNotNull( $this->waitForElement( @@ -75,10 +70,7 @@ class OperationsTest extends TestBase $this->byCssSelector("form#rename_db_form input[type='submit']")->click(); - $this->waitForElement( - 'cssSelector', - 'button.submitOK' - )->click(); + $this->waitForElement('cssSelector', 'button.submitOK')->click(); $this->waitForElement( 'xpath', diff --git a/test/selenium/Database/ProceduresTest.php b/test/selenium/Database/ProceduresTest.php index 28aa0fc5ac..41063981bc 100644 --- a/test/selenium/Database/ProceduresTest.php +++ b/test/selenium/Database/ProceduresTest.php @@ -86,9 +86,7 @@ class ProceduresTest extends TestBase protected function tearDown(): void { if ($this->originalSqlMode !== '') { - $this->dbQuery( - "SET GLOBAL sql_mode = '" . $this->originalSqlMode . "';" - ); + $this->dbQuery("SET GLOBAL sql_mode = '" . $this->originalSqlMode . "';"); $this->assertEquals( $this->originalSqlMode, $this->getSqlMode() @@ -181,10 +179,7 @@ class ProceduresTest extends TestBase $this->waitForElement('partialLinkText', 'Routines')->click(); $this->waitAjax(); - $this->waitForElement( - 'id', - 'checkAllCheckbox' - ); + $this->waitForElement('id', 'checkAllCheckbox'); $this->byPartialLinkText('Edit')->click(); $this->waitForElement('className', 'rte_form'); @@ -213,16 +208,10 @@ class ProceduresTest extends TestBase $this->waitForElement('partialLinkText', 'Routines')->click(); $this->waitAjax(); - $this->waitForElement( - 'id', - 'checkAllCheckbox' - ); + $this->waitForElement('id', 'checkAllCheckbox'); $this->byPartialLinkText('Drop')->click(); - $this->waitForElement( - 'cssSelector', - 'button.submitOK' - )->click(); + $this->waitForElement('cssSelector', 'button.submitOK')->click(); $this->waitAjaxMessage(); @@ -248,10 +237,7 @@ class ProceduresTest extends TestBase $this->byCssSelector('div.ui-dialog-buttonset button:nth-child(1)')->click(); $this->waitAjax(); - $this->waitForElement( - 'cssSelector', - 'span#PMA_slidingMessage table tbody' - ); + $this->waitForElement('cssSelector', 'span#PMA_slidingMessage table tbody'); $this->waitUntilElementIsVisible('cssSelector', 'span#PMA_slidingMessage', 30); sleep(2);// Give more chances to the JS effect to finish $head = $this->byCssSelector('span#PMA_slidingMessage table tbody')->getText(); diff --git a/test/selenium/Database/QueryByExampleTest.php b/test/selenium/Database/QueryByExampleTest.php index 1c24cf4e68..75896a8ebe 100644 --- a/test/selenium/Database/QueryByExampleTest.php +++ b/test/selenium/Database/QueryByExampleTest.php @@ -112,10 +112,7 @@ class QueryByExampleTest extends TestBase $actual = trim((string) $this->waitForElement('id', 'textSqlquery')->getAttribute('value')); /* Compare generated query */ - $this->assertEquals( - $expected, - $actual - ); + $this->assertEquals($expected, $actual); /* Submit the query */ $submitButton = $this->waitForElement('cssSelector', '#tblQbeFooters > input[type=submit]'); diff --git a/test/selenium/Database/StructureTest.php b/test/selenium/Database/StructureTest.php index 219c3a925a..e4ddc15bab 100644 --- a/test/selenium/Database/StructureTest.php +++ b/test/selenium/Database/StructureTest.php @@ -49,10 +49,7 @@ class StructureTest extends TestBase { $this->byXPath("(//a[contains(., 'Empty')])[1]")->click(); - $this->waitForElement( - 'cssSelector', - 'button.submitOK' - )->click(); + $this->waitForElement('cssSelector', 'button.submitOK')->click(); $this->assertNotNull( $this->waitForElement( @@ -89,10 +86,7 @@ class StructureTest extends TestBase $this->waitForElement('id', 'buttonYes') ->click(); - $this->waitForElement( - 'xpath', - "//*[contains(., 'No tables found in database')]" - ); + $this->waitForElement('xpath', "//*[contains(., 'No tables found in database')]"); $this->dbQuery( 'SHOW TABLES FROM `' . $this->databaseName . '`;', diff --git a/test/selenium/Database/TriggersTest.php b/test/selenium/Database/TriggersTest.php index ec85563c99..30de261ce4 100644 --- a/test/selenium/Database/TriggersTest.php +++ b/test/selenium/Database/TriggersTest.php @@ -143,10 +143,7 @@ class TriggersTest extends TestBase $this->waitForElement('partialLinkText', 'Triggers')->click(); $this->waitAjax(); - $this->waitForElement( - 'id', - 'checkAllCheckbox' - ); + $this->waitForElement('id', 'checkAllCheckbox'); $this->byPartialLinkText('Edit')->click(); @@ -190,16 +187,10 @@ class TriggersTest extends TestBase $ele = $this->waitForElement('partialLinkText', 'Triggers'); $ele->click(); - $this->waitForElement( - 'id', - 'checkAllCheckbox' - ); + $this->waitForElement('id', 'checkAllCheckbox'); $this->byPartialLinkText('Drop')->click(); - $this->waitForElement( - 'cssSelector', - 'button.submitOK' - )->click(); + $this->waitForElement('cssSelector', 'button.submitOK')->click(); $this->waitAjaxMessage(); diff --git a/test/selenium/NormalizationTest.php b/test/selenium/NormalizationTest.php index 863e60dc81..df8d6c4eb8 100644 --- a/test/selenium/NormalizationTest.php +++ b/test/selenium/NormalizationTest.php @@ -27,10 +27,7 @@ class NormalizationTest extends TestBase $this->login(); $this->navigateTable('test_table'); - $this->waitForElement( - 'xpath', - "(//a[contains(., 'Structure')])" - )->click(); + $this->waitForElement('xpath', "(//a[contains(., 'Structure')])")->click(); $this->waitAjax(); @@ -115,21 +112,12 @@ class NormalizationTest extends TestBase 'no_such_col' ); - $this->waitForElement( - 'xpath', - "//legend[contains(., 'Step 1.2 Have a primary key')]" - ); + $this->waitForElement('xpath', "//legend[contains(., 'Step 1.2 Have a primary key')]"); $text = $this->byCssSelector('#mainContent h4')->getText(); $this->assertStringContainsString('Primary key already exists.', $text); - $this->waitForElement( - 'xpath', - "//legend[contains(., 'Step 1.3 Move repeating groups')]" - ); + $this->waitForElement('xpath', "//legend[contains(., 'Step 1.3 Move repeating groups')]"); $this->byCssSelector('input[value="No repeating group"]')->click(); - $this->waitForElement( - 'xpath', - "//legend[contains(., 'Step 1.4 Remove redundant columns')]" - ); + $this->waitForElement('xpath', "//legend[contains(., 'Step 1.4 Remove redundant columns')]"); $this->assertTrue( $this->isElementPresent( 'cssSelector', @@ -150,10 +138,7 @@ class NormalizationTest extends TestBase ); $this->byCssSelector('#extra input[value=val][type=checkbox]')->click(); $this->byCssSelector('#removeRedundant')->click(); - $this->waitForElement( - 'xpath', - "//legend[contains(., 'End of step')]" - ); + $this->waitForElement('xpath', "//legend[contains(., 'End of step')]"); $this->assertStringContainsString( "The first step of normalization is complete for table 'test_table'.", $this->byCssSelector('#mainContent h4')->getText() diff --git a/test/selenium/ServerSettingsTest.php b/test/selenium/ServerSettingsTest.php index 301bb93a94..98f1604551 100644 --- a/test/selenium/ServerSettingsTest.php +++ b/test/selenium/ServerSettingsTest.php @@ -27,10 +27,7 @@ class ServerSettingsTest extends TestBase $this->waitForElement('partialLinkText', 'Settings')->click(); $this->waitAjax(); - $this->waitForElement( - 'xpath', - "//a[@class='nav-link text-nowrap' and contains(., 'Settings')]" - ); + $this->waitForElement('xpath', "//a[@class='nav-link text-nowrap' and contains(., 'Settings')]"); } /** diff --git a/test/selenium/Table/BrowseTest.php b/test/selenium/Table/BrowseTest.php index 0bbc969546..f8b98e5c68 100644 --- a/test/selenium/Table/BrowseTest.php +++ b/test/selenium/Table/BrowseTest.php @@ -130,9 +130,7 @@ class BrowseTest extends TestBase */ public function testChangeRecords(): void { - $ele = $this->byCssSelector( - 'table.table_results tbody tr:nth-child(2) td:nth-child(2)' - ); + $ele = $this->byCssSelector('table.table_results tbody tr:nth-child(2) td:nth-child(2)'); $this->moveto($ele); $this->click(); @@ -188,9 +186,7 @@ class BrowseTest extends TestBase */ public function testChangeRecordsByDoubleClick(): void { - $element = $this->byCssSelector( - 'table.table_results tbody tr:nth-child(1) td:nth-child(6)' - ); + $element = $this->byCssSelector('table.table_results tbody tr:nth-child(1) td:nth-child(6)'); $this->moveto($element); $this->doubleclick(); @@ -209,10 +205,7 @@ class BrowseTest extends TestBase $this->keys(WebDriverKeys::RETURN_KEY); $this->waitAjax(); - $success = $this->waitForElement( - 'cssSelector', - 'span.ajax_notification .alert-success' - ); + $success = $this->waitForElement('cssSelector', 'span.ajax_notification .alert-success'); $this->assertStringContainsString('1 row affected', $success->getText()); $this->assertEquals( @@ -228,9 +221,7 @@ class BrowseTest extends TestBase */ public function testCopyRecords(): void { - $ele = $this->byCssSelector( - 'table.table_results tbody tr:nth-child(3) td:nth-child(3)' - ); + $ele = $this->byCssSelector('table.table_results tbody tr:nth-child(3) td:nth-child(3)'); $this->moveto($ele); $this->click(); $this->waitForElement('id', 'insertForm'); diff --git a/test/selenium/Table/CreateTest.php b/test/selenium/Table/CreateTest.php index 363bd16625..16eda5b44e 100644 --- a/test/selenium/Table/CreateTest.php +++ b/test/selenium/Table/CreateTest.php @@ -36,9 +36,7 @@ class CreateTest extends TestBase $this->waitAjax(); $this->waitForElement('id', 'create_table_form_minimal'); - $this->byCssSelector( - 'form#create_table_form_minimal input[name=table]' - )->sendKeys('test_table'); + $this->byCssSelector('form#create_table_form_minimal input[name=table]')->sendKeys('test_table'); $this->byName('num_fields')->clear(); $this->byName('num_fields')->sendKeys('4'); $this->byCssSelector('input[value=Go]')->click(); @@ -84,10 +82,7 @@ class CreateTest extends TestBase $this->moveto($ele); // post $ele->click(); - $this->waitForElement( - 'cssSelector', - 'li.last.table' - ); + $this->waitForElement('cssSelector', 'li.last.table'); $this->waitAjax(); diff --git a/test/selenium/Table/InsertTest.php b/test/selenium/Table/InsertTest.php index 0aca36d1ce..5a51559eef 100644 --- a/test/selenium/Table/InsertTest.php +++ b/test/selenium/Table/InsertTest.php @@ -83,9 +83,7 @@ class InsertTest extends TestBase $this->byId('field_2_3')->sendKeys('Abcd'); // post - $this->byCssSelector( - 'input[value=Go]' - )->click(); + $this->byCssSelector('input[value=Go]')->click(); $this->waitAjax(); diff --git a/test/selenium/Table/OperationsTest.php b/test/selenium/Table/OperationsTest.php index 1dba4cd1a4..57750af91d 100644 --- a/test/selenium/Table/OperationsTest.php +++ b/test/selenium/Table/OperationsTest.php @@ -43,15 +43,9 @@ class OperationsTest extends TestBase $this->byXPath("//a[contains(., 'Operations')]")->click(); $this->waitAjax(); - $this->waitForElement( - 'xpath', - "//div[contains(., 'Table maintenance')]" - ); + $this->waitForElement('xpath', "//div[contains(., 'Table maintenance')]"); $this->reloadPage(); - $this->waitForElement( - 'xpath', - "//div[contains(., 'Table maintenance')]" - ); + $this->waitForElement('xpath', "//div[contains(., 'Table maintenance')]"); } /** @@ -67,9 +61,7 @@ class OperationsTest extends TestBase ); $this->byId('tableOrderDescRadio')->click(); - $this->byCssSelector( - "form#alterTableOrderby input[type='submit']" - )->click(); + $this->byCssSelector("form#alterTableOrderby input[type='submit']")->click(); $this->waitAjax(); @@ -240,10 +232,7 @@ class OperationsTest extends TestBase . "contains(., 'MySQL returned an empty result set')]" ); - $this->waitForElement( - 'xpath', - "//a[@class='nav-link text-nowrap' and contains(., 'Structure')]" - ); + $this->waitForElement('xpath', "//a[@class='nav-link text-nowrap' and contains(., 'Structure')]"); $this->dbQuery( 'USE `' . $this->databaseName . '`;' diff --git a/test/selenium/Table/StructureTest.php b/test/selenium/Table/StructureTest.php index 9065632e90..b7a79d3274 100644 --- a/test/selenium/Table/StructureTest.php +++ b/test/selenium/Table/StructureTest.php @@ -30,10 +30,7 @@ class StructureTest extends TestBase $this->login(); $this->navigateTable('test_table'); - $this->waitForElement( - 'xpath', - "(//a[contains(., 'Structure')])" - )->click(); + $this->waitForElement('xpath', "(//a[contains(., 'Structure')])")->click(); $this->waitAjax(); $this->waitForElement('id', 'tablestructure'); @@ -46,10 +43,7 @@ class StructureTest extends TestBase */ public function testAddColumn(): void { - $this->waitForElement( - 'cssSelector', - "#addColumns > input[value='Go']" - )->click(); + $this->waitForElement('cssSelector', "#addColumns > input[value='Go']")->click(); $this->waitAjax(); $this->waitUntilElementIsPresent('className', 'append_fields_form', 30); @@ -81,9 +75,7 @@ class StructureTest extends TestBase */ public function testChangeColumn(): void { - $this->byCssSelector( - '#tablestructure tbody tr:nth-child(2) td:nth-child(11)' - )->click(); + $this->byCssSelector('#tablestructure tbody tr:nth-child(2) td:nth-child(11)')->click(); $this->waitAjax(); $this->waitUntilElementIsPresent('className', 'append_fields_form', 30); @@ -113,16 +105,9 @@ class StructureTest extends TestBase { $this->waitForElement('cssSelector', 'label[for=checkbox_row_2]')->click(); $this->waitForElement('cssSelector', 'label[for=checkbox_row_3]')->click(); - $this->waitUntilElementIsPresent( - 'xpath', - '//button[contains(., "Drop")]', - 30 - )->click(); + $this->waitUntilElementIsPresent('xpath', '//button[contains(., "Drop")]', 30)->click(); - $this->waitForElement( - 'cssSelector', - "input[id='buttonYes']" - )->click(); + $this->waitForElement('cssSelector', "input[id='buttonYes']")->click(); $this->waitForElement( 'xpath', diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index c36e93a8d7..f809e22573 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -136,10 +136,7 @@ abstract class TestBase extends TestCase $this->addCapabilities($capabilities); $url = $this->getHubUrl(); - $this->webDriver = RemoteWebDriver::create( - $url, - $capabilities - ); + $this->webDriver = RemoteWebDriver::create($url, $capabilities); // The session Id is only used by BrowserStack if ($this->hasBrowserstackConfig()) { @@ -348,10 +345,7 @@ abstract class TestBase extends TestCase $capabilities = DesiredCapabilities::chrome(); $chromeOptions = new ChromeOptions(); $chromeOptions->addArguments(['--lang=en']); - $capabilities->setCapability( - ChromeOptions::CAPABILITY_W3C, - $chromeOptions - ); + $capabilities->setCapability(ChromeOptions::CAPABILITY_W3C, $chromeOptions); $capabilities->setCapability( 'loggingPrefs', ['browser' => 'ALL'] @@ -370,10 +364,7 @@ abstract class TestBase extends TestCase 'browser_version', '80.0' // Force chrome 80.0 ); - $capabilities->setCapability( - 'resolution', - '1920x1080' - ); + $capabilities->setCapability('resolution', '1920x1080'); } return $capabilities; @@ -463,19 +454,12 @@ abstract class TestBase extends TestCase { $this->navigateTo('index.php?route=/check-relations'); $pageContent = $this->waitForElement('id', 'page_content'); - if ( - ! preg_match( - '/Configuration of pmadb… not OK/i', - $pageContent->getText() - ) - ) { + if (! preg_match('/Configuration of pmadb… not OK/i', $pageContent->getText())) { return; } if (! $this->fixUpPhpMyAdminStorage()) { - $this->markTestSkipped( - 'The phpMyAdmin configuration storage is not working.' - ); + $this->markTestSkipped('The phpMyAdmin configuration storage is not working.'); } // If it failed the code already has exited with markTestSkipped @@ -501,11 +485,7 @@ abstract class TestBase extends TestCase $this->navigateTo(''); /* Wait while page */ - while ( - $this->webDriver->executeScript( - 'return document.readyState !== "complete";' - ) - ) { + while ($this->webDriver->executeScript('return document.readyState !== "complete";')) { usleep(5000); } @@ -733,10 +713,7 @@ abstract class TestBase extends TestCase */ public function isLoggedIn(): bool { - return $this->isElementPresent( - 'xpath', - '//*[@class="navigationbar"]' - ); + return $this->isElementPresent('xpath', '//*[@class="navigationbar"]'); } /** @@ -845,15 +822,8 @@ abstract class TestBase extends TestCase */ public function getCellByTableId(string $tableID, int $row, int $column): string { - $sel = sprintf( - 'table#%s tbody tr:nth-child(%d) td:nth-child(%d)', - $tableID, - $row, - $column - ); - $element = $this->byCssSelector( - $sel - ); + $sel = sprintf('table#%s tbody tr:nth-child(%d) td:nth-child(%d)', $tableID, $row, $column); + $element = $this->byCssSelector($sel); $text = $element->getText(); return $text && is_string($text) ? trim($text) : ''; @@ -870,15 +840,8 @@ abstract class TestBase extends TestCase */ public function getCellByTableClass(string $tableClass, int $row, int $column): string { - $sel = sprintf( - 'table.%s tbody tr:nth-child(%d) td:nth-child(%d)', - $tableClass, - $row, - $column - ); - $element = $this->byCssSelector( - $sel - ); + $sel = sprintf('table.%s tbody tr:nth-child(%d) td:nth-child(%d)', $tableClass, $row, $column); + $element = $this->byCssSelector($sel); $text = $element->getText(); return $text && is_string($text) ? trim($text) : ''; @@ -980,11 +943,7 @@ abstract class TestBase extends TestCase $ele->click(); $this->waitForElement('cssSelector', 'li.dropdown.show > a'); - $this->waitUntilElementIsPresent( - 'cssSelector', - 'li.nav-item.dropdown.show > ul', - 5000 - ); + $this->waitUntilElementIsPresent('cssSelector', 'li.nav-item.dropdown.show > ul', 5000); } catch (WebDriverException $e) { return; } @@ -1001,16 +960,10 @@ abstract class TestBase extends TestCase $this->navigateDatabase($this->databaseName, $gotoHomepageRequired); // go to table page - $this->waitForElement( - 'xpath', - "//th//a[contains(., '" . $table . "')]" - )->click(); + $this->waitForElement('xpath', "//th//a[contains(., '" . $table . "')]")->click(); $this->waitAjax(); - $this->waitForElement( - 'xpath', - "//a[@class='nav-link text-nowrap' and contains(., 'Browse')]" - ); + $this->waitForElement('xpath', "//a[@class='nav-link text-nowrap' and contains(., 'Browse')]"); } /** @@ -1037,10 +990,7 @@ abstract class TestBase extends TestCase $this->waitAjax(); // Wait for it to load - $this->waitForElement( - 'xpath', - "//a[@class='nav-link text-nowrap' and contains(., 'Structure')]" - ); + $this->waitForElement('xpath', "//a[@class='nav-link text-nowrap' and contains(., 'Structure')]"); } /** @@ -1103,9 +1053,7 @@ abstract class TestBase extends TestCase */ public function scrollToBottom(): void { - $this->webDriver->executeScript( - 'window.scrollTo(0,document.body.scrollHeight);' - ); + $this->webDriver->executeScript('window.scrollTo(0,document.body.scrollHeight);'); } /** @@ -1113,9 +1061,7 @@ abstract class TestBase extends TestCase */ public function reloadPage(): void { - $this->webDriver->executeScript( - 'window.location.reload();' - ); + $this->webDriver->executeScript('window.location.reload();'); } /** @@ -1143,14 +1089,9 @@ abstract class TestBase extends TestCase public function waitAjaxMessage(): void { /* Get current message count */ - $ajax_message_count = $this->webDriver->executeScript( - 'return ajaxMessageCount;' - ); + $ajax_message_count = $this->webDriver->executeScript('return ajaxMessageCount;'); /* Ensure the popup is gone */ - $this->waitForElementNotPresent( - 'id', - 'ajax_message_num_' . $ajax_message_count - ); + $this->waitForElementNotPresent('id', 'ajax_message_num_' . $ajax_message_count); } /** @@ -1195,11 +1136,7 @@ abstract class TestBase extends TestCase ] ); $ch = curl_init(); - curl_setopt( - $ch, - CURLOPT_URL, - self::SESSION_REST_URL . $this->sessionId . '.json' - ); + curl_setopt($ch, CURLOPT_URL, self::SESSION_REST_URL . $this->sessionId . '.json'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); @@ -1228,11 +1165,7 @@ abstract class TestBase extends TestCase } $ch = curl_init(); - curl_setopt( - $ch, - CURLOPT_URL, - self::SESSION_REST_URL . $this->sessionId . '.json' - ); + curl_setopt($ch, CURLOPT_URL, self::SESSION_REST_URL . $this->sessionId . '.json'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt( $ch, diff --git a/test/selenium/TrackingTest.php b/test/selenium/TrackingTest.php index 2904bd2e2e..eb31fdcba4 100644 --- a/test/selenium/TrackingTest.php +++ b/test/selenium/TrackingTest.php @@ -58,10 +58,7 @@ class TrackingTest extends TestBase $this->executeSqlAndReturnToTableTracking(); $this->byPartialLinkText('Tracking report')->click(); - $this->waitForElement( - 'xpath', - "//h3[contains(., 'Tracking report')]" - ); + $this->waitForElement('xpath', "//h3[contains(., 'Tracking report')]"); $this->assertStringContainsString( 'DROP TABLE IF EXISTS `test_table`', @@ -140,10 +137,7 @@ class TrackingTest extends TestBase public function testDeactivateTracking(): void { $this->byCssSelector("input[value='Deactivate now']")->click(); - $this->waitForElement( - 'cssSelector', - "input[value='Activate now']" - ); + $this->waitForElement('cssSelector', "input[value='Activate now']"); $this->executeSqlAndReturnToTableTracking(); $this->assertFalse( $this->isElementPresent('id', 'dml_versions') @@ -165,17 +159,11 @@ class TrackingTest extends TestBase $this->waitAjax(); $this->waitForElement('id', 'versions'); - $ele = $this->waitForElement( - 'cssSelector', - 'table#versions tbody tr:nth-child(1) td:nth-child(7) a' - ); + $ele = $this->waitForElement('cssSelector', 'table#versions tbody tr:nth-child(1) td:nth-child(7) a'); $this->moveto($ele); $this->click(); - $this->waitForElement( - 'cssSelector', - 'button.submitOK' - )->click(); + $this->waitForElement('cssSelector', 'button.submitOK')->click(); $this->waitAjax(); $this->waitForElement( |