Commit e5c0783a authored by catch's avatar catch
Browse files

Revert "Issue #3211164 by alexpott: Random errors in Javascript Testing"

This reverts commit 0f2313ab.
parent 0f2313ab
......@@ -14,25 +14,6 @@
*/
class WebDriverCurlService extends CurlService {
/**
* The maximum number of times to try in the event of a stale element
* reference error.
*
* @var int
*/
private static $maxRetries = 10;
/**
* Sets the maximum number of retries.
*
* @param int $max_retries
* The maximum number of times to try in the event of a stale element
* reference error. This number must be greater than 10.
*/
public static function setMaxRetries(int $max_retries) {
static::$maxRetries = max($max_retries, static::$maxRetries);
}
/**
* {@inheritdoc}
*/
......@@ -41,7 +22,7 @@ public function execute($requestMethod, $url, $parameters = NULL, $extraOptions
CURLOPT_FAILONERROR => TRUE,
];
$retries = 0;
while ($retries < static::$maxRetries) {
while ($retries < 10) {
try {
$customHeaders = [
'Content-Type: application/json;charset=UTF-8',
......@@ -123,9 +104,8 @@ public function execute($requestMethod, $url, $parameters = NULL, $extraOptions
$result = json_decode($rawResult, TRUE);
if (isset($result['status']) && $result['status'] === WebDriverException::STALE_ELEMENT_REFERENCE) {
usleep(100000);
$retries++;
// Wait a bit longer each time a stale reference error has occurred.
usleep(100000 * $retries);
continue;
}
return [$rawResult, $info];
......
......@@ -31,15 +31,6 @@ abstract class WebDriverTestBase extends BrowserTestBase {
*/
protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;
/**
* The maximum number of times to try a webdriver request.
*
* @var int
*
* @see \Drupal\FunctionalJavascriptTests\WebDriverCurlService::$maxRetries
*/
protected const WEBDRIVER_RETRIES = 10;
/**
* {@inheritdoc}
*/
......@@ -48,7 +39,6 @@ protected function initMink() {
throw new \UnexpectedValueException(sprintf("%s has to be an instance of %s", $this->minkDefaultDriverClass, DrupalSelenium2Driver::class));
}
$this->minkDefaultDriverArgs = ['chrome', NULL, 'http://localhost:4444'];
WebDriverCurlService::setMaxRetries(max((int) getenv('WEBDRIVER_RETRIES'), static::WEBDRIVER_RETRIES));
try {
return parent::initMink();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment