function OpenTelemetryPerformanceTest::doTestNodeAddPagesAuthor

Checks the node/add page asset requests as an author.

File

core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryPerformanceTest.php, line 616

Class

OpenTelemetryPerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

protected function doTestNodeAddPagesAuthor() : void {
  $user = $this->createUser();
  $user->addRole('author');
  $user->save();
  $this->drupalLogin($user);
  $this->drupalGet('<front>');
  // Give additional time for the request and all assets to be returned
  // before making the next request.
  sleep(2);
  $performance_data = $this->collectPerformanceData(function () {
    $this->drupalGet('node/add/article');
    sleep(2);
    $this->drupalGet('node/add/recipe');
    sleep(2);
    $this->drupalGet('node/add/page');
  }, 'umamiNodeAddEditor');
  $expected = [
    'ScriptCount' => 24,
    'ScriptBytes' => 2979216,
    'StylesheetCount' => 23,
    'StylesheetBytes' => 1085546,
  ];
  $this->assertMetrics($expected, $performance_data);
}

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