From 24cb353595ac0bbe41b4a86195a2f77c191390f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 2 Mar 2021 20:30:03 -0300 Subject: [PATCH 1/3] Fix CreateDropDatabaseTest Selenium test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- templates/server/databases/index.twig | 2 +- test/selenium/CreateDropDatabaseTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/server/databases/index.twig b/templates/server/databases/index.twig index 65292f7ce8..f2241719df 100644 --- a/templates/server/databases/index.twig +++ b/templates/server/databases/index.twig @@ -64,7 +64,7 @@ - diff --git a/test/selenium/CreateDropDatabaseTest.php b/test/selenium/CreateDropDatabaseTest.php index 114298e83f..c5d5d44f80 100644 --- a/test/selenium/CreateDropDatabaseTest.php +++ b/test/selenium/CreateDropDatabaseTest.php @@ -76,10 +76,10 @@ class CreateDropDatabaseTest extends TestBase $this->scrollToElement($dbElement, 0, 20); $dbElement->click(); - $multSubmit = $this->byCssSelector('button#bulkActionDropButton'); + $multSubmit = $this->byCssSelector('#bulkActionDropButton'); $this->scrollToElement($multSubmit); $multSubmit->click(); - $this->byCssSelector('button.submitOK')->click(); + $this->byCssSelector('#dropDatabaseModalDropButton')->click(); $this->waitForElementNotPresent( 'cssSelector', From 6acd66bb89224b1ef31bda4b8f262cd71cbae70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 2 Mar 2021 20:31:02 -0300 Subject: [PATCH 2/3] Fix ServerSettingsTest Selenium test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/selenium/ServerSettingsTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/selenium/ServerSettingsTest.php b/test/selenium/ServerSettingsTest.php index 1dc2fa4535..8eca473fa9 100644 --- a/test/selenium/ServerSettingsTest.php +++ b/test/selenium/ServerSettingsTest.php @@ -46,7 +46,8 @@ class ServerSettingsTest extends TestBase // Submit the form $ele = $this->waitForElement( 'xpath', - "//fieldset[not(contains(@style,'display: none;'))]//input[@value='Apply']" + "//div[contains(@class, 'tab-pane') and contains(@class, 'show')" + . " and contains(@class, 'active')]//input[@value='Apply']" ); $this->scrollToBottom(); $this->moveto($ele); @@ -82,6 +83,8 @@ class ServerSettingsTest extends TestBase $this->isElementPresent('partialLinkText', $this->databaseName) ); + $this->waitForElement('xpath', "//a[contains(@href, '#Databases')]")->click(); + $this->waitForElement('name', 'Servers-1-hide_db')->clear(); $this->saveConfig(); $this->assertTrue( @@ -99,7 +102,7 @@ class ServerSettingsTest extends TestBase $this->byPartialLinkText('SQL queries')->click(); $this->waitAjax(); - $this->waitForElement('className', 'tabs'); + $this->waitForElement('className', 'nav-tabs'); $this->byPartialLinkText('SQL Query box')->click(); $this->assertTrue( From eb2c23f4dce3f4d0e928194576a35d6e2cb76ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 2 Mar 2021 20:31:30 -0300 Subject: [PATCH 3/3] Fix Selenium tests that are blocked by Console button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is not the better fix. The Console JavaScript is too slow for Selenium. Signed-off-by: Maurício Meneghini Fauth --- test/selenium/ExportTest.php | 8 ++++++++ test/selenium/Table/OperationsTest.php | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/test/selenium/ExportTest.php b/test/selenium/ExportTest.php index 30d987354c..06793c7a9f 100644 --- a/test/selenium/ExportTest.php +++ b/test/selenium/ExportTest.php @@ -7,6 +7,8 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium; +use function sleep; + /** * ExportTest class * @@ -154,11 +156,15 @@ class ExportTest extends TestBase $this->byName('limit_to')->sendKeys('1'); } + $this->scrollIntoView('radio_view_as_text'); + sleep(1); $this->scrollIntoView('radio_view_as_text'); $this->byCssSelector('label[for=radio_view_as_text]')->click(); if ($plugin === 'SQL') { if ($type !== 'db') { + $this->scrollIntoView('radio_sql_structure_or_data_structure_and_data'); + sleep(1); $this->scrollIntoView('radio_sql_structure_or_data_structure_and_data'); $this->byCssSelector('label[for=radio_sql_structure_or_data_structure_and_data]')->click(); } @@ -170,6 +176,8 @@ class ExportTest extends TestBase } } + $this->scrollToBottom(); + sleep(1); $this->scrollToBottom(); $this->byId('buttonGo')->click(); diff --git a/test/selenium/Table/OperationsTest.php b/test/selenium/Table/OperationsTest.php index 8a135f0a20..eabfb08f51 100644 --- a/test/selenium/Table/OperationsTest.php +++ b/test/selenium/Table/OperationsTest.php @@ -8,6 +8,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Selenium\Table; use PhpMyAdmin\Tests\Selenium\TestBase; +use function sleep; /** * OperationsTest class @@ -136,6 +137,8 @@ class OperationsTest extends TestBase $this->byName('comment')->sendKeys('foobar'); + $this->scrollIntoView('tableOptionsForm'); + sleep(1); $this->scrollIntoView('tableOptionsForm'); $this->waitUntilElementIsVisible('cssSelector', 'form#tableOptionsForm', 30); $this->byCssSelector("form#tableOptionsForm input[type='submit']")->click(); @@ -164,6 +167,8 @@ class OperationsTest extends TestBase */ public function testCopyTable(): void { + $this->scrollIntoView('copyTable'); + sleep(1); $this->scrollIntoView('copyTable'); $this->waitUntilElementIsVisible('cssSelector', 'form#copyTable', 30); $this->byCssSelector("form#copyTable input[name='new_name']")->sendKeys('2'); @@ -195,6 +200,8 @@ class OperationsTest extends TestBase */ public function testTruncateTable(): void { + $this->scrollToBottom(); + sleep(1); $this->scrollToBottom(); $this->waitUntilElementIsVisible('id', 'drop_tbl_anchor', 30); $this->byId('truncate_tbl_anchor')->click(); @@ -224,7 +231,9 @@ class OperationsTest extends TestBase public function testDropTable(): void { $dropLink = $this->waitUntilElementIsVisible('partialLinkText', 'Delete the table (DROP)', 30); - $this->scrollToElement($this->byId('selflink')); + $this->scrollToBottom(); + sleep(1); + $this->scrollToBottom(); $dropLink->click(); $this->byCssSelector('button.submitOK')->click(); $this->waitAjax();