function OpenTelemetryAuthenticatedPerformanceTest::doTestNodePageAdministrator

Logs node page performance with an administrator.

1 call to OpenTelemetryAuthenticatedPerformanceTest::doTestNodePageAdministrator()
OpenTelemetryAuthenticatedPerformanceTest::testAuthenticatedPerformance in core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php
Logs authenticated tracing data.

File

core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php, line 89

Class

OpenTelemetryAuthenticatedPerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

protected function doTestNodePageAdministrator() : void {
  // Create a user with most important admin permissions, but not access to
  // contextual links. This is because contextual module makes an AJAX request
  // dependent on the content of browser local storage, which can make
  // performance testing indeterminate.
  $user = $this->drupalCreateUser([
    'administer nodes',
    'bypass node access',
    'access administration pages',
    'administer site configuration',
    'administer modules',
    'administer themes',
    'access site reports',
    'administer users',
    'access navigation',
    'administer shortcuts',
    'administer media',
    'access files overview',
    'administer blocks',
    'administer block content',
    'administer taxonomy',
    'administer menu',
  ]);
  $this->drupalLogin($user);
  // Ensure the asset cache warming request happens with empty caches,
  // otherwise the unique combination of assets for the performance request
  // may not have been created yet.
  $this->clearCaches();
  $this->drupalGet('node/1');
  sleep(1);
  $this->drupalGet('node/1');
  sleep(1);
  $this->clearCaches();
  $performance_data = $this->collectPerformanceData(function () {
    $this->drupalGet('node/1');
  }, 'administratorNodePage');
  $expected = [
    'QueryCount' => 418,
    'CacheGetCount' => 414,
    'CacheGetCountByBin' => [
      'config' => 156,
      'bootstrap' => 16,
      'discovery' => 108,
      'data' => 23,
      'entity' => 25,
      'dynamic_page_cache' => 1,
      'default' => 22,
      'render' => 39,
      'menu' => 24,
    ],
    'CacheSetCount' => 405,
    'CacheDeleteCount' => 0,
    'CacheTagInvalidationCount' => 0,
    'CacheTagLookupQueryCount' => 32,
    'ScriptCount' => 3,
    'ScriptBytes' => 198900,
    'StylesheetCount' => 8,
    'StylesheetBytes' => 77250,
  ];
  $this->assertMetrics($expected, $performance_data);
}

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