From d7300cc3801f2ef3681913727f516f010d3bf606 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Wed, 29 Jul 2020 14:57:52 +0100
Subject: [PATCH] Issue #3142755 by sja112, mondrake, alexpott, mrinalini9,
 xjm: AssertLegacyTrait::assert(No)Field() in functional tests still have a
 message passed in

---
 .../tests/src/Functional/ImportOpmlTest.php   |  7 ++++---
 .../src/Functional/BlockLanguageTest.php      | 11 +++++-----
 .../tests/src/Functional/BlockUiTest.php      |  4 ++--
 .../tests/src/Functional/CommentBookTest.php  |  6 ++++--
 .../src/Functional/CommentInterfaceTest.php   |  7 ++++---
 .../tests/src/Functional/CommentTypeTest.php  |  2 +-
 .../src/Functional/ModerationFormTest.php     | 12 +++++------
 .../field/tests/src/Functional/FormTest.php   | 20 ++++++++++++-------
 .../forum/tests/src/Functional/ForumTest.php  |  2 +-
 .../LanguageBrowserDetectionTest.php          | 16 +++++++--------
 .../src/Functional/MenuUiLanguageTest.php     |  2 +-
 .../NodeTypeInitialLanguageTest.php           |  7 +++++--
 .../Functional/Views/RestExportAuthTest.php   |  6 +++---
 .../Condition/ConditionFormTest.php           |  4 ++--
 .../Form/LanguageSelectElementTest.php        |  6 +++---
 .../System/MainContentFallbackTest.php        |  4 ++--
 .../tests/src/Functional/TermLanguageTest.php |  2 +-
 .../src/Functional/VocabularyLanguageTest.php |  2 +-
 .../Functional/VocabularyPermissionsTest.php  |  2 +-
 .../Functional/VocabularyTranslationTest.php  |  2 +-
 .../tests/src/Functional/UserAdminTest.php    |  4 ++--
 .../src/Functional/FilterBooleanWebTest.php   |  2 +-
 22 files changed, 72 insertions(+), 58 deletions(-)

