By larowlan on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.2.x
Introduced in version:
10.2.0
Issue links:
Description:
A new Drupal\FunctionalJavascriptTests\PerformanceTestBase has been added to core. Most of the logic is in Drupal\Tests\PerformanceTestTrait
This uses different webdriver settings to enable collection of performance statistics from the browser.
The class currently keeps track of the number of script and stylesheets and in the future may be expanded to enable other performance benchmarking.
The primary API is the ::collectPerformanceData() method, basic usage:
$performance_data = $this->collectPerformanceData(function () {
$this->drupalGet('node/1');
});
$this->assertSame(2, $performance_data->getStylesheetCount());
$this->assertSame(1, $performance_data->getScriptCount());
$this->assertSame(92, $performance_data->getQueryCount());
Impacts:
Module developers