diff -u b/core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php b/core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php
--- b/core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php
+++ b/core/modules/field_layout/tests/src/Functional/FieldLayoutTest.php
@@ -45,9 +45,11 @@
   }
 
   /**
-   * Tests custom display settings appear in alphabetical order by visible
-  * name, not by machine name. This is a regression test for an issue reported
-  * in https://www.drupal.org/node/2858569
+   * Tests if view modes appear in alphabetical order by visible name.
+   *
+   * The machine name should not be used for sorting.
+   *
+   * @see https://www.drupal.org/node/2858569
    */
   public function testAlphabeticalDisplaySettings() {
     $this->drupalGet('admin/structure/types/manage/article/display');
@@ -55,8 +57,7 @@
     // Since the default view modes all have machine names which coincide with
     // the English labels, they should appear in alphabetical order, by default
     // if viewing the site in English and if no changes have been made. We will
-    // verify this first:
-
+    // verify this first.
     $page_text = $this->getTextContent();
     $start = strpos($page_text, 'view modes');
     $pos = $start;
@@ -74,10 +75,11 @@
       'label' => 'Breezer',
     ];
     $this->drupalPostForm('admin/structure/display-modes/view/manage/node.teaser', $edit, t('Save'));
-    $this->assertText(t('Saved the Breezer view mode.'));
+    $this->assertSession()->pageTextContains(t('Saved the Breezer view mode.'));
 
     // Re-open the display settings for the article content type and verify
-    // that changing "Teaser" to "Breezer" makes it appear before "Full content"
+    // that changing "Teaser" to "Breezer" makes it appear before "Full
+    // content".
     $this->drupalGet('admin/structure/types/manage/article/display');
     $page_text = $this->getTextContent();
     $start = strpos($page_text, 'view modes');
@@ -89,13 +91,13 @@
       $pos = $new_pos;
     }
 
-    // We can now revert to the original name for Teaser so that no following tests
-    // in this environment are affected by the odd change we made:
+    // We can now revert to the original name for Teaser so that no following
+    // tests in this environment are affected by the odd change we made.
     $edit = [
       'label' => 'Teaser',
     ];
     $this->drupalPostForm('admin/structure/display-modes/view/manage/node.teaser', $edit, t('Save'));
-    $this->assertText(t('Saved the Teaser view mode.'));
+    $this->assertSession()->pageTextContains(t('Saved the Teaser view mode.'));
   }
 
   /**
