function PerformanceTestTrait::doGetMinkDriverArgs
Same name in other branches
- 11.x core/tests/Drupal/Tests/PerformanceTestTrait.php \Drupal\Tests\PerformanceTestTrait::doGetMinkDriverArgs()
Helper for ::getMinkDriverArgs().
To use this, override BrowserTestBase::getMinkDriverArgs() and call this helper.
Return value
string The JSON encoded driver args with performance logging preferences added.
See also
\Drupal\Tests\BrowserTestBase::getMinkDriverArgs()
1 call to PerformanceTestTrait::doGetMinkDriverArgs()
- PerformanceTestBase::getMinkDriverArgs in core/
tests/ Drupal/ FunctionalJavascriptTests/ PerformanceTestBase.php - Gets the Mink driver args from an environment variable.
File
-
core/
tests/ Drupal/ Tests/ PerformanceTestTrait.php, line 66
Class
- PerformanceTestTrait
- Provides various methods to aid in collecting performance data during tests.
Namespace
Drupal\TestsCode
private function doGetMinkDriverArgs() : string {
// Add performance logging preferences to the existing driver arguments to
// avoid clobbering anything set via environment variables.
// @see https://chromedriver.chromium.org/logging/performance-log
$parent_driver_args = parent::getMinkDriverArgs();
$driver_args = json_decode($parent_driver_args, TRUE);
$driver_args[1]['goog:loggingPrefs'] = [
'browser' => 'ALL',
'performance' => 'ALL',
'performanceTimeline' => 'ALL',
];
// Support legacy key.
$chrome_options_key = isset($driver_args[1]['chromeOptions']) ? 'chromeOptions' : 'goog:chromeOptions';
$driver_args[1][$chrome_options_key]['perfLoggingPrefs'] = [
'traceCategories' => 'timeline,devtools.timeline,browser',
];
return json_encode($driver_args);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.