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. 10 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 144

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[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.