function PerformanceTest::testFrontPagePerformance

Same name and namespace in other branches
  1. 10 core/profiles/demo_umami/tests/src/FunctionalJavascript/PerformanceTest.php \Drupal\Tests\demo_umami\FunctionalJavascript\PerformanceTest::testFrontPagePerformance()

Load the front page as a user with access to Toolbar.

File

core/profiles/demo_umami/tests/src/FunctionalJavascript/PerformanceTest.php, line 42

Class

PerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

public function testFrontPagePerformance() : void {
    $admin_user = $this->drupalCreateUser([
        'access toolbar',
    ]);
    $this->drupalLogin($admin_user);
    $performance_data = $this->collectPerformanceData(function () {
        $this->drupalGet('<front>');
    });
    $this->assertSession()
        ->pageTextContains('Umami');
    $this->assertSame(2, $performance_data->getStylesheetCount());
    $this->assertSame(2, $performance_data->getScriptCount());
}

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