From 00535c50c30b344fa84a85786420f3dbf16d064f Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 May 2020 21:52:29 +0200 Subject: [PATCH 1/6] Rewrite waitAjax selenium function Signed-off-by: William Desportes --- test/selenium/TestBase.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index 94b9fc14d9..e90b6d88b9 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -1020,17 +1020,21 @@ abstract class TestBase extends TestCase /** * Wait for AJAX completion - * - * @return void */ - public function waitAjax() + public function waitAjax(): void { /* Wait while code is loading */ - while ($this->webDriver->executeScript( - 'return AJAX.active;' - )) { - usleep(5000); - } + $this->webDriver->executeAsyncScript( + 'var callback = arguments[arguments.length - 1];' + . 'function startWaitingForAjax() {' + . ' if (! AJAX.active) {' + . ' callback();' + . ' } else {' + . ' setTimeout(startWaitingForAjax, 200);' + . ' }' + . '}' + . 'startWaitingForAjax();' + ); } /** From 853e7c870bb1852f2b22d1f0bc166668a1cfbebd Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 May 2020 23:09:38 +0200 Subject: [PATCH 2/6] Fix testServerExport by adding quotes to the selector Signed-off-by: William Desportes --- test/selenium/ExportTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/selenium/ExportTest.php b/test/selenium/ExportTest.php index d0c602b5e9..42a7f766f5 100644 --- a/test/selenium/ExportTest.php +++ b/test/selenium/ExportTest.php @@ -161,7 +161,7 @@ class ExportTest extends TestBase $this->scrollIntoView('databases_and_tables', 200); $this->byPartialLinkText('Unselect all')->click(); - $this->byCssSelector("option[value=" . $this->database_name . "]")->click(); + $this->byCssSelector('option[value="' . $this->database_name . '"]')->click(); } if ($type === 'table') { From 53bdb5e775b5725f4795c95d969dbb46e42e4b10 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 May 2020 23:10:41 +0200 Subject: [PATCH 3/6] Improve BrowserStack config Signed-off-by: William Desportes --- test/selenium/TestBase.php | 61 +++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index e90b6d88b9..b51e298d22 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -250,6 +250,14 @@ abstract class TestBase extends TestCase $buildLocal = true; $buildId = 'Manual'; $projectName = 'phpMyAdmin'; + /** + * Usefull for browserstack + * + * @see https://github.com/phpmyadmin/phpmyadmin/pull/14595#issuecomment-418541475 + * Reports the name of the test to browserstack + */ + $className = substr(static::class, strlen('PhpMyAdmin\Tests\Selenium\\')); + $testName = $className . ': ' . $this->getName(); if (getenv('BUILD_TAG')) { $buildId = getenv('BUILD_TAG'); @@ -261,41 +269,22 @@ abstract class TestBase extends TestCase $projectName = 'phpMyAdmin (Travis)'; } - $capabilities->setCapability('project', $projectName); - $capabilities->setCapability('build', $buildId); - $capabilities->setCapability('browserstack.debug', false); - - /** - * Usefull for browserstack - * @see https://github.com/phpmyadmin/phpmyadmin/pull/14595#issuecomment-418541475 - * Reports the name of the test to browserstack - */ - $capabilities->setCapability( - 'name', - static::class . '__' . $this->getName() - ); - if ($buildLocal) { $capabilities->setCapability( - 'browserstack.local', - $buildLocal - ); - $capabilities->setCapability( - 'browserstack.localIdentifier', - $buildId - ); - $capabilities->setCapability( - 'browserstack.debug', - true - ); - $capabilities->setCapability( - 'browserstack.console', - 'verbose' - ); - - $capabilities->setCapability( - 'browserstack.networkLogs', - true + 'bstack:options', + [ + 'os' => 'Windows', + 'osVersion' => '10', + 'resolution' => '1920x1080', + 'projectName' => $projectName, + 'sessionName' => $testName, + 'buildName' => $buildId, + 'localIdentifier' => $buildId, + 'local' => $buildLocal, + 'debug' => false, + 'consoleLogs' => 'verbose', + 'networkLogs' => true, + ] ); } } @@ -336,7 +325,11 @@ abstract class TestBase extends TestCase ); $capabilities->setCapability( 'browser_version', - '69.0' // Force chrome 69.0 + '80.0' // Force chrome 80.0 + ); + $capabilities->setCapability( + 'resolution', + '1920x1080' ); } From 18c89c89143ab16b1f617c8849ac093df45098fd Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 May 2020 23:15:48 +0200 Subject: [PATCH 4/6] Exclude https://suhosin.org/ from link checking Ref: https://github.com/sektioneins/suhosin/issues/119 Signed-off-by: William Desportes --- doc/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/conf.py b/doc/conf.py index 87fc2bdaa1..4ed164b3be 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -317,4 +317,6 @@ linkcheck_ignore = [ r'https://www.yubico.com/.*', # 500 Server Error: Internal Server Error r'http://www.scriptalicious.com/.*', + # Some timeouts and SSL issues: https://github.com/sektioneins/suhosin/issues/119 + r'https://suhosin.org/.*', ] From c52fc38a6b78b74f78047375ea950cc672e26e76 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 May 2020 23:21:12 +0200 Subject: [PATCH 5/6] Apply coding standards for 5.0 Signed-off-by: William Desportes --- test/selenium/TestBase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index b51e298d22..d5af4397b4 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -1013,6 +1013,7 @@ abstract class TestBase extends TestCase /** * Wait for AJAX completion + * @return void */ public function waitAjax(): void { From f7e967d147f0ffd262720dcdf5296aba83eee93e Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sun, 24 May 2020 00:05:28 +0200 Subject: [PATCH 6/6] Maximize ImportTest to avoid having random issues with "More" menu Ref: #16125 Signed-off-by: William Desportes --- test/selenium/ImportTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/selenium/ImportTest.php b/test/selenium/ImportTest.php index 20513814c2..17f1c2da7c 100644 --- a/test/selenium/ImportTest.php +++ b/test/selenium/ImportTest.php @@ -27,6 +27,7 @@ class ImportTest extends TestBase protected function setUp(): void { parent::setUp(); + $this->maximize(); $this->login(); }