diff --git a/core/drupalci.yml b/core/drupalci.yml
index cd92d8102d..e578b3d5b0 100644
--- a/core/drupalci.yml
+++ b/core/drupalci.yml
@@ -3,49 +3,15 @@
 # https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing
 _phpunit_testgroups_to_execute: &testgroups
   # Default: all of Drupal core's test suite runs.
-  testgroups: '--all'
+  testgroups: '--class "\Drupal\Tests\comment\Functional\CommentStatisticsTest"'
   # Alternative: run only the tests for one particular module.
   # testgroups: '--module ckeditor5'
 build:
   assessment:
     testing:
-      # Run code quality checks.
-      container_command.commit-checks:
-        commands:
-          - "core/scripts/dev/commit-code-check.sh --drupalci"
-        halt-on-fail: true
-      # run_tests task is executed several times in order of performance speeds.
-      # halt-on-fail can be set on the run_tests tasks in order to fail fast.
-      # suppress-deprecations is false in order to be alerted to usages of
-      # deprecated code.
-      run_tests.phpunit:
-        types: 'PHPUnit-Unit'
-        suppress-deprecations: false
-        halt-on-fail: false
-        <<: *testgroups
-      run_tests.kernel:
-        types: 'PHPUnit-Kernel'
-        suppress-deprecations: false
-        halt-on-fail: false
-        <<: *testgroups
-      run_tests.build:
-        # Limit concurrency due to disk space concerns.
-        concurrency: 15
-        types: 'PHPUnit-Build'
-        suppress-deprecations: false
-        halt-on-fail: false
-        <<: *testgroups
       run_tests.functional:
         types: 'PHPUnit-Functional'
         suppress-deprecations: false
         halt-on-fail: false
         <<: *testgroups
-      run_tests.javascript:
-        concurrency: 15
-        types: 'PHPUnit-FunctionalJavascript'
-        suppress-deprecations: false
-        halt-on-fail: false
-        <<: *testgroups
-      # Run nightwatch testing.
-      # @see https://www.drupal.org/project/drupal/issues/2869825
-      nightwatchjs: {}
+        repeat: 5000
diff --git a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php
index 1bccf23e6d..c695a794f6 100644
--- a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php
@@ -4,7 +4,6 @@
 
 use Drupal\comment\CommentManagerInterface;
 use Drupal\comment\Entity\Comment;
-use Drupal\user\RoleInterface;
 
 /**
  * Tests comment statistics on nodes.
@@ -77,15 +76,20 @@ public function testCommentNodeCommentStatistics() {
     $this->assertEquals(1, $node->get('comment')->comment_count, 'The value of node comment_count is 1.');
 
     // Prepare for anonymous comment submission (comment approval enabled).
-    $this->drupalLogin($this->adminUser);
-    user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
-      'access comments' => TRUE,
-      'post comments' => TRUE,
-      'skip comment approval' => FALSE,
-    ]);
+    // Note we don't use user_role_change_permissions(), because that caused
+    // random test failures.
+    $this->drupalLogin($this->rootUser);
+    ;
+    $this->drupalGet('admin/people/permissions');
+    $edit = [
+      'anonymous[access comments]' => 1,
+      'anonymous[post comments]' => 1,
+      'anonymous[skip comment approval]' => 0,
+    ];
+    $this->submitForm($edit, 'Save permissions');
+    $this->drupalLogout();
     // Ensure that the poster can leave some contact info.
     $this->setCommentAnonymous('1');
-    $this->drupalLogout();
 
     // Post comment #2 as anonymous (comment approval enabled).
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
@@ -101,12 +105,14 @@ public function testCommentNodeCommentStatistics() {
     $this->assertEquals(1, $node->get('comment')->comment_count, 'The value of node comment_count is still 1.');
 
     // Prepare for anonymous comment submission (no approval required).
-    $this->drupalLogin($this->adminUser);
-    user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
-      'access comments' => TRUE,
-      'post comments' => TRUE,
-      'skip comment approval' => TRUE,
-    ]);
+    // Note we don't use user_role_change_permissions(), because that caused
+    // random test failures.
+    $this->drupalLogin($this->rootUser);
+    $this->drupalGet('admin/people/permissions');
+    $edit = [
+      'anonymous[skip comment approval]' => 1,
+    ];
+    $this->submitForm($edit, 'Save permissions');
     $this->drupalLogout();
 
     // Post comment #3 as anonymous.