diff --git a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
index 8f1aa1583df6..845d9a6a3033 100644
--- a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
+++ b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
@@ -47,9 +47,10 @@ public function openImportForm() {
 
     $this->drupalGet('admin/config/services/aggregator/add/opml');
     $this->assertText('A single OPML document may contain many feeds.', 'Found OPML help text.');
-    $this->assertField('files[upload]', 'Found file upload field.');
-    $this->assertField('remote', 'Found Remote URL field.');
-    $this->assertField('refresh', '', 'Found Refresh field.');
+    // Ensure that the file upload, remote URL, and refresh fields exist.
+    $this->assertField('files[upload]');
+    $this->assertField('remote');
+    $this->assertField('refresh');
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockLanguageTest.php b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
index 1179875ec3d0..5e784a302051 100644
--- a/core/modules/block/tests/src/Functional/BlockLanguageTest.php
+++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
@@ -54,9 +54,10 @@ public function testLanguageBlockVisibility() {
     // Check if the visibility setting is available.
     $default_theme = $this->config('system.theme')->get('default');
     $this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
-
-    $this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.');
-    $this->assertNoField('visibility[language][context_mapping][language]', 'Language type field is not visible.');
+    // Ensure that the language visibility field is visible without a type
+    // setting.
+    $this->assertField('visibility[language][langcodes][en]');
+    $this->assertNoField('visibility[language][context_mapping][language]');
 
     // Enable a standard block and set the visibility setting for one language.
     $edit = [
@@ -138,8 +139,8 @@ public function testMultipleLanguageTypes() {
     // Check if the visibility setting is available with a type setting.
     $default_theme = $this->config('system.theme')->get('default');
     $this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
-    $this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.');
-    $this->assertField('visibility[language][context_mapping][language]', 'Language type field is visible.');
+    $this->assertField('visibility[language][langcodes][en]');
+    $this->assertField('visibility[language][context_mapping][language]');
 
     // Enable a standard block and set visibility to French only.
     $block_id = strtolower($this->randomMachineName(8));
diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php
index c64a83e94e1d..f3abf0027591 100644
--- a/core/modules/block/tests/src/Functional/BlockUiTest.php
+++ b/core/modules/block/tests/src/Functional/BlockUiTest.php
@@ -121,11 +121,11 @@ public function testBlockAdminUiPage() {
       $element = $this->xpath('//*[@id="blocks"]/tbody/tr[' . $values['tr'] . ']/td[1]/text()');
       $this->assertEquals($element[0]->getText(), $label, 'The "' . $label . '" block title is set inside the ' . $values['settings']['region'] . ' region.');
       // Look for a test block region select form element.
-      $this->assertField('blocks[' . $values['settings']['id'] . '][region]', 'The block "' . $values['label'] . '" has a region assignment field.');
+      $this->assertField('blocks[' . $values['settings']['id'] . '][region]');
       // Move the test block to the header region.
       $edit['blocks[' . $values['settings']['id'] . '][region]'] = 'header';
       // Look for a test block weight select form element.
-      $this->assertField('blocks[' . $values['settings']['id'] . '][weight]', 'The block "' . $values['label'] . '" has a weight assignment field.');
+      $this->assertField('blocks[' . $values['settings']['id'] . '][weight]');
       // Change the test block's weight.
       $edit['blocks[' . $values['settings']['id'] . '][weight]'] = $values['test_weight'];
     }
diff --git a/core/modules/comment/tests/src/Functional/CommentBookTest.php b/core/modules/comment/tests/src/Functional/CommentBookTest.php
index be13afb0c741..d99467182029 100644
--- a/core/modules/comment/tests/src/Functional/CommentBookTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentBookTest.php
@@ -72,7 +72,8 @@ public function testBookCommentPrint() {
     $this->assertText($comment_subject, 'Comment subject found');
     $this->assertText($comment_body, 'Comment body found');
     $this->assertText(t('Add new comment'), 'Comment form found');
-    $this->assertField('subject[0][value]', 'Comment form subject found');
+    // Ensure that the comment form subject field exists.
+    $this->assertField('subject[0][value]');
 
     $this->drupalGet('book/export/html/' . $book_node->id());
 
@@ -81,7 +82,8 @@ public function testBookCommentPrint() {
     $this->assertText($comment_body, 'Comment body found');
 
     $this->assertNoText(t('Add new comment'), 'Comment form not found');
-    $this->assertNoField('subject[0][value]', 'Comment form subject not found');
+    // Verify that the comment form subject field is not found.
+    $this->assertNoField('subject[0][value]');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
index 6018b9d730cb..e557c7ce194a 100644
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
@@ -179,21 +179,22 @@ public function testCommentInterface() {
     $this->assertNotNull($this->node, 'Article node created.');
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertNoField('edit-comment', 'Comment body field found.');
+    $this->assertNoField('edit-comment');
 
     // Attempt to post to node with read-only comments.
     $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::CLOSED]]]);
     $this->assertNotNull($this->node, 'Article node created.');
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertNoField('edit-comment', 'Comment body field found.');
+    $this->assertNoField('edit-comment');
 
     // Attempt to post to node with comments enabled (check field names etc).
     $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::OPEN]]]);
     $this->assertNotNull($this->node, 'Article node created.');
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
     $this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
-    $this->assertField('edit-comment-body-0-value', 'Comment body field found.');
+    // Ensure that the comment body field exists.
+    $this->assertField('edit-comment-body-0-value');
 
     // Delete comment and make sure that reply is also removed.
     $this->drupalLogout();
diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
index 52dc7ce93792..aa56c9cb802f 100644
--- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
@@ -85,7 +85,7 @@ public function testCommentTypeCreation() {
 
     // Edit the comment-type and ensure that we cannot change the entity-type.
     $this->drupalGet('admin/structure/comment/manage/foo');
-    $this->assertNoField('target_entity_type_id', 'Entity type file not present');
+    $this->assertNoField('target_entity_type_id');
     $this->assertText(t('Target entity type'));
     // Save the form and ensure the entity-type value is preserved even though
     // the field isn't present.
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php
index 2fa1b5aa8bfa..8eaccf7d9eb4 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php
@@ -79,7 +79,7 @@ public function testModerationForm() {
     // live revision.
     $this->drupalGet($canonical_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertField('edit-new-state', 'The node view page has a moderation form.');
+    $this->assertField('edit-new-state');
 
     // The latest version page should not show, because there is no pending
     // revision.
@@ -96,7 +96,7 @@ public function testModerationForm() {
     // live revision.
     $this->drupalGet($canonical_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertField('edit-new-state', 'The node view page has a moderation form.');
+    $this->assertField('edit-new-state');
 
     // Preview the draft.
     $this->drupalPostForm($edit_path, [
@@ -111,7 +111,7 @@ public function testModerationForm() {
     ]);
     $this->assertSession()->statusCodeEquals(200);
     $this->assertUrl($preview_url);
-    $this->assertNoField('edit-new-state', 'The node preview page has no moderation form.');
+    $this->assertNoField('edit-new-state');
 
     // The latest version page should not show, because there is still no
     // pending revision.
@@ -141,7 +141,7 @@ public function testModerationForm() {
     // live revision.
     $this->drupalGet($canonical_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoField('edit-new-state', 'The node view page has no moderation form.');
+    $this->assertNoField('edit-new-state');
 
     // The latest version page should not show, because there is still no
     // pending revision.
@@ -158,13 +158,13 @@ public function testModerationForm() {
     // live revision.
     $this->drupalGet($canonical_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoField('edit-new-state', 'The node view page has no moderation form.');
+    $this->assertNoField('edit-new-state');
 
     // The latest version page should show the moderation form and have "Draft"
     // status, because the pending revision is in "Draft".
     $this->drupalGet($latest_version_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertField('edit-new-state', 'The latest-version page has a moderation form.');
+    $this->assertField('edit-new-state');
     $this->assertText('Draft', 'Correct status found on the latest-version page.');
 
     // Submit the moderation form to change status to published.
diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php
index ed5b9f105202..6bf6a3464da7 100644
--- a/core/modules/field/tests/src/Functional/FormTest.php
+++ b/core/modules/field/tests/src/Functional/FormTest.php
@@ -123,7 +123,8 @@ public function testFieldFormSingle() {
     $token_description = Html::escape($this->config('system.site')->get('name')) . '_description';
     $this->assertText($token_description, 'Token replacement for description is displayed');
     $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed');
-    $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
+    // Verify that no extraneous widget is displayed.
+    $this->assertNoField("{$field_name}[1][value]");
 
     // Check that hook_field_widget_form_alter() does not believe this is the
     // default value form.
@@ -155,7 +156,8 @@ public function testFieldFormSingle() {
     // Display edit form.
     $this->drupalGet('entity_test/manage/' . $id . '/edit');
     $this->assertFieldByName("{$field_name}[0][value]", $value, 'Widget is displayed with the correct default value');
-    $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
+    // Verify that no extraneous widget is displayed.
+    $this->assertNoField("{$field_name}[1][value]");
 
     // Update the entity.
     $value = mt_rand(1, 127);
@@ -265,7 +267,8 @@ public function testFieldFormUnlimited() {
     // Display creation form -> 1 widget.
     $this->drupalGet('entity_test/add');
     $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget 1 is displayed');
-    $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
+    // Verify that no extraneous widget is displayed.
+    $this->assertNoField("{$field_name}[1][value]");
 
     // Check if aria-describedby attribute is placed on multiple value widgets.
     $elements = $this->xpath('//table[@id="field-unlimited-values" and @aria-describedby="edit-field-unlimited--description"]');
@@ -275,7 +278,8 @@ public function testFieldFormUnlimited() {
     $this->drupalPostForm(NULL, [], t('Add another item'));
     $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget 1 is displayed');
     $this->assertFieldByName("{$field_name}[1][value]", '', 'New widget is displayed');
-    $this->assertNoField("{$field_name}[2][value]", 'No extraneous widget is displayed');
+    // Verify that no extraneous widget is displayed.
+    $this->assertNoField("{$field_name}[2][value]");
     // TODO : check that non-field inputs are preserved ('title'), etc.
 
     // Yet another time so that we can play with more values -> 3 widgets.
@@ -314,7 +318,8 @@ public function testFieldFormUnlimited() {
     $this->assertPattern("|$pattern|s", 'Widgets are displayed in the correct order');
     $this->assertFieldByName("{$field_name}[$delta][value]", '', "New widget is displayed");
     $this->assertFieldByName("{$field_name}[$delta][_weight]", $delta, "New widget has the right weight");
-    $this->assertNoField("{$field_name}[" . ($delta + 1) . '][value]', 'No extraneous widget is displayed');
+    // Verify that no extraneous widget is displayed.
+    $this->assertNoField("{$field_name}[" . ($delta + 1) . '][value]');
 
     // Submit the form and create the entity.
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -411,7 +416,8 @@ public function testFieldFormMultivalueWithRequiredRadio() {
     // Verify that the widget is added.
     $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget 1 is displayed');
     $this->assertFieldByName("{$field_name}[1][value]", '', 'New widget is displayed');
-    $this->assertNoField("{$field_name}[2][value]", 'No extraneous widget is displayed');
+    // Verify that no extraneous widget is displayed.
+    $this->assertNoField("{$field_name}[2][value]");
   }
 
   /**
@@ -588,7 +594,7 @@ public function testHiddenField() {
 
     // Create an entity and test that the default value is assigned correctly to
     // the field that uses the hidden widget.
-    $this->assertNoField("{$field_name}[0][value]", 'The field does not appear in the form');
+    $this->assertNoField("{$field_name}[0][value]");
     $this->drupalPostForm(NULL, [], t('Save'));
     preg_match('|' . $entity_type . '/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php
index 2c9f0eb34ae2..db6dc6fefefc 100644
--- a/core/modules/forum/tests/src/Functional/ForumTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumTest.php
@@ -353,7 +353,7 @@ private function doAdminTests($user) {
     // Test term edit form alterations.
     $this->drupalGet('taxonomy/term/' . $this->forumContainer['tid'] . '/edit');
     // Test parent field been hidden by forum module.
-    $this->assertNoField('parent[]', 'Parent field not found.');
+    $this->assertNoField('parent[]');
 
     // Create a default vocabulary named "Tags".
     $description = 'Use tags to group articles on similar topics into categories.';
diff --git a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
index da75eaffc98e..f19caab42122 100644
--- a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
@@ -37,8 +37,8 @@ public function testUIBrowserLanguageMappings() {
 
     // Check that defaults are loaded from language.mappings.yml.
     $this->drupalGet('admin/config/regional/language/detection/browser');
-    $this->assertField('edit-mappings-zh-cn-browser-langcode', 'zh-cn', 'Chinese browser language code found.');
-    $this->assertField('edit-mappings-zh-cn-drupal-langcode', 'zh-hans-cn', 'Chinese Drupal language code found.');
+    $this->assertFieldById('edit-mappings-zh-cn-browser-langcode', 'zh-cn');
+    $this->assertFieldById('edit-mappings-zh-cn-drupal-langcode', 'zh-hans');
 
     // Delete zh-cn language code.
     $browser_langcode = 'zh-cn';
@@ -60,8 +60,8 @@ public function testUIBrowserLanguageMappings() {
 
     // Check we went back to the browser negotiation mapping overview.
     $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString());
-    // Check that ch-zn no longer exists.
-    $this->assertNoField('edit-mappings-zh-cn-browser-langcode', 'Chinese browser language code no longer exists.');
+    // Check that Chinese browser language code no longer exists.
+    $this->assertNoField('edit-mappings-zh-cn-browser-langcode');
 
     // Add a new custom mapping.
     $edit = [
@@ -70,8 +70,8 @@ public function testUIBrowserLanguageMappings() {
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
     $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString());
-    $this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.');
-    $this->assertField('edit-mappings-xx-drupal-langcode', 'en', 'Drupal language code found.');
+    $this->assertFieldById('edit-mappings-xx-browser-langcode', 'xx');
+    $this->assertFieldById('edit-mappings-xx-drupal-langcode', 'en');
 
     // Add the same custom mapping again.
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
@@ -92,8 +92,8 @@ public function testUIBrowserLanguageMappings() {
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
     $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString());
-    $this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.');
-    $this->assertField('edit-mappings-xx-drupal-langcode', 'zh-hans', 'Drupal language code found.');
+    $this->assertFieldById('edit-mappings-xx-browser-langcode', 'xx');
+    $this->assertFieldById('edit-mappings-xx-drupal-langcode', 'zh-hans');
   }
 
 }
diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiLanguageTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiLanguageTest.php
index 7d4ee760717e..4ff738c583ae 100644
--- a/core/modules/menu_ui/tests/src/Functional/MenuUiLanguageTest.php
+++ b/core/modules/menu_ui/tests/src/Functional/MenuUiLanguageTest.php
@@ -142,7 +142,7 @@ public function testMenuLanguage() {
 
     // Check that the language selector is not available on menu link add page.
     $this->drupalGet("admin/structure/menu/manage/$menu_name/add");
-    $this->assertNoField('edit-langcode-0-value', 'The language selector field was hidden the page');
+    $this->assertNoField('edit-langcode-0-value');
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php b/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php
index c415307e35e5..4e5b1ee3cb7f 100644
--- a/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php
+++ b/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php
@@ -53,8 +53,9 @@ public function testNodeTypeInitialLanguageDefaults() {
     $language_field = $this->xpath('//*[@id="field-overview"]/*[@id="language"]');
     $this->assert(empty($language_field), 'Language field is not visible on manage fields tab.');
 
+    // Verify that language is not selectable on node add page by default.
     $this->drupalGet('node/add/article');
-    $this->assertNoField('langcode', 'Language is not selectable on node add/edit page by default.');
+    $this->assertNoField('langcode');
 
     // Adds a new language and set it as default.
     $edit = [
@@ -73,7 +74,9 @@ public function testNodeTypeInitialLanguageDefaults() {
     ];
     $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
     $this->drupalGet('node/add/article');
-    $this->assertField('langcode[0][value]', 'Language is selectable on node add/edit page when language not hidden.');
+    // Ensure that the language is selectable on node add page when language
+    // not hidden.
+    $this->assertField('langcode[0][value]');
     $this->assertTrue($this->assertSession()->optionExists('edit-langcode-0-value', 'hu')->isSelected());
 
     // Tests if the language field can be rearranged on the manage form display
diff --git a/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php b/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php
index 69888bbab975..96e989d80ee1 100644
--- a/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php
+++ b/core/modules/rest/tests/src/Functional/Views/RestExportAuthTest.php
@@ -54,13 +54,13 @@ public function testAuthProvidersOptions() {
     $this->drupalGet("admin/structure/views/nojs/display/$view_id/$view_display/auth");
     // The "basic_auth" will always be available since module,
     // providing it, has the same name.
-    $this->assertField('edit-auth-basic-auth', 'Basic auth is available for choosing.');
+    $this->assertField('edit-auth-basic-auth');
     // The "cookie" authentication provider defined by "user" module.
-    $this->assertField('edit-auth-cookie', 'Cookie-based auth can be chosen.');
+    $this->assertField('edit-auth-cookie');
     // Wrong behavior in "getAuthOptions()" method makes this option available
     // instead of "cookie".
     // @see \Drupal\rest\Plugin\views\display\RestExport::getAuthOptions()
-    $this->assertNoField('edit-auth-user', 'Wrong authentication option is unavailable.');
+    $this->assertNoField('edit-auth-user');
 
     $this->drupalPostForm(NULL, ['auth[basic_auth]' => 1, 'auth[cookie]' => 1], 'Apply');
     $this->drupalPostForm(NULL, [], 'Save');
diff --git a/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php b/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
index 1500cd3db607..d2771d810934 100644
--- a/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
+++ b/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
@@ -37,8 +37,8 @@ public function testConfigForm() {
     $article->save();
 
     $this->drupalGet('condition_test');
-    $this->assertField('bundles[article]', 'There is an article bundle selector.');
-    $this->assertField('bundles[page]', 'There is a page bundle selector.');
+    $this->assertField('bundles[article]');
+    $this->assertField('bundles[page]');
     $this->drupalPostForm(NULL, ['bundles[page]' => 'page', 'bundles[article]' => 'article'], t('Submit'));
     // @see \Drupal\condition_test\FormController::submitForm()
     $this->assertText('Bundle: page');
diff --git a/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php b/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php
index 32b52729228c..56eef212591e 100644
--- a/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php
+++ b/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php
@@ -54,7 +54,7 @@ public function testLanguageSelectElementOptions() {
         'edit-languages-config-and-locked' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_LOCKED,
     ];
     foreach ($ids as $id => $flags) {
-      $this->assertField($id, new FormattableMarkup('The @id field was found on the page.', ['@id' => $id]));
+      $this->assertField($id);
       $options = [];
       /* @var $language_manager \Drupal\Core\Language\LanguageManagerInterface */
       $language_manager = $this->container->get('language_manager');
@@ -65,7 +65,7 @@ public function testLanguageSelectElementOptions() {
     }
 
     // Test that the #options were not altered by #languages.
-    $this->assertField('edit-language-custom-options', new FormattableMarkup('The @id field was found on the page.', ['@id' => 'edit-language-custom-options']));
+    $this->assertField('edit-language-custom-options');
     $this->_testLanguageSelectElementOptions('edit-language-custom-options', ['opt1' => 'First option', 'opt2' => 'Second option', 'opt3' => 'Third option']);
   }
 
@@ -82,7 +82,7 @@ public function testHiddenLanguageSelectElement() {
     // Check that the language fields were rendered on the page.
     $ids = ['edit-languages-all', 'edit-languages-configurable', 'edit-languages-locked', 'edit-languages-config-and-locked'];
     foreach ($ids as $id) {
-      $this->assertNoField($id, new FormattableMarkup('The @id field was not found on the page.', ['@id' => $id]));
+      $this->assertNoField($id);
     }
 
     // Check that the submitted values were the default values of the language
diff --git a/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php b/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php
index c35a10005d09..ca24083f1caa 100644
--- a/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php
+++ b/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php
@@ -58,13 +58,13 @@ public function testMainContentFallback() {
     // Drupal should fall back to SimplePageVariant. Both for the admin and the
     // front-end theme.
     $this->drupalGet('admin/config/system/site-information');
-    $this->assertField('site_name', 'Fallback to SimplePageVariant works for admin theme.');
+    $this->assertField('site_name');
     $this->drupalGet('system-test/main-content-fallback');
     $this->assertText(t('Content to test main content fallback'), 'Fallback to SimplePageVariant works for front-end theme.');
     // Request a user* page and see if it is displayed.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('user/' . $this->webUser->id() . '/edit');
-    $this->assertField('mail', 'User interface still available.');
+    $this->assertField('mail');
 
     // Enable the block module again.
     $this->drupalLogin($this->adminUser);
diff --git a/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php b/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php
index 412f171d833d..78482be633ea 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php
@@ -54,7 +54,7 @@ public function testTermLanguage() {
     // Add a term.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
     // Check that we have the language selector.
-    $this->assertField('edit-langcode-0-value', t('The language selector field was found on the page.'));
+    $this->assertField('edit-langcode-0-value');
     // Submit the term.
     $edit = [
       'name[0][value]' => $this->randomMachineName(),
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php
index ac559eca7502..b085e28fa8ee 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php
@@ -44,7 +44,7 @@ public function testVocabularyLanguage() {
     $this->drupalGet('admin/structure/taxonomy/add');
 
     // Check that we have the language selector available.
-    $this->assertField('edit-langcode', 'The language selector field was found on the page.');
+    $this->assertField('edit-langcode');
 
     // Create the vocabulary.
     $vid = mb_strtolower($this->randomMachineName());
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
index 85d17a3b1500..c729074312a3 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
@@ -236,7 +236,7 @@ public function testVocabularyPermissionsTaxonomyTerm() {
     // Visit the main taxonomy administration page.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertField('edit-name-0-value', 'Add taxonomy term form opened successfully.');
+    $this->assertField('edit-name-0-value');
 
     // Submit the term.
     $edit = [];
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
index 062e1f827743..73b46d0719d5 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
@@ -39,7 +39,7 @@ public function testVocabularyLanguage() {
     $this->drupalGet('admin/structure/taxonomy/add');
 
     // Check that the field to enable content translation is available.
-    $this->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
+    $this->assertField('edit-default-language-content-translation');
 
     // Create the vocabulary.
     $vid = mb_strtolower($this->randomMachineName());
diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php
index e61ae8034d66..7545df844857 100644
--- a/core/modules/user/tests/src/Functional/UserAdminTest.php
+++ b/core/modules/user/tests/src/Functional/UserAdminTest.php
@@ -67,11 +67,11 @@ public function testUserAdmin() {
 
     // Test exposed filter elements.
     foreach (['user', 'role', 'permission', 'status'] as $field) {
-      $this->assertField("edit-$field", "$field exposed filter found.");
+      $this->assertField("edit-$field");
     }
     // Make sure the reduce duplicates element from the ManyToOneHelper is not
     // displayed.
-    $this->assertNoField('edit-reduce-duplicates', 'Reduce duplicates form element not found in exposed filters.');
+    $this->assertNoField('edit-reduce-duplicates');
 
     // Filter the users by name/email.
     $this->drupalGet('admin/people', ['query' => ['user' => $user_a->getAccountName()]]);
diff --git a/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php b/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
index 3a2546d59a17..1666b9894306 100644
--- a/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
+++ b/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
@@ -67,7 +67,7 @@ public function testFilterBooleanUI() {
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     $this->drupalGet('admin/structure/views/nojs/handler/test_view/default/filter/status');
     $this->assertFieldByName('options[group_info][default_group]', 2, 'Second item was set as the default.');
-    $this->assertNoField('options[group_info][group_items][3][remove]', 'Third item was removed.');
+    $this->assertNoField('options[group_info][group_items][3][remove]');
   }
 
 }
-- 
GitLab