function WebDriverTestBase::getMinkDriverArgs

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getMinkDriverArgs()
  2. 8.9.x core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getMinkDriverArgs()
  3. 11.x core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::getMinkDriverArgs()

Overrides BrowserTestBase::getMinkDriverArgs

1 method overrides WebDriverTestBase::getMinkDriverArgs()
PerformanceTestBase::getMinkDriverArgs in core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
Gets the Mink driver args from an environment variable.

File

core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php, line 146

Class

WebDriverTestBase
Runs a browser test using a driver that supports JavaScript.

Namespace

Drupal\FunctionalJavascriptTests

Code

protected function getMinkDriverArgs() {
    if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
        $json = getenv('MINK_DRIVER_ARGS_WEBDRIVER') ?: parent::getMinkDriverArgs();
        if (!($json === FALSE || $json === '')) {
            $args = json_decode($json, TRUE);
            if (isset($args[1]['chromeOptions'])) {
                @trigger_error('The "chromeOptions" array key is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use "goog:chromeOptions instead. See https://www.drupal.org/node/3422624', E_USER_DEPRECATED);
                $args[1]['goog:chromeOptions'] = $args[1]['chromeOptions'];
                unset($args[1]['chromeOptions']);
            }
            if (isset($args[0]) && $args[0] === 'chrome' && !isset($args[1]['goog:chromeOptions']['w3c'])) {
                // @todo https://www.drupal.org/project/drupal/issues/3421202
                //   Deprecate defaulting behavior and require w3c to be set.
                $args[1]['goog:chromeOptions']['w3c'] = FALSE;
            }
            $json = json_encode($args);
        }
        return $json;
    }
    return parent::getMinkDriverArgs();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.