diff --git a/core/modules/action/tests/src/Functional/ConfigurationTest.php b/core/modules/action/tests/src/Functional/ConfigurationTest.php
index 2a4a7452e2..fae4974d5f 100644
--- a/core/modules/action/tests/src/Functional/ConfigurationTest.php
+++ b/core/modules/action/tests/src/Functional/ConfigurationTest.php
@@ -52,8 +52,8 @@ public function testActionConfiguration() {
     $action_id = $edit['id'];
 
     // Make sure that the new complex action was saved properly.
-    $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action.");
-    $this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
+    $this->assertSession()->responseContains(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action.");
+    $this->assertSession()->responseContains($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
 
     // Make another POST request to the action edit page.
     $this->clickLink(t('Configure'));
@@ -66,9 +66,9 @@ public function testActionConfiguration() {
     $this->assertSession()->statusCodeEquals(200);
 
     // Make sure that the action updated properly.
-    $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully updated the complex action.");
-    $this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.");
-    $this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action.");
+    $this->assertSession()->responseContains(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully updated the complex action.");
+    $this->assertSession()->responseNotContains($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.");
+    $this->assertSession()->responseContains($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action.");
 
     $this->clickLink(t('Configure'));
     $element = $this->xpath('//input[@type="text" and @value="admin"]');
@@ -86,7 +86,7 @@ public function testActionConfiguration() {
     $this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]), 'Make sure that we get a delete confirmation message.');
     $this->drupalGet('admin/config/system/actions');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
+    $this->assertSession()->responseNotContains($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
 
     $action = Action::load($action_id);
     $this->assertNull($action, 'Make sure the action is gone after being deleted.');
diff --git a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
index ed1ce4fd67..82b126e425 100644
--- a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
@@ -36,7 +36,7 @@ public function testAddFeed() {
     // Check feed source.
     $this->drupalGet('aggregator/sources/' . $feed->id());
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($feed->label(), 'Page title');
+    $this->assertSession()->responseContains($feed->label(), 'Page title');
     $this->assertRaw($feed->getWebsiteUrl());
 
     // Try to add a duplicate.
@@ -92,7 +92,7 @@ public function testAddLongFeed() {
     // Check feed source.
     $this->drupalGet('aggregator/sources/' . $feed->id());
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($feed->label(), 'Page title');
+    $this->assertSession()->responseContains($feed->label(), 'Page title');
 
     // Delete feeds.
     $this->deleteFeed($feed);
diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
index aa9b297342..465435d2af 100644
--- a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
@@ -24,9 +24,9 @@ public function testSettingsPage() {
     $this->clickLink('Aggregator');
     $this->clickLink('Settings');
     // Make sure that test plugins are present.
-    $this->assertText('Test fetcher');
-    $this->assertText('Test parser');
-    $this->assertText('Test processor');
+    $this->assertSession()->responseContains('Test fetcher');
+    $this->assertSession()->responseContains('Test parser');
+    $this->assertSession()->responseContains('Test processor');
 
     // Set new values and enable test plugins.
     $edit = [
@@ -39,20 +39,20 @@ public function testSettingsPage() {
       'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor',
     ];
     $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
 
     foreach ($edit as $name => $value) {
       $this->assertFieldByName($name, $value, new FormattableMarkup('"@name" has correct default value.', ['@name' => $name]));
     }
 
     // Check for our test processor settings form.
-    $this->assertText(t('Dummy length setting'));
+    $this->assertSession()->responseContains(t('Dummy length setting'));
     // Change its value to ensure that settingsSubmit is called.
     $edit = [
       'dummy_length' => 100,
     ];
     $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
     $this->assertFieldByName('dummy_length', 100, '"dummy_length" has correct default value.');
 
     // Make sure settings form is still accessible even after uninstalling a module
diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
index fd6c673254..fa8d5ee0aa 100644
--- a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
@@ -57,7 +57,7 @@ public function testBlockLinks() {
 
     // Confirm that the block is now being displayed on pages.
     $this->drupalGet('test-page');
-    $this->assertText($block->label(), 'Feed block is displayed on the page.');
+    $this->assertSession()->responseContains($block->label(), 'Feed block is displayed on the page.');
 
     // Confirm items appear as links.
     $items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
@@ -87,7 +87,7 @@ public function testBlockLinks() {
     $block->save();
     // Check that the block is no longer displayed.
     $this->drupalGet('test-page');
-    $this->assertNoText($block->label(), 'Feed block is not displayed on the page when number of items is set to 0.');
+    $this->assertSession()->responseNotContains($block->label(), 'Feed block is not displayed on the page when number of items is set to 0.');
   }
 
   /**
diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
index 54b57137ad..c852881251 100644
--- a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php
@@ -70,7 +70,7 @@ protected function setUp() {
   public function createFeed($feed_url = NULL, array $edit = []) {
     $edit = $this->getFeedEditArray($feed_url, $edit);
     $this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
-    $this->assertText(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
+    $this->assertSession()->responseContains(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
 
     // Verify that the creation message contains a link to a feed.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'aggregator/sources/']);
diff --git a/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php b/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php
index e31fe47cf6..174ce98129 100644
--- a/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php
@@ -38,7 +38,7 @@ public function testDeleteFeed() {
 
     // Delete feed.
     $this->deleteFeed($feed1);
-    $this->assertText($feed2->label());
+    $this->assertSession()->responseContains($feed2->label());
     $block_storage = $this->container->get('entity_type.manager')->getStorage('block');
     $this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
     $this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');
diff --git a/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
index f02a227156..581f30dfb8 100644
--- a/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
@@ -26,20 +26,20 @@ public function testFeedUpdateFields() {
 
     // The scheduled feed shows that it has not been updated yet and is
     // scheduled.
-    $this->assertText('never', 'The scheduled feed has not been updated yet.  Last update shows "never".');
-    $this->assertText('imminently', 'The scheduled feed has not been updated yet. Next update shows "imminently".');
-    $this->assertNoText('ago', 'The scheduled feed has not been updated yet.  Last update does not show "x x ago".');
-    $this->assertNoText('left', 'The scheduled feed has not been updated yet.  Next update does not show "x x left".');
+    $this->assertSession()->responseContains('never', 'The scheduled feed has not been updated yet.  Last update shows "never".');
+    $this->assertSession()->responseContains('imminently', 'The scheduled feed has not been updated yet. Next update shows "imminently".');
+    $this->assertSession()->responseNotContains('ago', 'The scheduled feed has not been updated yet.  Last update does not show "x x ago".');
+    $this->assertSession()->responseNotContains('left', 'The scheduled feed has not been updated yet.  Next update does not show "x x left".');
 
     $this->updateFeedItems($scheduled_feed);
     $this->drupalGet('admin/config/services/aggregator');
 
     // After the update, an interval should be displayed on both last updated
     // and next update.
-    $this->assertNoText('never', 'The scheduled feed has been updated. Last updated changed.');
-    $this->assertNoText('imminently', 'The scheduled feed has been updated. Next update changed.');
-    $this->assertText('ago', 'The scheduled feed been updated.  Last update shows "x x ago".');
-    $this->assertText('left', 'The scheduled feed has been updated. Next update shows "x x left".');
+    $this->assertSession()->responseNotContains('never', 'The scheduled feed has been updated. Last updated changed.');
+    $this->assertSession()->responseNotContains('imminently', 'The scheduled feed has been updated. Next update changed.');
+    $this->assertSession()->responseContains('ago', 'The scheduled feed been updated.  Last update shows "x x ago".');
+    $this->assertSession()->responseContains('left', 'The scheduled feed has been updated. Next update shows "x x left".');
 
     // Delete scheduled feed.
     $this->deleteFeed($scheduled_feed);
@@ -49,20 +49,20 @@ public function testFeedUpdateFields() {
 
     $this->drupalGet('admin/config/services/aggregator');
     // The non scheduled feed shows that it has not been updated yet.
-    $this->assertText('never', 'The non scheduled feed has not been updated yet.  Last update shows "never".');
-    $this->assertNoText('imminently', 'The non scheduled feed does not show "imminently" as next update.');
-    $this->assertNoText('ago', 'The non scheduled feed has not been updated. It does not show "x x ago" as last update.');
-    $this->assertNoText('left', 'The feed is not scheduled. It does not show a timeframe "x x left" for next update.');
+    $this->assertSession()->responseContains('never', 'The non scheduled feed has not been updated yet.  Last update shows "never".');
+    $this->assertSession()->responseNotContains('imminently', 'The non scheduled feed does not show "imminently" as next update.');
+    $this->assertSession()->responseNotContains('ago', 'The non scheduled feed has not been updated. It does not show "x x ago" as last update.');
+    $this->assertSession()->responseNotContains('left', 'The feed is not scheduled. It does not show a timeframe "x x left" for next update.');
 
     $this->updateFeedItems($non_scheduled_feed);
     $this->drupalGet('admin/config/services/aggregator');
 
     // After the feed update, we still need to see "never" as next update label.
     // Last update will show an interval.
-    $this->assertNoText('imminently', 'The updated non scheduled feed does not show "imminently" as next update.');
-    $this->assertText('never', 'The updated non scheduled feed still shows "never" as next update.');
-    $this->assertText('ago', 'The non scheduled feed has been updated. It shows "x x ago" as last update.');
-    $this->assertNoText('left', 'The feed is not scheduled. It does not show a timeframe "x x left" for next update.');
+    $this->assertSession()->responseNotContains('imminently', 'The updated non scheduled feed does not show "imminently" as next update.');
+    $this->assertSession()->responseContains('never', 'The updated non scheduled feed still shows "never" as next update.');
+    $this->assertSession()->responseContains('ago', 'The non scheduled feed has been updated. It shows "x x ago" as last update.');
+    $this->assertSession()->responseNotContains('left', 'The feed is not scheduled. It does not show a timeframe "x x left" for next update.');
   }
 
   /**
diff --git a/core/modules/aggregator/tests/src/Functional/FeedParserTest.php b/core/modules/aggregator/tests/src/Functional/FeedParserTest.php
index 95be9e5171..6a8d479ece 100644
--- a/core/modules/aggregator/tests/src/Functional/FeedParserTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedParserTest.php
@@ -38,18 +38,18 @@ public function testRSS091Sample() {
     $feed->refreshItems();
     $this->drupalGet('aggregator/sources/' . $feed->id());
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('First example feed item title');
+    $this->assertSession()->responseContains('First example feed item title');
     $this->assertLinkByHref('http://example.com/example-turns-one');
-    $this->assertText('First example feed item description.');
+    $this->assertSession()->responseContains('First example feed item description.');
     $this->assertRaw('<img src="http://example.com/images/druplicon.png"');
 
     // Several additional items that include elements over 255 characters.
     $this->assertRaw("Second example feed item title.");
-    $this->assertText('Long link feed item title');
-    $this->assertText('Long link feed item description');
+    $this->assertSession()->responseContains('Long link feed item title');
+    $this->assertSession()->responseContains('Long link feed item description');
     $this->assertLinkByHref('http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing');
-    $this->assertText('Long author feed item title');
-    $this->assertText('Long author feed item description');
+    $this->assertSession()->responseContains('Long author feed item title');
+    $this->assertSession()->responseContains('Long author feed item description');
     $this->assertLinkByHref('http://example.com/long/author');
   }
 
@@ -61,17 +61,17 @@ public function testAtomSample() {
     $feed->refreshItems();
     $this->drupalGet('aggregator/sources/' . $feed->id());
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Atom-Powered Robots Run Amok');
+    $this->assertSession()->responseContains('Atom-Powered Robots Run Amok');
     $this->assertLinkByHref('http://example.org/2003/12/13/atom03');
-    $this->assertText('Some text.');
+    $this->assertSession()->responseContains('Some text.');
     $iids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/13/atom03')->execute();
     $item = Item::load(array_values($iids)[0]);
     $this->assertEqual('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.');
 
     // Check for second feed entry.
-    $this->assertText('We tried to stop them, but we failed.');
+    $this->assertSession()->responseContains('We tried to stop them, but we failed.');
     $this->assertLinkByHref('http://example.org/2003/12/14/atom03');
-    $this->assertText('Some other text.');
+    $this->assertSession()->responseContains('Some other text.');
     $iids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/14/atom03')->execute();
     $item = Item::load(array_values($iids)[0]);
     $this->assertEqual('urn:uuid:1225c695-cfb8-4ebb-bbbb-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.');
diff --git a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
index ece1634c0d..f92169acb2 100644
--- a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
+++ b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
@@ -41,7 +41,7 @@ public function openImportForm() {
     $this->drupalPlaceBlock('help_block', ['region' => 'help']);
 
     $this->drupalGet('admin/config/services/aggregator/add/opml');
-    $this->assertText('A single OPML document may contain many feeds.', 'Found OPML help text.');
+    $this->assertSession()->responseContains('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.');
@@ -68,7 +68,7 @@ public function validateImportFormFields() {
 
     $edit = ['remote' => 'invalidUrl://empty'];
     $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
-    $this->assertText(t('The URL invalidUrl://empty is not valid.'), 'Error if the URL is invalid.');
+    $this->assertSession()->responseContains(t('The URL invalidUrl://empty is not valid.'), 'Error if the URL is invalid.');
 
     $after = $count_query->execute();
     $this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.');
@@ -83,11 +83,11 @@ protected function submitImportForm() {
 
     $form['files[upload]'] = $this->getInvalidOpml();
     $this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import'));
-    $this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.');
+    $this->assertSession()->responseContains(t('No new feed has been added.'), 'Attempting to upload invalid XML.');
 
     $edit = ['remote' => file_create_url($this->getEmptyOpml())];
     $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
-    $this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
+    $this->assertSession()->responseContains(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
 
     $after = $count_query->execute();
     $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');
diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php
index fdbcc04eab..1246999dbc 100644
--- a/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php
+++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php
@@ -44,7 +44,7 @@ public function testUpdateFeedItem() {
     $this->assertSession()->statusCodeEquals(200);
 
     $this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
-    $this->assertText(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
+    $this->assertSession()->responseContains(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
 
     // Verify that the creation message contains a link to a feed.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'aggregator/sources/']);
diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
index 798bc55781..0f4b0e5abe 100644
--- a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
@@ -32,7 +32,7 @@ public function testUpdateFeed() {
         $edit[$same_field] = $feed->{$same_field}->value;
       }
       $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save'));
-      $this->assertText(t('The feed @name has been updated.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']]));
+      $this->assertSession()->responseContains(t('The feed @name has been updated.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']]));
 
       // Verify that the creation message contains a link to a feed.
       $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'aggregator/sources/']);
@@ -45,7 +45,7 @@ public function testUpdateFeed() {
       // Check feed source.
       $this->drupalGet('aggregator/sources/' . $feed->id());
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertText($edit['title[0][value]'], 'Page title');
+      $this->assertSession()->responseContains($edit['title[0][value]'], 'Page title');
 
       // Set correct title so deleteFeed() will work.
       $feed->title = $edit['title[0][value]'];
diff --git a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
index 0647b16cb2..39f8805465 100644
--- a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
+++ b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
@@ -47,25 +47,25 @@ public function testIPAddressValidation() {
     $edit = [];
     $edit['ip'] = '1.2.3.3';
     $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
-    $this->assertText(t('This IP address is already banned.'));
+    $this->assertSession()->responseContains(t('This IP address is already banned.'));
 
     // Try to block a reserved IP address.
     $edit = [];
     $edit['ip'] = '255.255.255.255';
     $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
-    $this->assertText(t('Enter a valid IP address.'));
+    $this->assertSession()->responseContains(t('Enter a valid IP address.'));
 
     // Try to block a reserved IP address.
     $edit = [];
     $edit['ip'] = 'test.example.com';
     $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
-    $this->assertText(t('Enter a valid IP address.'));
+    $this->assertSession()->responseContains(t('Enter a valid IP address.'));
 
     // Submit an empty form.
     $edit = [];
     $edit['ip'] = '';
     $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
-    $this->assertText(t('Enter a valid IP address.'));
+    $this->assertSession()->responseContains(t('Enter a valid IP address.'));
 
     // Pass an IP address as a URL parameter and submit it.
     $submit_ip = '1.2.3.4';
@@ -80,7 +80,7 @@ public function testIPAddressValidation() {
     // $edit = array();
     // $edit['ip'] = \Drupal::request()->getClientIP();
     // $this->drupalPostForm('admin/config/people/ban', $edit, t('Save'));
-    // $this->assertText(t('You may not ban your own IP address.'));
+    // $this->assertSession()->responseContains(t('You may not ban your own IP address.'));
 
     // Test duplicate ip address are not present in the 'blocked_ips' table.
     // when they are entered programmatically.
diff --git a/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php
index 96b52757ea..d2fe708a7e 100644
--- a/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php
+++ b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php
@@ -49,7 +49,7 @@ public function testBasicAuth() {
 
     // Ensure we can log in with valid authentication details.
     $this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
-    $this->assertText($account->getAccountName(), 'Account name is displayed.');
+    $this->assertSession()->responseContains($account->getAccountName(), 'Account name is displayed.');
     $this->assertSession()->statusCodeEquals(200);
     $this->mink->resetSessions();
     $this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
@@ -58,7 +58,7 @@ public function testBasicAuth() {
 
     // Ensure that invalid authentication details give access denied.
     $this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName());
-    $this->assertNoText($account->getAccountName(), 'Bad basic auth credentials do not authenticate the user.');
+    $this->assertSession()->responseNotContains($account->getAccountName(), 'Bad basic auth credentials do not authenticate the user.');
     $this->assertSession()->statusCodeEquals(403);
     $this->mink->resetSessions();
 
@@ -165,7 +165,7 @@ public function testLocale() {
     $url = Url::fromRoute('router_test.11');
 
     $this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
-    $this->assertText($account->getAccountName(), 'Account name is displayed.');
+    $this->assertSession()->responseContains($account->getAccountName(), 'Account name is displayed.');
     $this->assertSession()->statusCodeEquals(200);
   }
 
@@ -179,24 +179,24 @@ public function testUnauthorizedErrorMessage() {
     // Case when no credentials are passed.
     $this->drupalGet($url);
     $this->assertSession()->statusCodeEquals(401);
-    $this->assertNoText('Exception', "No raw exception is displayed on the page.");
-    $this->assertText('Please log in to access this page.', "A user friendly access unauthorized message is displayed.");
+    $this->assertSession()->responseNotContains('Exception', "No raw exception is displayed on the page.");
+    $this->assertSession()->responseContains('Please log in to access this page.', "A user friendly access unauthorized message is displayed.");
 
     // Case when empty credentials are passed.
     $this->basicAuthGet($url, NULL, NULL);
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertText('Access denied', "A user friendly access denied message is displayed");
+    $this->assertSession()->responseContains('Access denied', "A user friendly access denied message is displayed");
 
     // Case when wrong credentials are passed.
     $this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName());
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertText('Access denied', "A user friendly access denied message is displayed");
+    $this->assertSession()->responseContains('Access denied', "A user friendly access denied message is displayed");
 
     // Case when correct credentials but hasn't access to the route.
     $url = Url::fromRoute('router_test.15');
     $this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertText('Access denied', "A user friendly access denied message is displayed");
+    $this->assertSession()->responseContains('Access denied', "A user friendly access denied message is displayed");
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockCacheTest.php b/core/modules/block/tests/src/Functional/BlockCacheTest.php
index 7bc2e7ff65..5ba8a69342 100644
--- a/core/modules/block/tests/src/Functional/BlockCacheTest.php
+++ b/core/modules/block/tests/src/Functional/BlockCacheTest.php
@@ -82,20 +82,20 @@ public function testCachePerRole() {
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalLogin($this->normalUser);
     $this->drupalGet('');
-    $this->assertText($current_content, 'Block content displays.');
+    $this->assertSession()->responseContains($current_content, 'Block content displays.');
 
     // Change the content, but the cached copy should still be served.
     $old_content = $current_content;
     $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalGet('');
-    $this->assertText($old_content, 'Block is served from the cache.');
+    $this->assertSession()->responseContains($old_content, 'Block is served from the cache.');
 
     // Clear the cache and verify that the stale data is no longer there.
     Cache::invalidateTags(['block_view']);
     $this->drupalGet('');
-    $this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
-    $this->assertText($current_content, 'Fresh block content is displayed after clearing the cache.');
+    $this->assertSession()->responseNotContains($old_content, 'Block cache clear removes stale cache data.');
+    $this->assertSession()->responseContains($current_content, 'Fresh block content is displayed after clearing the cache.');
 
     // Test whether the cached data is served for the correct users.
     $old_content = $current_content;
@@ -103,19 +103,19 @@ public function testCachePerRole() {
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalLogout();
     $this->drupalGet('');
-    $this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.');
+    $this->assertSession()->responseNotContains($old_content, 'Anonymous user does not see content cached per-role for normal user.');
 
     $this->drupalLogin($this->normalUserAlt);
     $this->drupalGet('');
-    $this->assertText($old_content, 'User with the same roles sees per-role cached content.');
+    $this->assertSession()->responseContains($old_content, 'User with the same roles sees per-role cached content.');
 
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('');
-    $this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
+    $this->assertSession()->responseNotContains($old_content, 'Admin user does not see content cached per-role for normal user.');
 
     $this->drupalLogin($this->normalUser);
     $this->drupalGet('');
-    $this->assertText($old_content, 'Block is served from the per-role cache.');
+    $this->assertSession()->responseContains($old_content, 'Block is served from the per-role cache.');
   }
 
   /**
@@ -130,18 +130,18 @@ public function testCachePermissions() {
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('');
-    $this->assertText($current_content, 'Block content displays.');
+    $this->assertSession()->responseContains($current_content, 'Block content displays.');
 
     $old_content = $current_content;
     $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('user');
-    $this->assertText($old_content, 'Block content served from cache.');
+    $this->assertSession()->responseContains($old_content, 'Block content served from cache.');
 
     $this->drupalLogout();
     $this->drupalGet('user');
-    $this->assertText($current_content, 'Block content not served from cache.');
+    $this->assertSession()->responseContains($current_content, 'Block content not served from cache.');
   }
 
   /**
@@ -155,13 +155,13 @@ public function testNoCache() {
 
     // If max_age = 0 has no effect, the next request would be cached.
     $this->drupalGet('');
-    $this->assertText($current_content, 'Block content displays.');
+    $this->assertSession()->responseContains($current_content, 'Block content displays.');
 
     // A cached copy should not be served.
     $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalGet('');
-    $this->assertText($current_content, 'Maximum age of zero prevents blocks from being cached.');
+    $this->assertSession()->responseContains($current_content, 'Maximum age of zero prevents blocks from being cached.');
   }
 
   /**
@@ -175,22 +175,22 @@ public function testCachePerUser() {
     $this->drupalLogin($this->normalUser);
 
     $this->drupalGet('');
-    $this->assertText($current_content, 'Block content displays.');
+    $this->assertSession()->responseContains($current_content, 'Block content displays.');
 
     $old_content = $current_content;
     $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('');
-    $this->assertText($old_content, 'Block is served from per-user cache.');
+    $this->assertSession()->responseContains($old_content, 'Block is served from per-user cache.');
 
     $this->drupalLogin($this->normalUserAlt);
     $this->drupalGet('');
-    $this->assertText($current_content, 'Per-user block cache is not served for other users.');
+    $this->assertSession()->responseContains($current_content, 'Per-user block cache is not served for other users.');
 
     $this->drupalLogin($this->normalUser);
     $this->drupalGet('');
-    $this->assertText($old_content, 'Per-user block cache is persistent.');
+    $this->assertSession()->responseContains($old_content, 'Per-user block cache is persistent.');
   }
 
   /**
@@ -203,7 +203,7 @@ public function testCachePerPage() {
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('test-page');
-    $this->assertText($current_content, 'Block content displays on the test page.');
+    $this->assertSession()->responseContains($current_content, 'Block content displays on the test page.');
 
     $old_content = $current_content;
     $current_content = $this->randomMachineName();
@@ -211,10 +211,10 @@ public function testCachePerPage() {
 
     $this->drupalGet('user');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText($old_content, 'Block content cached for the test page does not show up for the user page.');
+    $this->assertSession()->responseNotContains($old_content, 'Block content cached for the test page does not show up for the user page.');
     $this->drupalGet('test-page');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($old_content, 'Block content cached for the test page.');
+    $this->assertSession()->responseContains($old_content, 'Block content cached for the test page.');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php b/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php
index 2b88abbc35..c8cd18e5c9 100644
--- a/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php
+++ b/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php
@@ -43,25 +43,25 @@ public function testCachePerPage() {
     // Go to "test-page" and test if the block is enabled.
     $this->drupalGet('test-page');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Your .com email address.', 'form found');
+    $this->assertSession()->responseContains('Your .com email address.', 'form found');
 
     // Make sure that we're currently still on /test-page after submitting the
     // form.
     $this->drupalPostForm(NULL, $form_values, t('Submit'));
     $this->assertUrl('test-page');
-    $this->assertText(t('Your email address is @email', ['@email' => 'test@example.com']));
+    $this->assertSession()->responseContains(t('Your email address is @email', ['@email' => 'test@example.com']));
 
     // Go to a different page and see if the block is enabled there as well.
     $this->drupalGet('test-render-title');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Your .com email address.', 'form found');
+    $this->assertSession()->responseContains('Your .com email address.', 'form found');
 
     // Make sure that submitting the form didn't redirect us to the first page
     // we submitted the form from after submitting the form from
     // /test-render-title.
     $this->drupalPostForm(NULL, $form_values, t('Submit'));
     $this->assertUrl('test-render-title');
-    $this->assertText(t('Your email address is @email', ['@email' => 'test@example.com']));
+    $this->assertSession()->responseContains(t('Your email address is @email', ['@email' => 'test@example.com']));
   }
 
   /**
@@ -71,7 +71,7 @@ public function testPlaceholders() {
     $this->drupalGet('test-multiple-forms');
 
     $placeholder = 'form_action_' . Crypt::hashBase64('Drupal\Core\Form\FormBuilder::prepareForm');
-    $this->assertText('Form action: ' . $placeholder, 'placeholder found.');
+    $this->assertSession()->responseContains('Form action: ' . $placeholder, 'placeholder found.');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockHiddenRegionTest.php b/core/modules/block/tests/src/Functional/BlockHiddenRegionTest.php
index 0e3f3ff083..5d8f36d620 100644
--- a/core/modules/block/tests/src/Functional/BlockHiddenRegionTest.php
+++ b/core/modules/block/tests/src/Functional/BlockHiddenRegionTest.php
@@ -52,7 +52,7 @@ public function testBlockNotInHiddenRegion() {
 
     // Ensure that the search form block is displayed.
     $this->drupalGet('');
-    $this->assertText('Search', 'Block was displayed on the front page.');
+    $this->assertSession()->responseContains('Search', 'Block was displayed on the front page.');
 
     // Install "block_test_theme" and set it as the default theme.
     $theme = 'block_test_theme';
@@ -68,11 +68,11 @@ public function testBlockNotInHiddenRegion() {
 
     // Ensure that "block_test_theme" is set as the default theme.
     $this->drupalGet('admin/structure/block');
-    $this->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.');
+    $this->assertSession()->responseContains('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.');
 
     // Ensure that the search form block is displayed.
     $this->drupalGet('');
-    $this->assertText('Search', 'Block was displayed on the front page.');
+    $this->assertSession()->responseContains('Search', 'Block was displayed on the front page.');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockInstallTest.php b/core/modules/block/tests/src/Functional/BlockInstallTest.php
index 78297f9f7a..b0e24a38e0 100644
--- a/core/modules/block/tests/src/Functional/BlockInstallTest.php
+++ b/core/modules/block/tests/src/Functional/BlockInstallTest.php
@@ -19,7 +19,7 @@ class BlockInstallTest extends BrowserTestBase {
   public function testCacheTagInvalidationUponInstallation() {
     // Warm the page cache.
     $this->drupalGet('');
-    $this->assertNoText('Powered by Drupal');
+    $this->assertSession()->responseNotContains('Powered by Drupal');
     $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:block_list');
 
     // Install the block module, and place the "Powered by Drupal" block.
@@ -32,7 +32,7 @@ public function testCacheTagInvalidationUponInstallation() {
     // invalidated the 'rendered' cache tag to make blocks show up.
     $this->drupalGet('');
     $this->assertCacheTag('config:block_list');
-    $this->assertText('Powered by Drupal');
+    $this->assertSession()->responseContains('Powered by Drupal');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php b/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php
index 5a6aeef95b..4561c35aa2 100644
--- a/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php
+++ b/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php
@@ -68,13 +68,13 @@ public function testBlockLinks() {
     $edit['label'] = $this->randomMachineName();
     $edit['id'] = mb_strtolower($edit['label']);
     $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
-    $this->assertText(t('Menu @label has been added.', ['@label' => $edit['label']]));
+    $this->assertSession()->responseContains(t('Menu @label has been added.', ['@label' => $edit['label']]));
 
     // Check that the block is listed for all languages.
     foreach ($this->langcodes as $langcode) {
       $this->drupalGet('admin/structure/block', ['language' => $langcode]);
       $this->clickLink('Place block');
-      $this->assertText($edit['label']);
+      $this->assertSession()->responseContains($edit['label']);
     }
   }
 
diff --git a/core/modules/block/tests/src/Functional/BlockLanguageTest.php b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
index b3be64f3fd..906f6c1884 100644
--- a/core/modules/block/tests/src/Functional/BlockLanguageTest.php
+++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
@@ -41,7 +41,7 @@ protected function setUp(): void {
       'predefined_langcode' => 'fr',
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
-    $this->assertText('French', 'Language added successfully.');
+    $this->assertSession()->responseContains('French', 'Language added successfully.');
   }
 
   /**
@@ -71,11 +71,11 @@ public function testLanguageBlockVisibility() {
 
     // Check that a page has a block.
     $this->drupalGet('en');
-    $this->assertText('Powered by Drupal', 'The body of the custom block appears on the page.');
+    $this->assertSession()->responseContains('Powered by Drupal', 'The body of the custom block appears on the page.');
 
     // Check that a page doesn't has a block for the current language anymore.
     $this->drupalGet('fr');
-    $this->assertNoText('Powered by Drupal', 'The body of the custom block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the custom block does not appear on the page.');
   }
 
   /**
@@ -150,9 +150,9 @@ public function testMultipleLanguageTypes() {
 
     // Interface negotiation depends on request arguments.
     $this->drupalGet('node', ['query' => ['language' => 'en']]);
-    $this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the block does not appear on the page.');
     $this->drupalGet('node', ['query' => ['language' => 'fr']]);
-    $this->assertText('Powered by Drupal', 'The body of the block appears on the page.');
+    $this->assertSession()->responseContains('Powered by Drupal', 'The body of the block appears on the page.');
 
     // Log in again in order to clear the interface language stored in the
     // session.
@@ -162,9 +162,9 @@ public function testMultipleLanguageTypes() {
     // Content language does not depend on session/request arguments.
     // It will fall back on English (site default) and not display the block.
     $this->drupalGet('en');
-    $this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the block does not appear on the page.');
     $this->drupalGet('fr');
-    $this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the block does not appear on the page.');
 
     // Change visibility to now depend on content language for this block.
     $edit = [
@@ -175,15 +175,15 @@ public function testMultipleLanguageTypes() {
     // Content language negotiation does not depend on request arguments.
     // It will fall back on English (site default) and not display the block.
     $this->drupalGet('node', ['query' => ['language' => 'en']]);
-    $this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the block does not appear on the page.');
     $this->drupalGet('node', ['query' => ['language' => 'fr']]);
-    $this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the block does not appear on the page.');
 
     // Content language negotiation depends on path prefix.
     $this->drupalGet('en');
-    $this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'The body of the block does not appear on the page.');
     $this->drupalGet('fr');
-    $this->assertText('Powered by Drupal', 'The body of the block appears on the page.');
+    $this->assertSession()->responseContains('Powered by Drupal', 'The body of the block appears on the page.');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php
index fda29bec0e..d2f393cb35 100644
--- a/core/modules/block/tests/src/Functional/BlockTest.php
+++ b/core/modules/block/tests/src/Functional/BlockTest.php
@@ -45,24 +45,24 @@ public function testBlockVisibility() {
     $this->assertFieldChecked('edit-visibility-request-path-negate-0');
 
     $this->drupalPostForm(NULL, $edit, t('Save block'));
-    $this->assertText('The block configuration has been saved.', 'Block was saved');
+    $this->assertSession()->responseContains('The block configuration has been saved.', 'Block was saved');
 
     $this->clickLink('Configure');
     $this->assertFieldChecked('edit-visibility-request-path-negate-1');
 
     $this->drupalGet('');
-    $this->assertText($title, 'Block was displayed on the front page.');
+    $this->assertSession()->responseContains($title, 'Block was displayed on the front page.');
 
     $this->drupalGet('user');
-    $this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
+    $this->assertSession()->responseNotContains($title, 'Block was not displayed according to block visibility rules.');
 
     // Confirm that the block is not displayed to anonymous users.
     $this->drupalLogout();
     $this->drupalGet('');
-    $this->assertNoText($title, 'Block was not displayed to anonymous users.');
+    $this->assertSession()->responseNotContains($title, 'Block was not displayed to anonymous users.');
 
     // Confirm that an empty block is not displayed.
-    $this->assertNoText('Powered by Drupal', 'Empty block not displayed.');
+    $this->assertSession()->responseNotContains('Powered by Drupal', 'Empty block not displayed.');
     $this->assertNoRaw('sidebar-first', 'Empty sidebar-first region is not displayed.');
   }
 
@@ -120,18 +120,18 @@ public function testBlockVisibilityListedEmpty() {
     // Set the block to be hidden on any user path, and to be shown only to
     // authenticated users.
     $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block'));
-    $this->assertText('The block configuration has been saved.', 'Block was saved');
+    $this->assertSession()->responseContains('The block configuration has been saved.', 'Block was saved');
 
     $this->drupalGet('user');
-    $this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
+    $this->assertSession()->responseNotContains($title, 'Block was not displayed according to block visibility rules.');
 
     $this->drupalGet('USER');
-    $this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
+    $this->assertSession()->responseNotContains($title, 'Block was not displayed according to block visibility rules regardless of path case.');
 
     // Confirm that the block is not displayed to anonymous users.
     $this->drupalLogout();
     $this->drupalGet('');
-    $this->assertNoText($title, 'Block was not displayed to anonymous users on the front page.');
+    $this->assertSession()->responseNotContains($title, 'Block was not displayed to anonymous users on the front page.');
   }
 
   /**
@@ -200,7 +200,7 @@ public function testBlock() {
 
     // Set block title to confirm that interface works and override any custom titles.
     $this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], ['settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']], t('Save block'));
-    $this->assertText(t('The block configuration has been saved.'), 'Block title set.');
+    $this->assertSession()->responseContains(t('The block configuration has been saved.'), 'Block title set.');
     // Check to see if the block was created by checking its configuration.
     $instance = Block::load($block['id']);
 
@@ -216,11 +216,11 @@ public function testBlock() {
     $this->clickLink('Disable');
 
     // Confirm that the block is now listed as disabled.
-    $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to disabled region.');
+    $this->assertSession()->responseContains(t('The block settings have been updated.'), 'Block successfully moved to disabled region.');
 
     // Confirm that the block instance title and markup are not displayed.
     $this->drupalGet('node');
-    $this->assertNoText(t($block['settings[label]']));
+    $this->assertSession()->responseNotContains(t($block['settings[label]']));
     // Check for <div id="block-my-block-instance-name"> if the machine name
     // is my_block_instance_name.
     $xpath = $this->buildXPathQuery('//div[@id=:id]/*', [':id' => 'block-' . str_replace('_', '-', strtolower($block['id']))]);
@@ -260,7 +260,7 @@ public function testBlockThemeSelector() {
       $block['theme'] = $theme;
       $block['region'] = 'content';
       $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
-      $this->assertText(t('The block configuration has been saved.'));
+      $this->assertSession()->responseContains(t('The block configuration has been saved.'));
       $this->assertUrl('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id']));
 
       // Set the default theme and ensure the block is placed.
@@ -304,22 +304,22 @@ public function testHideBlockTitle() {
       'settings[label]' => $title,
     ];
     $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block'));
-    $this->assertText('The block configuration has been saved.', 'Block was saved');
+    $this->assertSession()->responseContains('The block configuration has been saved.', 'Block was saved');
 
     $this->drupalGet('user');
-    $this->assertNoText($title, 'Block title was not displayed by default.');
+    $this->assertSession()->responseNotContains($title, 'Block title was not displayed by default.');
 
     $edit = [
       'settings[label_display]' => TRUE,
     ];
     $this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, t('Save block'));
-    $this->assertText('The block configuration has been saved.', 'Block was saved');
+    $this->assertSession()->responseContains('The block configuration has been saved.', 'Block was saved');
 
     $this->drupalGet('admin/structure/block/manage/' . $id);
     $this->assertFieldChecked('edit-settings-label-display', 'The display_block option has the correct default value on the configuration form.');
 
     $this->drupalGet('user');
-    $this->assertText($title, 'Block title was displayed when enabled.');
+    $this->assertSession()->responseContains($title, 'Block title was displayed when enabled.');
   }
 
   /**
@@ -342,11 +342,11 @@ public function moveBlockToRegion(array $block, $region) {
     $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks'));
 
     // Confirm that the block was moved to the proper region.
-    $this->assertText(t('The block settings have been updated.'), new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region]));
+    $this->assertSession()->responseContains(t('The block settings have been updated.'), new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region]));
 
     // Confirm that the block is being displayed.
     $this->drupalGet('');
-    $this->assertText(t($block['settings[label]']), 'Block successfully being displayed on the page.');
+    $this->assertSession()->responseContains(t($block['settings[label]']), 'Block successfully being displayed on the page.');
 
     // Confirm that the custom block was found at the proper region.
     $xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [
@@ -481,7 +481,7 @@ public function testThemeAdminLink() {
     ]);
     $this->drupalLogin($theme_admin);
     $this->drupalGet('admin/appearance');
-    $this->assertText('You can place blocks for each theme on the block layout page');
+    $this->assertSession()->responseContains('You can place blocks for each theme on the block layout page');
     $this->assertLinkByHref('admin/structure/block');
   }
 
@@ -496,7 +496,7 @@ public function testUninstallTheme() {
     $this->config('system.theme')->set('default', 'seven')->save();
     $block = $this->drupalPlaceBlock('system_powered_by_block', ['theme' => 'seven', 'region' => 'help']);
     $this->drupalGet('<front>');
-    $this->assertText('Powered by Drupal');
+    $this->assertSession()->responseContains('Powered by Drupal');
 
     $this->config('system.theme')->set('default', 'classy')->save();
     $theme_installer->uninstall(['seven']);
@@ -512,11 +512,11 @@ public function testBlockAccess() {
     $this->drupalPlaceBlock('test_access', ['region' => 'help']);
 
     $this->drupalGet('<front>');
-    $this->assertNoText('Hello test world');
+    $this->assertSession()->responseNotContains('Hello test world');
 
     \Drupal::state()->set('test_block_access', TRUE);
     $this->drupalGet('<front>');
-    $this->assertText('Hello test world');
+    $this->assertSession()->responseContains('Hello test world');
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php
index 86489ada21..af17ef8048 100644
--- a/core/modules/block/tests/src/Functional/BlockUiTest.php
+++ b/core/modules/block/tests/src/Functional/BlockUiTest.php
@@ -228,7 +228,7 @@ public function testContextAwareUnsatisfiedBlocks() {
   public function testContextAwareBlocks() {
     $expected_text = '<div id="test_context_aware--username">' . \Drupal::currentUser()->getAccountName() . '</div>';
     $this->drupalGet('');
-    $this->assertNoText('Test context-aware block');
+    $this->assertSession()->responseNotContains('Test context-aware block');
     $this->assertNoRaw($expected_text);
 
     $block_url = 'admin/structure/block/add/test_context_aware/classy';
@@ -252,8 +252,8 @@ public function testContextAwareBlocks() {
     $this->drupalPostForm($block_url, $edit, 'Save block');
 
     $this->drupalGet('');
-    $this->assertText('Test context-aware block');
-    $this->assertText('User context found.');
+    $this->assertSession()->responseContains('Test context-aware block');
+    $this->assertSession()->responseContains('User context found.');
     $this->assertRaw($expected_text);
 
     // Test context mapping form element is not visible if there are no valid
@@ -270,8 +270,8 @@ public function testContextAwareBlocks() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Save block');
     $this->drupalGet('');
-    $this->assertText('No context mapping selected.');
-    $this->assertNoText('User context found.');
+    $this->assertSession()->responseContains('No context mapping selected.');
+    $this->assertSession()->responseNotContains('User context found.');
 
     // Tests that conditions with missing context are not displayed.
     $this->drupalGet('admin/structure/block/manage/testcontextawareblock');
@@ -288,13 +288,13 @@ public function testMachineNameSuggestion() {
     $this->assertFieldByName('id', 'displaymessage', 'Block form uses raw machine name suggestion when no instance already exists.');
     $edit = ['region' => 'content'];
     $this->drupalPostForm($url, $edit, 'Save block');
-    $this->assertText('The block configuration has been saved.');
+    $this->assertSession()->responseContains('The block configuration has been saved.');
 
     // Now, check to make sure the form starts by autoincrementing correctly.
     $this->drupalGet($url);
     $this->assertFieldByName('id', 'displaymessage_2', 'Block form appends _2 to plugin-suggested machine name when an instance already exists.');
     $this->drupalPostForm($url, $edit, 'Save block');
-    $this->assertText('The block configuration has been saved.');
+    $this->assertSession()->responseContains('The block configuration has been saved.');
 
     // And verify that it continues working beyond just the first two.
     $this->drupalGet($url);
diff --git a/core/modules/block/tests/src/Functional/NonDefaultBlockAdminTest.php b/core/modules/block/tests/src/Functional/NonDefaultBlockAdminTest.php
index fefe432161..d127328e6b 100644
--- a/core/modules/block/tests/src/Functional/NonDefaultBlockAdminTest.php
+++ b/core/modules/block/tests/src/Functional/NonDefaultBlockAdminTest.php
@@ -41,7 +41,7 @@ public function testNonDefaultBlockAdmin() {
     $new_theme = 'bartik';
     \Drupal::service('theme_installer')->install([$new_theme]);
     $this->drupalGet('admin/structure/block/list/' . $new_theme);
-    $this->assertText('Bartik(' . t('active tab') . ')', 'Tab for non-default theme found.');
+    $this->assertSession()->responseContains('Bartik(' . t('active tab') . ')', 'Tab for non-default theme found.');
   }
 
 }
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
index 49d72b8f16..9ad4e4ab82 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
@@ -248,11 +248,11 @@ public function testBlockDelete() {
 
     // Navigate to home page.
     $this->drupalGet('');
-    $this->assertText($body);
+    $this->assertSession()->responseContains($body);
 
     // Delete the block.
     $this->drupalGet('block/1/delete');
-    $this->assertText(\Drupal::translation()->formatPlural(1, 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instance.'));
+    $this->assertSession()->responseContains(\Drupal::translation()->formatPlural(1, 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instance.'));
 
     $this->drupalPostForm(NULL, [], 'Delete');
     $this->assertRaw(t('The custom block %name has been deleted.', ['%name' => $edit['info[0][value]']]));
@@ -276,7 +276,7 @@ public function testBlockDelete() {
 
     // Show the delete confirm form.
     $this->drupalGet('block/3/delete');
-    $this->assertNoText('This will also remove');
+    $this->assertSession()->responseNotContains('This will also remove');
   }
 
   /**
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
index eaaf8e0b4e..89eedf8d73 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
@@ -110,7 +110,7 @@ public function testListing() {
     $this->assertNoFieldByXpath('//td', $new_label, 'No label found for deleted custom block.');
 
     // Confirm that the empty text is displayed.
-    $this->assertText(t('There are no custom blocks yet.'));
+    $this->assertSession()->responseContains(t('There are no custom blocks yet.'));
 
     $block_content = BlockContent::create([
       'info' => 'Non-reusable block',
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
index a3af1703a1..aeb264fc45 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
@@ -122,7 +122,7 @@ public function testListing() {
     $this->assertNoFieldByXpath('//td', $new_label, 'No label found for deleted custom block.');
 
     // Confirm that the empty text is displayed.
-    $this->assertText('There are no custom blocks available.');
+    $this->assertSession()->responseContains('There are no custom blocks available.');
     $this->assertLink('custom block');
 
     $block_content = BlockContent::create([
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php
index 0cf30f4df9..b8d5405b5a 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php
@@ -98,7 +98,7 @@ public function testRevisions() {
     $loaded->save();
 
     $this->drupalGet('block/' . $loaded->id());
-    $this->assertNoText($loaded->body->value, 'Revision body text is not present on default version of block.');
+    $this->assertSession()->responseNotContains($loaded->body->value, 'Revision body text is not present on default version of block.');
 
     // Verify that the non-default revision id is greater than the default
     // revision id.
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
index 7c04fce442..56894a21d5 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
@@ -61,7 +61,7 @@ public function testBlockContentTypeCreation() {
     // Test the page with no block-types.
     $this->drupalGet('block/add');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('You have not created any block types yet');
+    $this->assertSession()->responseContains('You have not created any block types yet');
     $this->clickLink('block type creation page');
 
     // Create a block type via the user interface.
@@ -166,7 +166,7 @@ public function testBlockContentTypeDeletion() {
       t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()]),
       'The block type will not be deleted until all blocks of that type are removed.'
     );
-    $this->assertNoText(t('This action cannot be undone.'), 'The block type deletion confirmation form is not available.');
+    $this->assertSession()->responseNotContains(t('This action cannot be undone.'), 'The block type deletion confirmation form is not available.');
 
     // Delete the block.
     $block->delete();
@@ -176,7 +176,7 @@ public function testBlockContentTypeDeletion() {
       t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()]),
       'The block type is available for deletion.'
     );
-    $this->assertText(t('This action cannot be undone.'), 'The custom block type deletion confirmation form is available.');
+    $this->assertSession()->responseContains(t('This action cannot be undone.'), 'The custom block type deletion confirmation form is available.');
   }
 
   /**
diff --git a/core/modules/block_content/tests/src/Functional/PageEditTest.php b/core/modules/block_content/tests/src/Functional/PageEditTest.php
index e911e42ef9..8cfb6d4b57 100644
--- a/core/modules/block_content/tests/src/Functional/PageEditTest.php
+++ b/core/modules/block_content/tests/src/Functional/PageEditTest.php
@@ -70,7 +70,7 @@ public function testPageEdit() {
     // Test deleting the block.
     $this->drupalGet("block/" . $revised_block->id());
     $this->clickLink(t('Delete'));
-    $this->assertText(new FormattableMarkup('Are you sure you want to delete the custom block @label?', ['@label' => $revised_block->label()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('Are you sure you want to delete the custom block @label?', ['@label' => $revised_block->label()]));
   }
 
 }
diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
index 853d274614..8c3924495d 100644
--- a/core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
+++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
@@ -44,7 +44,7 @@ public function testRedirectDestination() {
 
     // Check the block content is present in the view redirect destination.
     $this->drupalGet('admin/content/redirect_destination');
-    $this->assertText('Test redirect destination');
+    $this->assertSession()->responseContains('Test redirect destination');
 
     // Edit the created block and save.
     $this->clickLink('Edit');
diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php
index 2bb112b2a8..a0b3a7e8e4 100644
--- a/core/modules/book/tests/src/Functional/BookTest.php
+++ b/core/modules/book/tests/src/Functional/BookTest.php
@@ -124,7 +124,7 @@ public function testEmptyBook() {
     // Log in as a user with access to the book outline and save the form.
     $this->drupalLogin($this->adminUser);
     $this->drupalPostForm('admin/structure/book/' . $book->id(), [], t('Save book pages'));
-    $this->assertText(t('Updated book @book.', ['@book' => $book->label()]));
+    $this->assertSession()->responseContains(t('Updated book @book.', ['@book' => $book->label()]));
   }
 
   /**
@@ -208,7 +208,7 @@ public function testBookExport() {
 
     // Make sure each part of the book is there.
     foreach ($nodes as $node) {
-      $this->assertText($node->label(), 'Node title found in printer friendly version.');
+      $this->assertSession()->responseContains($node->label(), 'Node title found in printer friendly version.');
       $this->assertRaw($node->body->processed, 'Node body found in printer friendly version.');
     }
 
@@ -252,14 +252,14 @@ public function testBookNavigationBlock() {
     $edit = [];
     $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
     $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions'));
-    $this->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users.");
+    $this->assertSession()->responseContains(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users.");
 
     // Test correct display of the block.
     $nodes = $this->createBook();
     $this->drupalGet('<front>');
-    $this->assertText($block->label(), 'Book navigation block is displayed.');
-    $this->assertText($this->book->label(), new FormattableMarkup('Link to book root (@title) is displayed.', ['@title' => $nodes[0]->label()]));
-    $this->assertNoText($nodes[0]->label(), 'No links to individual book pages are displayed.');
+    $this->assertSession()->responseContains($block->label(), 'Book navigation block is displayed.');
+    $this->assertSession()->responseContains($this->book->label(), new FormattableMarkup('Link to book root (@title) is displayed.', ['@title' => $nodes[0]->label()]));
+    $this->assertSession()->responseNotContains($nodes[0]->label(), 'No links to individual book pages are displayed.');
   }
 
   /**
@@ -327,7 +327,7 @@ public function testNavigationBlockOnAccessModuleInstalled() {
     $edit = [];
     $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
     $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions'));
-    $this->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users.");
+    $this->assertSession()->responseContains(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users.");
 
     // Create a book.
     $this->createBook();
@@ -335,16 +335,16 @@ public function testNavigationBlockOnAccessModuleInstalled() {
     // Test correct display of the block to registered users.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/' . $this->book->id());
-    $this->assertText($block->label(), 'Book navigation block is displayed to registered users.');
+    $this->assertSession()->responseContains($block->label(), 'Book navigation block is displayed to registered users.');
     $this->drupalLogout();
 
     // Test correct display of the block to anonymous users.
     $this->drupalGet('node/' . $this->book->id());
-    $this->assertText($block->label(), 'Book navigation block is displayed to anonymous users.');
+    $this->assertSession()->responseContains($block->label(), 'Book navigation block is displayed to anonymous users.');
 
     // Test the 'book pages' block_mode setting.
     $this->drupalGet('<front>');
-    $this->assertNoText($block->label(), 'Book navigation block is not shown on non-book pages.');
+    $this->assertSession()->responseNotContains($block->label(), 'Book navigation block is not shown on non-book pages.');
   }
 
   /**
@@ -387,7 +387,7 @@ public function testBookDelete() {
     $this->drupalPostForm($this->book->toUrl('delete-form'), [], t('Delete'));
     $this->drupalGet($nodes[0]->toUrl());
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($nodes[0]->label());
+    $this->assertSession()->responseContains($nodes[0]->label());
     // The book parents should be updated.
     $node_storage = \Drupal::entityTypeManager()->getStorage('node');
     $node_storage->resetCache();
@@ -488,7 +488,7 @@ public function testBookListing() {
     // Load the book page and assert the created book title is displayed.
     $this->drupalGet('book');
 
-    $this->assertText($this->book->label(), 'The book title is displayed on the book listing page.');
+    $this->assertSession()->responseContains($this->book->label(), 'The book title is displayed on the book listing page.');
   }
 
   /**
@@ -501,7 +501,7 @@ public function testAdminBookListing() {
     // Load the book page and assert the created book title is displayed.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/structure/book');
-    $this->assertText($this->book->label(), 'The book title is displayed on the administrative book listing page.');
+    $this->assertSession()->responseContains($this->book->label(), 'The book title is displayed on the administrative book listing page.');
   }
 
   /**
@@ -515,7 +515,7 @@ public function testAdminBookNodeListing() {
     // Load the book page list and assert the created book title is displayed
     // and action links are shown on list items.
     $this->drupalGet('admin/structure/book/' . $this->book->id());
-    $this->assertText($this->book->label(), 'The book title is displayed on the administrative book listing page.');
+    $this->assertSession()->responseContains($this->book->label(), 'The book title is displayed on the administrative book listing page.');
 
     $elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a');
     $this->assertEqual($elements[0]->getText(), 'View', 'View link is found from the list.');
@@ -574,7 +574,7 @@ public function testBookNavigationBlockOnUnpublishedBook() {
 
     // Test node page.
     $this->drupalGet('node/' . $this->book->id());
-    $this->assertText($this->book->label(), 'Unpublished book with "Show block only on book pages" book navigation settings.');
+    $this->assertSession()->responseContains($this->book->label(), 'Unpublished book with "Show block only on book pages" book navigation settings.');
   }
 
 }
diff --git a/core/modules/book/tests/src/Functional/BookTestTrait.php b/core/modules/book/tests/src/Functional/BookTestTrait.php
index c03dc6c571..236eb254d6 100644
--- a/core/modules/book/tests/src/Functional/BookTestTrait.php
+++ b/core/modules/book/tests/src/Functional/BookTestTrait.php
@@ -144,7 +144,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne
 
     // Check printer friendly version.
     $this->drupalGet('book/export/html/' . $node->id());
-    $this->assertText($node->label(), 'Printer friendly title found.');
+    $this->assertSession()->responseContains($node->label(), 'Printer friendly title found.');
     $this->assertRaw($node->body->processed, 'Printer friendly body found.');
 
     $number++;
diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php
index ac551ec121..071c6e3c7c 100644
--- a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php
+++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php
@@ -233,7 +233,7 @@ public function testExistingFormat() {
     $this->submitForm($edit, 'editor_configure');
     $this->submitForm($edit, 'Save configuration');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The machine-readable name is already in use. It must be unique.');
+    $this->assertSession()->responseContains('The machine-readable name is already in use. It must be unique.');
   }
 
   /**
diff --git a/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php b/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
index 5802e58ca7..e78d69ef20 100644
--- a/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
+++ b/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
@@ -53,7 +53,7 @@ public function testColorPreview() {
     // core/modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html
     $url = Url::fromRoute('system.theme_settings_theme', ['theme' => 'color_test_theme']);
     $this->drupalGet($url);
-    $this->assertText('TEST COLOR PREVIEW');
+    $this->assertSession()->responseContains('TEST COLOR PREVIEW');
 
     $this->assertNoRaw('<script>alert("security filter test");</script>');
     $this->assertRaw('<h2>TEST COLOR PREVIEW</h2>');
diff --git a/core/modules/color/tests/src/Functional/ColorTest.php b/core/modules/color/tests/src/Functional/ColorTest.php
index 015d720294..cbc7b92c11 100644
--- a/core/modules/color/tests/src/Functional/ColorTest.php
+++ b/core/modules/color/tests/src/Functional/ColorTest.php
@@ -170,10 +170,10 @@ public function testValidColor() {
       $this->drupalPostForm($settings_path, $edit, t('Save configuration'));
 
       if ($is_valid) {
-        $this->assertText('The configuration options have been saved.');
+        $this->assertSession()->responseContains('The configuration options have been saved.');
       }
       else {
-        $this->assertText('You must enter a valid hexadecimal color value for Main background.');
+        $this->assertSession()->responseContains('You must enter a valid hexadecimal color value for Main background.');
       }
     }
   }
diff --git a/core/modules/comment/tests/src/Functional/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/CommentAdminTest.php
index 22c1fa748f..5de2e9f8a2 100644
--- a/core/modules/comment/tests/src/Functional/CommentAdminTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentAdminTest.php
@@ -42,7 +42,7 @@ public function testApprovalAdminInterface() {
 
     // Test that the comments page loads correctly when there are no comments
     $this->drupalGet('admin/content/comment');
-    $this->assertText(t('No comments available.'));
+    $this->assertSession()->responseContains(t('No comments available.'));
 
     $this->drupalLogout();
 
@@ -51,7 +51,7 @@ public function testApprovalAdminInterface() {
     $body = $this->randomMachineName();
     // Set $contact to true so that it won't check for id and message.
     $this->postComment($this->node, $body, $subject, TRUE);
-    $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+    $this->assertSession()->responseContains(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
     // Get unapproved comment id.
     $this->drupalLogin($this->adminUser);
@@ -83,13 +83,13 @@ public function testApprovalAdminInterface() {
     // Publish multiple comments in one operation.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/content/comment/approval');
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
+    $this->assertSession()->responseContains(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
     $edit = [
       "comments[{$comments[0]->id()}]" => 1,
       "comments[{$comments[1]->id()}]" => 1,
     ];
     $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
+    $this->assertSession()->responseContains(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
 
     // Delete multiple comments in one operation.
     $edit = [
@@ -99,24 +99,24 @@ public function testApprovalAdminInterface() {
       "comments[{$anonymous_comment4->id()}]" => 1,
     ];
     $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
+    $this->assertSession()->responseContains(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
     $this->drupalPostForm(NULL, [], t('Delete'));
-    $this->assertText(t('No comments available.'), 'All comments were deleted.');
+    $this->assertSession()->responseContains(t('No comments available.'), 'All comments were deleted.');
     // Test message when no comments selected.
     $edit = [
       'operation' => 'delete',
     ];
     $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('Select one or more comments to perform the update on.'));
+    $this->assertSession()->responseContains(t('Select one or more comments to perform the update on.'));
 
     // Make sure the label of unpublished node is not visible on listing page.
     $this->drupalGet('admin/content/comment');
     $this->postComment($this->node, $this->randomMachineName());
     $this->drupalGet('admin/content/comment');
-    $this->assertText(Html::escape($this->node->label()));
+    $this->assertSession()->responseContains(Html::escape($this->node->label()));
     $this->node->setUnpublished()->save();
     $this->drupalGet('admin/content/comment');
-    $this->assertNoText(Html::escape($this->node->label()));
+    $this->assertSession()->responseNotContains(Html::escape($this->node->label()));
   }
 
   /**
@@ -139,7 +139,7 @@ public function testApprovalNodeInterface() {
     $body = $this->randomMachineName();
     // Set $contact to true so that it won't check for id and message.
     $this->postComment($this->node, $body, $subject, TRUE);
-    $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+    $this->assertSession()->responseContains(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
     // Get unapproved comment id.
     $this->drupalLogin($this->adminUser);
@@ -184,15 +184,15 @@ public function testCommentAdmin() {
     $this->drupalGet('admin/structure/comment');
     $this->assertSession()->statusCodeEquals(200);
     // Make sure titles visible.
-    $this->assertText('Comment type');
-    $this->assertText('Description');
+    $this->assertSession()->responseContains('Comment type');
+    $this->assertSession()->responseContains('Description');
     // Make sure the description is present.
-    $this->assertText('Default comment field');
+    $this->assertSession()->responseContains('Default comment field');
     // Manage fields.
     $this->clickLink('Manage fields');
     $this->assertSession()->statusCodeEquals(200);
     // Make sure comment_body field is shown.
-    $this->assertText('comment_body');
+    $this->assertSession()->responseContains('comment_body');
     // Rest from here on in is field_ui.
   }
 
@@ -279,8 +279,8 @@ public function testCommentedTranslationDeletion() {
     $this->drupalPostForm('admin/content/comment', $edit, t('Update'));
     $this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment1->label()]));
     $this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment2->label()]));
-    $this->assertText('English');
-    $this->assertText('Urdu');
+    $this->assertSession()->responseContains('English');
+    $this->assertSession()->responseContains('Urdu');
     $this->drupalPostForm(NULL, [], t('Delete'));
     $after_count = $count_query->execute();
     $this->assertEqual($after_count, $before_count, 'No comment or translation found.');
diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
index cc6c466252..5bce28da17 100644
--- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
@@ -125,7 +125,7 @@ public function testAnonymous() {
 
     $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     // Name should have 'Anonymous' for value by default.
-    $this->assertText(t('Email field is required.'), 'Email required.');
+    $this->assertSession()->responseContains(t('Email field is required.'), 'Email required.');
     $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
 
     // Post comment with contact info (required).
diff --git a/core/modules/comment/tests/src/Functional/CommentBlockTest.php b/core/modules/comment/tests/src/Functional/CommentBlockTest.php
index 2a3ff3e6a8..ed91d1ea38 100644
--- a/core/modules/comment/tests/src/Functional/CommentBlockTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentBlockTest.php
@@ -61,19 +61,19 @@ public function testRecentCommentBlock() {
     $this->drupalLogout();
     user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
     $this->drupalGet('');
-    $this->assertNoText(t('Recent comments'));
+    $this->assertSession()->responseNotContains(t('Recent comments'));
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
 
     // Test that a user with the 'access comments' permission can see the
     // block.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('');
-    $this->assertText(t('Recent comments'));
+    $this->assertSession()->responseContains(t('Recent comments'));
 
     // Test the only the 10 latest comments are shown and in the proper order.
-    $this->assertNoText($comments[10]->getSubject(), 'Comment 11 not found in block.');
+    $this->assertSession()->responseNotContains($comments[10]->getSubject(), 'Comment 11 not found in block.');
     for ($i = 0; $i < 10; $i++) {
-      $this->assertText($comments[$i]->getSubject(), new FormattableMarkup('Comment @number found in block.', ['@number' => 10 - $i]));
+      $this->assertSession()->responseContains($comments[$i]->getSubject(), new FormattableMarkup('Comment @number found in block.', ['@number' => 10 - $i]));
       if ($i > 1) {
         $previous_position = $position;
         $position = strpos($this->getSession()->getPage()->getContent(), $comments[$i]->getSubject());
@@ -87,7 +87,7 @@ public function testRecentCommentBlock() {
 
     for ($i = 0; $i < 10; $i++) {
       $this->clickLink($comments[$i]->getSubject());
-      $this->assertText($comments[$i]->getSubject(), 'Comment link goes to correct page.');
+      $this->assertSession()->responseContains($comments[$i]->getSubject(), 'Comment link goes to correct page.');
       $this->assertRaw('<link rel="canonical"', 'Canonical URL was found in the HTML head');
     }
   }
diff --git a/core/modules/comment/tests/src/Functional/CommentBookTest.php b/core/modules/comment/tests/src/Functional/CommentBookTest.php
index 0cc97faf6e..11a4d2a51b 100644
--- a/core/modules/comment/tests/src/Functional/CommentBookTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentBookTest.php
@@ -65,18 +65,18 @@ public function testBookCommentPrint() {
 
     $this->drupalGet('node/' . $book_node->id());
 
-    $this->assertText($comment_subject, 'Comment subject found');
-    $this->assertText($comment_body, 'Comment body found');
-    $this->assertText(t('Add new comment'), 'Comment form found');
+    $this->assertSession()->responseContains($comment_subject, 'Comment subject found');
+    $this->assertSession()->responseContains($comment_body, 'Comment body found');
+    $this->assertSession()->responseContains(t('Add new comment'), 'Comment form found');
     $this->assertField('subject[0][value]', 'Comment form subject found');
 
     $this->drupalGet('book/export/html/' . $book_node->id());
 
-    $this->assertText(t('Comments'), 'Comment thread found');
-    $this->assertText($comment_subject, 'Comment subject found');
-    $this->assertText($comment_body, 'Comment body found');
+    $this->assertSession()->responseContains(t('Comments'), 'Comment thread found');
+    $this->assertSession()->responseContains($comment_subject, 'Comment subject found');
+    $this->assertSession()->responseContains($comment_body, 'Comment body found');
 
-    $this->assertNoText(t('Add new comment'), 'Comment form not found');
+    $this->assertSession()->responseNotContains(t('Add new comment'), 'Comment form not found');
     $this->assertNoField('subject[0][value]', 'Comment form subject not found');
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php b/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
index 5277a317c0..95bd247502 100644
--- a/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentCacheTagsTest.php
@@ -128,7 +128,7 @@ public function testCommentEntity() {
     // Ensure that a new comment only invalidates the commented entity.
     $this->verifyPageCache($this->entityTestCamelid->toUrl(), 'HIT');
     $this->verifyPageCache($this->entityTestHippopotamidae->toUrl(), 'MISS');
-    $this->assertText($hippo_comment->getSubject());
+    $this->assertSession()->responseContains($hippo_comment->getSubject());
 
     // Ensure that updating an existing comment only invalidates the commented
     // entity.
diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
index e5a3fe9d80..213c8918f7 100644
--- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
@@ -166,7 +166,7 @@ public function testCommentFieldCreate() {
     $edit = [];
     $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings'));
     // We should get an error message.
-    $this->assertText(t('An illegal choice has been detected. Please contact the site administrator.'));
+    $this->assertSession()->responseContains(t('An illegal choice has been detected. Please contact the site administrator.'));
 
     // Create a comment type for users.
     $bundle = CommentType::create([
@@ -183,7 +183,7 @@ public function testCommentFieldCreate() {
     ];
     $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings'));
     // We shouldn't get an error message.
-    $this->assertNoText(t('An illegal choice has been detected. Please contact the site administrator.'));
+    $this->assertSession()->responseNotContains(t('An illegal choice has been detected. Please contact the site administrator.'));
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
index 5f9ceffbcd..3db56cfc68 100644
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
@@ -81,8 +81,8 @@ public function testCommentInterface() {
     // Check comment display.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($subject_text, 'Individual comment subject found.');
-    $this->assertText($comment_text, 'Individual comment body found.');
+    $this->assertSession()->responseContains($subject_text, 'Individual comment subject found.');
+    $this->assertSession()->responseContains($comment_text, 'Individual comment body found.');
     $arguments = [
       ':link' => base_path() . 'comment/' . $comment->id() . '#comment-' . $comment->id(),
     ];
@@ -110,7 +110,7 @@ public function testCommentInterface() {
     $this->drupalGet('comment/' . $comment->id() . '/edit');
     $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['name' => $random_name]);
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($random_name . ' (' . t('not verified') . ')', 'Comment author successfully changed to an unverified user.');
+    $this->assertSession()->responseContains($random_name . ' (' . t('not verified') . ')', 'Comment author successfully changed to an unverified user.');
 
     // Test changing the comment author to a verified user.
     $this->drupalGet('comment/' . $comment->id() . '/edit');
@@ -128,8 +128,8 @@ public function testCommentInterface() {
     // Verify we were correctly redirected.
     $this->assertUrl(Url::fromRoute('comment.reply', ['entity_type' => 'node', 'entity' => $this->node->id(), 'field_name' => 'comment'], ['absolute' => TRUE])->toString());
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
-    $this->assertText($subject_text, 'Individual comment-reply subject found.');
-    $this->assertText($comment_text, 'Individual comment-reply body found.');
+    $this->assertSession()->responseContains($subject_text, 'Individual comment-reply subject found.');
+    $this->assertSession()->responseContains($comment_text, 'Individual comment-reply body found.');
     $reply = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
     $reply_loaded = Comment::load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
@@ -139,8 +139,8 @@ public function testCommentInterface() {
 
     // Second reply to comment #2 creating comment #4.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
-    $this->assertText($comment->getSubject(), 'Individual comment-reply subject found.');
-    $this->assertText($comment->comment_body->value, 'Individual comment-reply body found.');
+    $this->assertSession()->responseContains($comment->getSubject(), 'Individual comment-reply subject found.');
+    $this->assertSession()->responseContains($comment->comment_body->value, 'Individual comment-reply body found.');
     $reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $reply_loaded = Comment::load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
@@ -149,8 +149,8 @@ public function testCommentInterface() {
 
     // Reply to comment #4 creating comment #5.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $reply_loaded->id());
-    $this->assertText($reply_loaded->getSubject(), 'Individual comment-reply subject found.');
-    $this->assertText($reply_loaded->comment_body->value, 'Individual comment-reply body found.');
+    $this->assertSession()->responseContains($reply_loaded->getSubject(), 'Individual comment-reply subject found.');
+    $this->assertSession()->responseContains($reply_loaded->comment_body->value, 'Individual comment-reply body found.');
     $reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $reply_loaded = Comment::load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
@@ -194,7 +194,7 @@ public function testCommentInterface() {
     $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->assertSession()->responseNotContains('This discussion is closed', 'Posting to node with comments enabled');
     $this->assertField('edit-comment-body-0-value', 'Comment body field found.');
 
     // Delete comment and make sure that reply is also removed.
diff --git a/core/modules/comment/tests/src/Functional/CommentLinksTest.php b/core/modules/comment/tests/src/Functional/CommentLinksTest.php
index 9e47de4e69..e311979ae3 100644
--- a/core/modules/comment/tests/src/Functional/CommentLinksTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentLinksTest.php
@@ -138,7 +138,7 @@ public function testCommentLinks() {
 
     // Visit the full node, make sure there are links for the comment.
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($comment->getSubject());
+    $this->assertSession()->responseContains($comment->getSubject());
     $this->assertLink('Reply');
 
     // Make sure we can hide comment links.
@@ -146,7 +146,7 @@ public function testCommentLinks() {
       ->removeComponent('links')
       ->save();
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($comment->getSubject());
+    $this->assertSession()->responseContains($comment->getSubject());
     $this->assertNoLink('Reply');
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentNodeAccessTest.php b/core/modules/comment/tests/src/Functional/CommentNodeAccessTest.php
index 3ad58a7093..1636184640 100644
--- a/core/modules/comment/tests/src/Functional/CommentNodeAccessTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNodeAccessTest.php
@@ -66,8 +66,8 @@ public function testThreadedCommentView() {
 
     // Check comment display.
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($comment_subject, 'Individual comment subject found.');
-    $this->assertText($comment_text, 'Individual comment body found.');
+    $this->assertSession()->responseContains($comment_subject, 'Individual comment subject found.');
+    $this->assertSession()->responseContains($comment_text, 'Individual comment body found.');
 
     // Reply to comment, creating second comment.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
@@ -78,10 +78,10 @@ public function testThreadedCommentView() {
 
     // Go to the node page and verify comment and reply are visible.
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($comment_text);
-    $this->assertText($comment_subject);
-    $this->assertText($reply_text);
-    $this->assertText($reply_subject);
+    $this->assertSession()->responseContains($comment_text);
+    $this->assertSession()->responseContains($comment_subject);
+    $this->assertSession()->responseContains($reply_text);
+    $this->assertSession()->responseContains($reply_subject);
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
index d6233ca35e..5174d59864 100644
--- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
@@ -173,9 +173,9 @@ public function postComment(EntityInterface $entity, $comment, $subject = '', $c
     if ($contact !== TRUE) {
       // If true then attempting to find error message.
       if ($subject) {
-        $this->assertText($subject, 'Comment subject posted.');
+        $this->assertSession()->responseContains($subject, 'Comment subject posted.');
       }
-      $this->assertText($comment, 'Comment body posted.');
+      $this->assertSession()->responseContains($comment, 'Comment body posted.');
       $this->assertTrue((!empty($match) && !empty($match[1])), 'Comment ID found.');
     }
 
@@ -241,7 +241,7 @@ public function performCommentOperation($comment, $operation, $approval = FALSE)
       $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
     else {
-      $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
+      $this->assertSession()->responseContains(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
   }
 
@@ -271,7 +271,7 @@ public function testCommentFunctionality() {
     $this->drupalLogin($limited_user);
     // Test that default field exists.
     $this->drupalGet('entity_test/structure/entity_test/fields');
-    $this->assertText(t('Comments'));
+    $this->assertSession()->responseContains(t('Comments'));
     $this->assertLinkByHref('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
     // Test widget hidden option is not visible when there's no comments.
     $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
@@ -334,13 +334,13 @@ public function testCommentFunctionality() {
     $this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was published.');
 
     // Check that entity access applies to administrative page.
-    $this->assertText($this->entity->label(), 'Name of commented account found.');
+    $this->assertSession()->responseContains($this->entity->label(), 'Name of commented account found.');
     $limited_user = $this->drupalCreateUser([
       'administer comments',
     ]);
     $this->drupalLogin($limited_user);
     $this->drupalGet('admin/content/comment');
-    $this->assertNoText($this->entity->label(), 'No commented account name found.');
+    $this->assertSession()->responseNotContains($this->entity->label(), 'No commented account name found.');
 
     $this->drupalLogout();
 
@@ -392,7 +392,7 @@ public function testCommentFunctionality() {
 
     $this->drupalGet('comment/reply/entity_test/' . $this->entity->id() . '/comment/' . $comment1->id());
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertNoText($comment1->getSubject(), 'Comment not displayed.');
+    $this->assertSession()->responseNotContains($comment1->getSubject(), 'Comment not displayed.');
 
     // Test comment field widget changes.
     $limited_user = $this->drupalCreateUser([
diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php
index 25da658ad6..61f75ac20a 100644
--- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php
@@ -343,16 +343,16 @@ public function testTwoPagers() {
     $account = $this->drupalCreateUser(['administer node display']);
     $this->drupalLogin($account);
     $this->drupalGet('admin/structure/types/manage/article/display');
-    $this->assertNoText(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
-    $this->assertText(t('Pager ID: @id', ['@id' => 1]));
+    $this->assertSession()->responseNotContains(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
+    $this->assertSession()->responseContains(t('Pager ID: @id', ['@id' => 1]));
     $this->drupalPostForm(NULL, [], 'comment_settings_edit');
     // Change default pager to 2.
     $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 2], t('Save'));
-    $this->assertText(t('Pager ID: @id', ['@id' => 2]));
+    $this->assertSession()->responseContains(t('Pager ID: @id', ['@id' => 2]));
     // Revert the changes.
     $this->drupalPostForm(NULL, [], 'comment_settings_edit');
     $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 0], t('Save'));
-    $this->assertNoText(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
+    $this->assertSession()->responseNotContains(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
 
     $this->drupalLogin($this->adminUser);
 
diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
index 2d2073b115..5475f7594b 100644
--- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
@@ -68,8 +68,8 @@ public function testCommentPreview() {
 
     // Check that the preview is displaying the title and body.
     $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
-    $this->assertText($edit['subject[0][value]'], 'Subject displayed.');
-    $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
+    $this->assertSession()->responseContains($edit['subject[0][value]'], 'Subject displayed.');
+    $this->assertSession()->responseContains($edit['comment_body[0][value]'], 'Comment displayed.');
 
     // Check that the title and body fields are displayed with the correct values.
     $this->assertFieldByName('subject[0][value]', $edit['subject[0][value]'], 'Subject field displayed.');
@@ -102,8 +102,8 @@ public function testCommentPreviewDuplicateSubmission() {
 
     // Check that the preview is displaying the title and body.
     $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
-    $this->assertText($edit['subject[0][value]'], 'Subject displayed.');
-    $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
+    $this->assertSession()->responseContains($edit['subject[0][value]'], 'Subject displayed.');
+    $this->assertSession()->responseContains($edit['comment_body[0][value]'], 'Comment displayed.');
 
     // Check that the title and body fields are displayed with the correct values.
     $this->assertFieldByName('subject[0][value]', $edit['subject[0][value]'], 'Subject field displayed.');
@@ -111,7 +111,7 @@ public function testCommentPreviewDuplicateSubmission() {
 
     // Store the content of this page.
     $this->drupalPostForm(NULL, [], 'Save');
-    $this->assertText('Your comment has been posted.');
+    $this->assertSession()->responseContains('Your comment has been posted.');
     $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
     $this->assertCount(1, $elements);
 
@@ -119,7 +119,7 @@ public function testCommentPreviewDuplicateSubmission() {
     $this->getSession()->getDriver()->back();
     $submit_button = $this->assertSession()->buttonExists('Save');
     $submit_button->click();
-    $this->assertText('Your comment has been posted.');
+    $this->assertSession()->responseContains('Your comment has been posted.');
     $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
     $this->assertCount(2, $elements);
   }
@@ -151,10 +151,10 @@ public function testCommentEditPreviewSave() {
 
     // Check that the preview is displaying the subject, comment, author and date correctly.
     $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
-    $this->assertText($edit['subject[0][value]'], 'Subject displayed.');
-    $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
-    $this->assertText($web_user->getAccountName(), 'Author displayed.');
-    $this->assertText($expected_text_date, 'Date displayed.');
+    $this->assertSession()->responseContains($edit['subject[0][value]'], 'Subject displayed.');
+    $this->assertSession()->responseContains($edit['comment_body[0][value]'], 'Comment displayed.');
+    $this->assertSession()->responseContains($web_user->getAccountName(), 'Author displayed.');
+    $this->assertSession()->responseContains($expected_text_date, 'Date displayed.');
 
     // Check that the subject, comment, author and date fields are displayed with the correct values.
     $this->assertFieldByName('subject[0][value]', $edit['subject[0][value]'], 'Subject field displayed.');
@@ -165,7 +165,7 @@ public function testCommentEditPreviewSave() {
 
     // Check that saving a comment produces a success message.
     $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Save'));
-    $this->assertText(t('Your comment has been posted.'), 'Comment posted.');
+    $this->assertSession()->responseContains(t('Your comment has been posted.'), 'Comment posted.');
 
     // Check that the comment fields are correct after loading the saved comment.
     $this->drupalGet('comment/' . $comment->id() . '/edit');
diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php
index abdae813e0..43bfaa7ab7 100644
--- a/core/modules/comment/tests/src/Functional/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php
@@ -172,9 +172,9 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
     if ($contact !== TRUE) {
       // If true then attempting to find error message.
       if ($subject) {
-        $this->assertText($subject, 'Comment subject posted.');
+        $this->assertSession()->responseContains($subject, 'Comment subject posted.');
       }
-      $this->assertText($comment, 'Comment body posted.');
+      $this->assertSession()->responseContains($comment, 'Comment body posted.');
       $this->assertTrue((!empty($match) && !empty($match[1])), 'Comment id found.');
     }
 
@@ -227,7 +227,7 @@ public function commentExists(CommentInterface $comment = NULL, $reply = FALSE)
    */
   public function deleteComment(CommentInterface $comment) {
     $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], t('Delete'));
-    $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
+    $this->assertSession()->responseContains(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
   }
 
   /**
@@ -367,7 +367,7 @@ public function performCommentOperation(CommentInterface $comment, $operation, $
       $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
     else {
-      $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
+      $this->assertSession()->responseContains(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
index d13b9c6296..59a72c99e1 100644
--- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
@@ -86,7 +86,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->assertText(t('Target entity type'));
+    $this->assertSession()->responseContains(t('Target entity type'));
     // Save the form and ensure the entity-type value is preserved even though
     // the field isn't present.
     $this->drupalPostForm(NULL, [], t('Save'));
@@ -167,7 +167,7 @@ public function testCommentTypeDeletion() {
       ]),
       'The comment type will not be deleted until all fields of that type are removed.'
     );
-    $this->assertNoText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is not available.');
+    $this->assertSession()->responseNotContains(t('This action cannot be undone.'), 'The comment type deletion confirmation form is not available.');
 
     // Delete the comment and the field.
     $comment->delete();
@@ -178,7 +178,7 @@ public function testCommentTypeDeletion() {
       t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]),
       'The comment type is available for deletion.'
     );
-    $this->assertText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.');
+    $this->assertSession()->responseContains(t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.');
 
     // Test exception thrown when re-using an existing comment type.
     try {
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
index 84d0abafb2..4a82e014ee 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
@@ -53,7 +53,7 @@ public function testApprovalAdminInterface() {
 
     // Test that the comments page loads correctly when there are no comments.
     $this->drupalGet('admin/content/comment');
-    $this->assertText(t('No comments available.'));
+    $this->assertSession()->responseContains(t('No comments available.'));
 
     // Assert the expose filters on the admin page.
     $this->assertField('subject');
@@ -70,7 +70,7 @@ public function testApprovalAdminInterface() {
       'name' => $author_name,
       'comment_body[0][value]' => $body,
     ], t('Save'));
-    $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+    $this->assertSession()->responseContains(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
     // Get unapproved comment id.
     $this->drupalLogin($this->adminUser);
@@ -94,7 +94,7 @@ public function testApprovalAdminInterface() {
     $edit['comment_bulk_form[0]'] = $anonymous_comment4->id();
     $this->drupalPostForm('admin/content/comment/approval', $edit, t('Apply to selected items'));
 
-    $this->assertText('Publish comment was applied to 1 item.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => 'publish']));
+    $this->assertSession()->responseContains('Publish comment was applied to 1 item.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => 'publish']));
     $this->drupalLogout();
 
     $this->drupalGet('node/' . $this->node->id());
@@ -107,7 +107,7 @@ public function testApprovalAdminInterface() {
     // Publish multiple comments in one operation.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/content/comment/approval');
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
+    $this->assertSession()->responseContains(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
 
     // Assert the expose filters on the admin page.
     $this->assertField('subject');
@@ -120,11 +120,11 @@ public function testApprovalAdminInterface() {
       "comment_bulk_form[0]" => $comments[1]->id(),
     ];
     $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
+    $this->assertSession()->responseContains(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
 
     // Test message when no comments selected.
     $this->drupalPostForm('admin/content/comment', [], t('Apply to selected items'));
-    $this->assertText(t('Select one or more comments to perform the update on.'));
+    $this->assertSession()->responseContains(t('Select one or more comments to perform the update on.'));
 
     $subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [
       ':href' => $comments[0]->permalink()->toString(),
@@ -132,7 +132,7 @@ public function testApprovalAdminInterface() {
       ':text' => $comments[0]->getSubject(),
     ]);
     $this->assertTrue(!empty($subject_link), 'Comment listing shows the correct subject link.');
-    $this->assertText($author_name . ' (not verified)', 'Anonymous author name is displayed correctly.');
+    $this->assertSession()->responseContains($author_name . ' (not verified)', 'Anonymous author name is displayed correctly.');
 
     $subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [
       ':href' => $anonymous_comment4->permalink()->toString(),
@@ -140,7 +140,7 @@ public function testApprovalAdminInterface() {
       ':text' => $subject,
     ]);
     $this->assertTrue(!empty($subject_link), 'Comment listing shows the correct subject link.');
-    $this->assertText($author_name . ' (not verified)', 'Anonymous author name is displayed correctly.');
+    $this->assertSession()->responseContains($author_name . ' (not verified)', 'Anonymous author name is displayed correctly.');
 
     // Delete multiple comments in one operation.
     $edit = [
@@ -150,9 +150,9 @@ public function testApprovalAdminInterface() {
       "comment_bulk_form[2]" => $anonymous_comment4->id(),
     ];
     $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
-    $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
+    $this->assertSession()->responseContains(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
     $this->drupalPostForm(NULL, [], t('Delete'));
-    $this->assertText(t('No comments available.'), 'All comments were deleted.');
+    $this->assertSession()->responseContains(t('No comments available.'), 'All comments were deleted.');
 
     // Make sure the label of unpublished node is not visible on listing page.
     $this->drupalGet('admin/content/comment');
@@ -160,11 +160,11 @@ public function testApprovalAdminInterface() {
     $this->drupalLogout();
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/content/comment');
-    $this->assertText(Html::escape($this->node->label()), 'Comment admin can see the title of a published node');
+    $this->assertSession()->responseContains(Html::escape($this->node->label()), 'Comment admin can see the title of a published node');
     $this->node->setUnpublished()->save();
     $this->assertFalse($this->node->isPublished(), 'Node is unpublished now.');
     $this->drupalGet('admin/content/comment');
-    $this->assertNoText(Html::escape($this->node->label()), 'Comment admin cannot see the title of an unpublished node');
+    $this->assertSession()->responseNotContains(Html::escape($this->node->label()), 'Comment admin cannot see the title of an unpublished node');
     $this->drupalLogout();
     $node_access_user = $this->drupalCreateUser([
       'administer comments',
@@ -172,7 +172,7 @@ public function testApprovalAdminInterface() {
     ]);
     $this->drupalLogin($node_access_user);
     $this->drupalGet('admin/content/comment');
-    $this->assertText(Html::escape($this->node->label()), 'Comment admin with bypass node access permissions can still see the title of a published node');
+    $this->assertSession()->responseContains(Html::escape($this->node->label()), 'Comment admin with bypass node access permissions can still see the title of a published node');
   }
 
   /**
@@ -217,11 +217,11 @@ public function testCommentedEntityLabel() {
     ]);
     $this->assertTrue(!empty($comment_author_link), 'Comment listing links to comment author.');
     // Admin page contains label of both entities.
-    $this->assertText(Html::escape($this->node->label()), 'Node title is visible.');
-    $this->assertText(Html::escape($block_content->label()), 'Block content label is visible.');
+    $this->assertSession()->responseContains(Html::escape($this->node->label()), 'Node title is visible.');
+    $this->assertSession()->responseContains(Html::escape($block_content->label()), 'Block content label is visible.');
     // Admin page contains subject of both entities.
-    $this->assertText(Html::escape($node_comment->label()), 'Node comment is visible.');
-    $this->assertText(Html::escape($block_content_comment->label()), 'Block content comment is visible.');
+    $this->assertSession()->responseContains(Html::escape($node_comment->label()), 'Node comment is visible.');
+    $this->assertSession()->responseContains(Html::escape($block_content_comment->label()), 'Block content comment is visible.');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php b/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
index fb5f736a87..4f281b118c 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
@@ -24,14 +24,14 @@ public function testCommentEdit() {
     // Post a comment to node.
     $node_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $this->drupalGet('admin/content/comment');
-    $this->assertText($this->adminUser->label());
+    $this->assertSession()->responseContains($this->adminUser->label());
     $this->drupalGet($node_comment->toUrl('edit-form'));
     $edit = [
       'comment_body[0][value]' => $this->randomMachineName(),
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->drupalGet('admin/content/comment');
-    $this->assertText($this->adminUser->label());
+    $this->assertSession()->responseContains($this->adminUser->label());
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php b/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php
index d2de8bb43b..c3aa6b0252 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php
@@ -70,8 +70,8 @@ public function testCommentRestExport() {
 
     // Ensure field-level access is respected - user shouldn't be able to see
     // mail or hostname fields.
-    $this->assertNoText('someone@example.com');
-    $this->assertNoText('public.example.com');
+    $this->assertSession()->responseNotContains('someone@example.com');
+    $this->assertSession()->responseNotContains('public.example.com');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
index 4431bb6e67..ff683249e5 100644
--- a/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
+++ b/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
@@ -165,8 +165,8 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(2, $elements, 'There are two comments on the page.');
-    $this->assertText($comment->label());
-    $this->assertText($comment_anonymous->label());
+    $this->assertSession()->responseContains($comment->label());
+    $this->assertSession()->responseContains($comment_anonymous->label());
     $executable->destroy();
 
     // Test the Subject filter.
@@ -177,8 +177,8 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(1, $elements, 'Only anonymous comment is visible.');
-    $this->assertNoText($comment->label());
-    $this->assertText($comment_anonymous->label());
+    $this->assertSession()->responseNotContains($comment->label());
+    $this->assertSession()->responseContains($comment_anonymous->label());
     $executable->destroy();
 
     $executable->setExposedInput(['subject' => 'My comment']);
@@ -188,8 +188,8 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(1, $elements, 'Only admin comment is visible.');
-    $this->assertText($comment->label());
-    $this->assertNoText($comment_anonymous->label());
+    $this->assertSession()->responseContains($comment->label());
+    $this->assertSession()->responseNotContains($comment_anonymous->label());
     $executable->destroy();
 
     // Test the combine filter using author name.
@@ -200,8 +200,8 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(1, $elements, 'Only anonymous comment is visible.');
-    $this->assertNoText($comment->label());
-    $this->assertText($comment_anonymous->label());
+    $this->assertSession()->responseNotContains($comment->label());
+    $this->assertSession()->responseContains($comment_anonymous->label());
     $executable->destroy();
 
     // Test the combine filter using username.
@@ -212,8 +212,8 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(1, $elements, 'Only admin comment is visible.');
-    $this->assertText($comment->label());
-    $this->assertNoText($comment_anonymous->label());
+    $this->assertSession()->responseContains($comment->label());
+    $this->assertSession()->responseNotContains($comment_anonymous->label());
     $executable->destroy();
 
     // Test the language filter.
@@ -224,8 +224,8 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(2, $elements, 'Both comments are visible.');
-    $this->assertText($comment->label());
-    $this->assertText($comment_anonymous->label());
+    $this->assertSession()->responseContains($comment->label());
+    $this->assertSession()->responseContains($comment_anonymous->label());
     $executable->destroy();
 
     // Tests comment translation filter.
@@ -259,10 +259,10 @@ protected function doTestFilters($display_id) {
 
     $elements = $this->cssSelect('input[type="checkbox"]');
     $this->assertCount(2, $elements, 'Both comments are visible.');
-    $this->assertNoText($comment->label());
-    $this->assertNoText($comment_anonymous->label());
-    $this->assertText($comment_translation->label());
-    $this->assertText($comment_anonymous_translation->label());
+    $this->assertSession()->responseNotContains($comment->label());
+    $this->assertSession()->responseNotContains($comment_anonymous->label());
+    $this->assertSession()->responseContains($comment_translation->label());
+    $this->assertSession()->responseContains($comment_anonymous_translation->label());
     $executable->destroy();
   }
 
diff --git a/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php b/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php
index 0b0fb9e968..9df601d4ce 100644
--- a/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php
+++ b/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php
@@ -48,7 +48,7 @@ public function testConfigOverride() {
     // Check the default (disabled) state of the cache context. The block label
     // should not be overridden.
     $this->drupalGet('<front>');
-    $this->assertNoText('Overridden block label');
+    $this->assertSession()->responseNotContains('Overridden block label');
 
     // Both the cache context and tag should be present.
     $this->assertCacheContext('config_override_integration_test');
@@ -58,7 +58,7 @@ public function testConfigOverride() {
     // overridden.
     \Drupal::state()->set('config_override_integration_test.enabled', TRUE);
     $this->drupalGet('<front>');
-    $this->assertText('Overridden block label');
+    $this->assertSession()->responseContains('Overridden block label');
 
     // Both the cache context and tag should still be present.
     $this->assertCacheContext('config_override_integration_test');
diff --git a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php
index c9ea2a67eb..2bf12a9112 100644
--- a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php
@@ -64,12 +64,12 @@ public function testConfigDependencyDeleteFormTrait() {
     $entity2->save();
 
     $this->drupalGet($entity2->toUrl('delete-form'));
-    $this->assertNoText(t('Configuration updates'), 'No configuration updates found.');
-    $this->assertNoText(t('Configuration deletions'), 'No configuration deletes found.');
+    $this->assertSession()->responseNotContains(t('Configuration updates'), 'No configuration updates found.');
+    $this->assertSession()->responseNotContains(t('Configuration deletions'), 'No configuration deletes found.');
     $this->drupalGet($entity1->toUrl('delete-form'));
-    $this->assertNoText(t('Configuration updates'), 'No configuration updates found.');
-    $this->assertText(t('Configuration deletions'), 'Configuration deletions found.');
-    $this->assertText($entity2->id(), 'Entity2 id found');
+    $this->assertSession()->responseNotContains(t('Configuration updates'), 'No configuration updates found.');
+    $this->assertSession()->responseContains(t('Configuration deletions'), 'Configuration deletions found.');
+    $this->assertSession()->responseContains($entity2->id(), 'Entity2 id found');
     $this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
     $storage->resetCache();
     $this->assertEmpty($storage->loadMultiple([$entity1->id(), $entity2->id()]), 'Test entities deleted');
@@ -115,11 +115,11 @@ public function testConfigDependencyDeleteFormTrait() {
     $entity3->save();
 
     $this->drupalGet($entity1->toUrl('delete-form'));
-    $this->assertText(t('Configuration updates'), 'Configuration updates found.');
-    $this->assertNoText(t('Configuration deletions'), 'No configuration deletions found.');
-    $this->assertNoText($entity2->id(), 'Entity2 id not found');
-    $this->assertText($entity2->label(), 'Entity2 label not found');
-    $this->assertNoText($entity3->id(), 'Entity3 id not found');
+    $this->assertSession()->responseContains(t('Configuration updates'), 'Configuration updates found.');
+    $this->assertSession()->responseNotContains(t('Configuration deletions'), 'No configuration deletions found.');
+    $this->assertSession()->responseNotContains($entity2->id(), 'Entity2 id not found');
+    $this->assertSession()->responseContains($entity2->label(), 'Entity2 label not found');
+    $this->assertSession()->responseNotContains($entity3->id(), 'Entity3 id not found');
     $this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
     $storage->resetCache();
     $this->assertNull($storage->load('entity1'), 'Test entity 1 deleted');
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php
index ae30d0a120..3b9888f381 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php
@@ -45,14 +45,14 @@ public function testFormsWithOverrides() {
 
     // Test that the original label on the listing page is intact.
     $this->drupalGet('admin/structure/config_test');
-    $this->assertText($original_label);
-    $this->assertNoText($overridden_label);
+    $this->assertSession()->responseContains($original_label);
+    $this->assertSession()->responseNotContains($overridden_label);
 
     // Test that the original label on the editing page is intact.
     $this->drupalGet('admin/structure/config_test/manage/dotted.default');
     $elements = $this->xpath('//input[@name="label"]');
     $this->assertIdentical($elements[0]->getValue(), $original_label);
-    $this->assertNoText($overridden_label);
+    $this->assertSession()->responseNotContains($overridden_label);
 
     // Change to a new label and test that the listing now has the edited label.
     $edit = [
@@ -60,8 +60,8 @@ public function testFormsWithOverrides() {
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->drupalGet('admin/structure/config_test');
-    $this->assertNoText($overridden_label);
-    $this->assertText($edited_label);
+    $this->assertSession()->responseNotContains($overridden_label);
+    $this->assertSession()->responseContains($edited_label);
 
     // Test that the editing page now has the edited label.
     $this->drupalGet('admin/structure/config_test/manage/dotted.default');
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
index 1835e1d897..c26377f0d4 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
@@ -247,7 +247,7 @@ public function testListUI() {
     $this->assertNoFieldByXpath('//td', 'dotted.default', "No machine name found for deleted 'Default' entity.");
 
     // Confirm that the empty text is displayed.
-    $this->assertText('There are no test configuration entities yet.');
+    $this->assertSession()->responseContains('There are no test configuration entities yet.');
   }
 
   /**
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityTest.php b/core/modules/config/tests/src/Functional/ConfigEntityTest.php
index 30dd0cf231..3bd2ec129c 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityTest.php
@@ -279,7 +279,7 @@ public function testCRUDUI() {
     $this->assertSession()->statusCodeEquals(200);
     $this->assertNoRaw($message_update);
     $this->assertRaw($message_delete);
-    $this->assertNoText($label1);
+    $this->assertSession()->responseNotContains($label1);
     $this->assertNoLinkByHref("admin/structure/config_test/manage/$id");
 
     // Re-create a configuration entity.
@@ -290,7 +290,7 @@ public function testCRUDUI() {
     $this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
     $this->assertUrl('admin/structure/config_test');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($label1);
+    $this->assertSession()->responseContains($label1);
     $this->assertLinkByHref("admin/structure/config_test/manage/$id");
 
     // Rename the configuration entity's ID/machine name.
@@ -301,9 +301,9 @@ public function testCRUDUI() {
     $this->drupalPostForm("admin/structure/config_test/manage/$id", $edit, 'Save');
     $this->assertUrl('admin/structure/config_test');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText($label1);
-    $this->assertNoText($label2);
-    $this->assertText($label3);
+    $this->assertSession()->responseNotContains($label1);
+    $this->assertSession()->responseNotContains($label2);
+    $this->assertSession()->responseContains($label3);
     $this->assertNoLinkByHref("admin/structure/config_test/manage/$id");
     $id = $edit['id'];
     $this->assertLinkByHref("admin/structure/config_test/manage/$id");
diff --git a/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php
index 446563abc8..0c0ea28bb6 100644
--- a/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php
+++ b/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php
@@ -91,8 +91,8 @@ protected function setUp(): void {
   public function testExportImport() {
     // After installation there is no snapshot and nothing to import.
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText(t('Warning message'));
-    $this->assertText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(t('Warning message'));
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
 
     $this->originalSlogan = $this->config('system.site')->get('slogan');
     $this->newSlogan = $this->randomString(16);
@@ -168,14 +168,14 @@ public function testExportImport() {
     file_put_contents($filename, $this->tarball);
     $this->drupalPostForm('admin/config/development/configuration/full/import', ['files[import_tarball]' => $filename], 'Upload');
     // There is no snapshot yet because an import has never run.
-    $this->assertNoText(t('Warning message'));
-    $this->assertNoText(t('There are no configuration changes to import.'));
-    $this->assertText($this->contentType->label());
+    $this->assertSession()->responseNotContains(t('Warning message'));
+    $this->assertSession()->responseNotContains(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseContains($this->contentType->label());
 
     $this->drupalPostForm(NULL, [], 'Import all');
     // After importing the snapshot has been updated an there are no warnings.
-    $this->assertNoText(t('Warning message'));
-    $this->assertText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(t('Warning message'));
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
 
     $this->assertEquals($this->newSlogan, $this->config('system.site')->get('slogan'));
 
@@ -186,8 +186,8 @@ public function testExportImport() {
       ->set('slogan', $this->originalSlogan)
       ->save();
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertText(t('Warning message'));
-    $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
+    $this->assertSession()->responseContains(t('Warning message'));
+    $this->assertSession()->responseContains('The following items in your active configuration have changes since the last import that may be lost on the next import.');
     // Ensure the item is displayed as part of a list (to avoid false matches
     // on the rest of the page) and that the list markup is not escaped.
     $this->assertRaw('<li>system.site</li>');
@@ -195,9 +195,9 @@ public function testExportImport() {
     // active and snapshot should no longer exist.
     \Drupal::service('config.storage.sync')->deleteAll();
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText(t('Warning message'));
-    $this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
-    $this->assertText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(t('Warning message'));
+    $this->assertSession()->responseNotContains('The following items in your active configuration have changes since the last import that may be lost on the next import.');
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
     // Write a file to sync. The warning about differences between the active
     // and snapshot should now exist.
     /** @var \Drupal\Core\Config\StorageInterface $sync */
@@ -207,8 +207,8 @@ public function testExportImport() {
     $this->copyConfig($this->container->get('config.storage'), $sync);
     $sync->write('system.site', $data);
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertText(t('Warning message'));
-    $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
+    $this->assertSession()->responseContains(t('Warning message'));
+    $this->assertSession()->responseContains('The following items in your active configuration have changes since the last import that may be lost on the next import.');
     // Ensure the item is displayed as part of a list (to avoid false matches
     // on the rest of the page) and that the list markup is not escaped.
     $this->assertRaw('<li>system.site</li>');
@@ -278,24 +278,24 @@ public function testExportImportCollections() {
     $this->drupalPostForm('admin/config/development/configuration/full/import', ['files[import_tarball]' => $filename], 'Upload');
     // Verify that there are configuration differences to import.
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText(t('There are no configuration changes to import.'));
-    $this->assertText(t('@collection configuration collection', ['@collection' => 'collection.test1']));
-    $this->assertText(t('@collection configuration collection', ['@collection' => 'collection.test2']));
-    $this->assertText('config_test.create');
+    $this->assertSession()->responseNotContains(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseContains(t('@collection configuration collection', ['@collection' => 'collection.test1']));
+    $this->assertSession()->responseContains(t('@collection configuration collection', ['@collection' => 'collection.test2']));
+    $this->assertSession()->responseContains('config_test.create');
     $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create');
-    $this->assertText('config_test.update');
+    $this->assertSession()->responseContains('config_test.update');
     $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.update');
-    $this->assertText('config_test.delete');
+    $this->assertSession()->responseContains('config_test.delete');
     $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.delete');
-    $this->assertText('config_test.another_create');
+    $this->assertSession()->responseContains('config_test.another_create');
     $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_create');
-    $this->assertText('config_test.another_update');
+    $this->assertSession()->responseContains('config_test.another_update');
     $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_update');
-    $this->assertText('config_test.another_delete');
+    $this->assertSession()->responseContains('config_test.another_delete');
     $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_delete');
 
     $this->drupalPostForm(NULL, [], 'Import all');
-    $this->assertText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
 
     // Test data in collections.
     $data = $test1_storage->read('config_test.create');
diff --git a/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php b/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php
index dca10e4676..6f58f89c25 100644
--- a/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php
@@ -60,8 +60,8 @@ public function testInstallProfileValidation() {
     $sync->write('core.extension', $core);
 
     $this->drupalPostForm('admin/config/development/configuration', [], t('Import all'));
-    $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
-    $this->assertText('Unable to uninstall the Testing config import profile since it is the install profile.');
+    $this->assertSession()->responseContains('The configuration cannot be imported because it failed validation for the following reasons:');
+    $this->assertSession()->responseContains('Unable to uninstall the Testing config import profile since it is the install profile.');
 
     // Uninstall dependencies of testing_config_import.
     $core['module']['testing_config_import'] = 0;
@@ -75,7 +75,7 @@ public function testInstallProfileValidation() {
     $theme['default'] = 'classy';
     $sync->write('system.theme', $theme);
     $this->drupalPostForm('admin/config/development/configuration', [], t('Import all'));
-    $this->assertText('The configuration was imported successfully.');
+    $this->assertSession()->responseContains('The configuration was imported successfully.');
     $this->rebuildContainer();
     $this->assertFalse(\Drupal::moduleHandler()->moduleExists('syslog'), 'The syslog module has been uninstalled.');
     $this->assertFalse(\Drupal::service('theme_handler')->themeExists('stark'), 'The stark theme has been uninstalled.');
diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
index 82d0ede5d0..e5cabce41d 100644
--- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php
+++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
@@ -57,7 +57,7 @@ public function testImport() {
     $sync = $this->container->get('config.storage.sync');
 
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertText('There are no configuration changes to import.');
+    $this->assertSession()->responseContains('There are no configuration changes to import.');
     $this->assertNoFieldById('edit-submit', t('Import all'));
 
     // Create updated configuration object.
@@ -139,7 +139,7 @@ public function testImport() {
     $this->assertNoFieldById('edit-submit', t('Import all'));
 
     // Verify that there are no further changes to import.
-    $this->assertText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
 
     $this->rebuildContainer();
     // Verify site name has changed.
@@ -238,7 +238,7 @@ public function testImportLock() {
 
     // Verify that there are configuration differences to import.
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(t('There are no configuration changes to import.'));
 
     // Acquire a fake-lock on the import mechanism.
     $config_importer = $this->configImporter();
@@ -246,7 +246,7 @@ public function testImportLock() {
 
     // Attempt to import configuration and verify that an error message appears.
     $this->drupalPostForm(NULL, [], t('Import all'));
-    $this->assertText(t('Another request may be synchronizing configuration already.'));
+    $this->assertSession()->responseContains(t('Another request may be synchronizing configuration already.'));
 
     // Release the lock, just to keep testing sane.
     $this->container->get('lock.persistent')->release($config_importer::LOCK_NAME);
@@ -268,7 +268,7 @@ public function testImportSiteUuidValidation() {
 
     // Verify that there are configuration differences to import.
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertText(t('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.'));
+    $this->assertSession()->responseContains(t('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.'));
     $this->assertNoFieldById('edit-submit', t('Import all'));
   }
 
@@ -308,14 +308,14 @@ public function testImportDiff() {
     // changed.
 
     // Changed values are escaped.
-    $this->assertText(Html::escape("foo: '<p><em>foobar</em></p>'"));
-    $this->assertText(Html::escape("foo: '<p>foobar</p>'"));
+    $this->assertSession()->responseContains(Html::escape("foo: '<p><em>foobar</em></p>'"));
+    $this->assertSession()->responseContains(Html::escape("foo: '<p>foobar</p>'"));
     // The no change values are escaped.
-    $this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
+    $this->assertSession()->responseContains(Html::escape("baz: '<strong>no change</strong>'"));
     // Added value is escaped.
-    $this->assertText(Html::escape("biff: '<em>bangpow</em>'"));
+    $this->assertSession()->responseContains(Html::escape("biff: '<em>bangpow</em>'"));
     // Deleted value is escaped.
-    $this->assertText(Html::escape("404: '<em>herp</em>'"));
+    $this->assertSession()->responseContains(Html::escape("404: '<em>herp</em>'"));
 
     // Verify diff colors are displayed.
     $result = $this->xpath('//table[contains(@class, :class)]', [':class' => 'diff']);
@@ -329,10 +329,10 @@ public function testImportDiff() {
     // Load the diff UI and verify that the diff reflects a removed key.
     $this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
     // The no change values are escaped.
-    $this->assertText(Html::escape("foo: '<p>foobar</p>'"));
-    $this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
+    $this->assertSession()->responseContains(Html::escape("foo: '<p>foobar</p>'"));
+    $this->assertSession()->responseContains(Html::escape("baz: '<strong>no change</strong>'"));
     // Removed key is escaped.
-    $this->assertText(Html::escape("404: '<em>herp</em>'"));
+    $this->assertSession()->responseContains(Html::escape("404: '<em>herp</em>'"));
 
     // Reset data back to original and add a key
     $sync_data = $original_data;
@@ -342,10 +342,10 @@ public function testImportDiff() {
     // Load the diff UI and verify that the diff reflects an added key.
     $this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
     // The no change values are escaped.
-    $this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
-    $this->assertText(Html::escape("404: '<em>herp</em>'"));
+    $this->assertSession()->responseContains(Html::escape("baz: '<strong>no change</strong>'"));
+    $this->assertSession()->responseContains(Html::escape("404: '<em>herp</em>'"));
     // Added key is escaped.
-    $this->assertText(Html::escape("biff: '<em>bangpow</em>'"));
+    $this->assertSession()->responseContains(Html::escape("biff: '<em>bangpow</em>'"));
   }
 
   /**
@@ -361,13 +361,13 @@ public function testImportValidation() {
     $this->prepareSiteNameUpdate($new_site_name);
 
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(t('There are no configuration changes to import.'));
     $this->drupalPostForm(NULL, [], t('Import all'));
 
     // Verify that the validation messages appear.
-    $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
-    $this->assertText('Config import validate error 1.');
-    $this->assertText('Config import validate error 2.');
+    $this->assertSession()->responseContains('The configuration cannot be imported because it failed validation for the following reasons:');
+    $this->assertSession()->responseContains('Config import validate error 1.');
+    $this->assertSession()->responseContains('Config import validate error 2.');
 
     // Verify site name has not changed.
     $this->assertNotEqual($new_site_name, $this->config('system.site')->get('name'));
@@ -381,11 +381,11 @@ public function testConfigUninstallConfigException() {
     $sync->write('core.extension', $core_extension);
 
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertText('core.extension');
+    $this->assertSession()->responseContains('core.extension');
 
     // Import and verify that both do not appear anymore.
     $this->drupalPostForm(NULL, [], t('Import all'));
-    $this->assertText('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
+    $this->assertSession()->responseContains('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
   }
 
   public function prepareSiteNameUpdate($new_site_name) {
@@ -438,14 +438,14 @@ public function testImportErrorLog() {
     $sync->write($name_secondary, $values_secondary);
     // Verify that there are configuration differences to import.
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(t('There are no configuration changes to import.'));
 
     // Attempt to import configuration and verify that an error message appears.
     $this->drupalPostForm(NULL, [], t('Import all'));
-    $this->assertText(new FormattableMarkup('Deleted and replaced configuration entity "@name"', ['@name' => $name_secondary]));
-    $this->assertText(t('The configuration was imported with errors.'));
-    $this->assertNoText(t('The configuration was imported successfully.'));
-    $this->assertText(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseContains(new FormattableMarkup('Deleted and replaced configuration entity "@name"', ['@name' => $name_secondary]));
+    $this->assertSession()->responseContains(t('The configuration was imported with errors.'));
+    $this->assertSession()->responseNotContains(t('The configuration was imported successfully.'));
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
   }
 
   /**
@@ -462,11 +462,11 @@ public function testEntityBundleDelete() {
     $this->drupalGet('admin/config/development/configuration');
     // The node type, body field and entity displays will be scheduled for
     // removal.
-    $this->assertText(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('core.entity_view_display.node.@type.default', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('core.entity_form_display.node.@type.default', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('core.entity_view_display.node.@type.default', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('core.entity_form_display.node.@type.default', ['@type' => $node_type->id()]));
 
     // Attempt to import configuration and verify that an error message appears
     // and the node type, body field and entity displays are still scheduled for
@@ -474,22 +474,22 @@ public function testEntityBundleDelete() {
     $this->drupalPostForm(NULL, [], t('Import all'));
     $validation_message = t('Entities exist of type %entity_type and %bundle_label %bundle. These entities need to be deleted before importing.', ['%entity_type' => $node->getEntityType()->getLabel(), '%bundle_label' => $node->getEntityType()->getBundleLabel(), '%bundle' => $node_type->label()]);
     $this->assertRaw($validation_message);
-    $this->assertText(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('core.entity_view_display.node.@type.default', ['@type' => $node_type->id()]));
-    $this->assertText(new FormattableMarkup('core.entity_form_display.node.@type.default', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('core.entity_view_display.node.@type.default', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('core.entity_form_display.node.@type.default', ['@type' => $node_type->id()]));
 
     // Delete the node and try to import again.
     $node->delete();
     $this->drupalPostForm(NULL, [], t('Import all'));
     $this->assertNoRaw($validation_message);
-    $this->assertText(t('There are no configuration changes to import.'));
-    $this->assertNoText(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()]));
-    $this->assertNoText(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()]));
-    $this->assertNoText(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()]));
-    $this->assertNoText(new FormattableMarkup('core.entity_view_display.node.@type.default', ['@type' => $node_type->id()]));
-    $this->assertNoText(new FormattableMarkup('core.entity_form_display.node.@type.default', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseContains(t('There are no configuration changes to import.'));
+    $this->assertSession()->responseNotContains(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseNotContains(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseNotContains(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseNotContains(new FormattableMarkup('core.entity_view_display.node.@type.default', ['@type' => $node_type->id()]));
+    $this->assertSession()->responseNotContains(new FormattableMarkup('core.entity_form_display.node.@type.default', ['@type' => $node_type->id()]));
   }
 
   /**
@@ -520,11 +520,11 @@ public function testExtensionValidation() {
     $sync->write('core.extension', $core);
 
     $this->drupalPostForm('admin/config/development/configuration', [], t('Import all'));
-    $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
-    $this->assertText('Unable to uninstall the Text module since the Node module is installed.');
-    $this->assertText('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
-    $this->assertText('Unable to install the does_not_exist module since it does not exist.');
-    $this->assertText('Unable to install the does_not_exist theme since it does not exist.');
+    $this->assertSession()->responseContains('The configuration cannot be imported because it failed validation for the following reasons:');
+    $this->assertSession()->responseContains('Unable to uninstall the Text module since the Node module is installed.');
+    $this->assertSession()->responseContains('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
+    $this->assertSession()->responseContains('Unable to install the does_not_exist module since it does not exist.');
+    $this->assertSession()->responseContains('Unable to install the does_not_exist theme since it does not exist.');
   }
 
   /**
diff --git a/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php
index 368fd053c1..e12ead67ec 100644
--- a/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php
@@ -53,7 +53,7 @@ public function testImport() {
     $text_file = $this->getTestFiles('text')[0];
     $edit = ['files[import_tarball]' => \Drupal::service('file_system')->realpath($text_file->uri)];
     $this->drupalPostForm('admin/config/development/configuration/full/import', $edit, t('Upload'));
-    $this->assertText(t('Could not extract the contents of the tar file'));
+    $this->assertSession()->responseContains(t('Could not extract the contents of the tar file'));
 
     // Make the sync directory read-only.
     $directory = Settings::get('config_sync_directory');
diff --git a/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php b/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php
index 79bb74e608..b8366400ef 100644
--- a/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php
@@ -65,7 +65,7 @@ public function testSiteNameTranslation() {
 
     // The home page in English should not have the override.
     $this->drupalGet('');
-    $this->assertNoText('XX site name');
+    $this->assertSession()->responseNotContains('XX site name');
 
     // During path resolution the system.site configuration object is used to
     // determine the front page. This occurs before language negotiation causing
@@ -75,7 +75,7 @@ public function testSiteNameTranslation() {
     // we access the XX front page.
     // @see \Drupal\Core\PathProcessor::processInbound()
     $this->drupalGet('xx');
-    $this->assertText('XX site name');
+    $this->assertSession()->responseContains('XX site name');
 
     // Set the xx language to be the default language and delete the English
     // language so the site is no longer multilingual and confirm configuration
@@ -88,7 +88,7 @@ public function testSiteNameTranslation() {
     $this->assertFalse($language_manager->isMultilingual(), 'The test site is monolingual.');
 
     $this->drupalGet('xx');
-    $this->assertText('XX site name');
+    $this->assertSession()->responseContains('XX site name');
 
   }
 
diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
index 250ea06b17..ce3c576c36 100644
--- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
@@ -54,7 +54,7 @@ public function testImport() {
 
     $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
     // Assert the static portion of the error since different parsers could give different text in their error.
-    $this->assertText('The import failed with the following message: ');
+    $this->assertSession()->responseContains('The import failed with the following message: ');
 
     $import = <<<EOD
 label: First
@@ -68,7 +68,7 @@ public function testImport() {
     ];
     // Attempt an import with a missing ID.
     $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
-    $this->assertText(t('Missing ID key "@id_key" for this @entity_type import.', ['@id_key' => 'id', '@entity_type' => 'Test configuration']));
+    $this->assertSession()->responseContains(t('Missing ID key "@id_key" for this @entity_type import.', ['@id_key' => 'id', '@entity_type' => 'Test configuration']));
 
     // Perform an import with no specified UUID and a unique ID.
     $this->assertNull($storage->load('first'));
@@ -84,12 +84,12 @@ public function testImport() {
 
     // Attempt an import with an existing ID but missing UUID.
     $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
-    $this->assertText(t('An entity with this machine name already exists but the import did not specify a UUID.'));
+    $this->assertSession()->responseContains(t('An entity with this machine name already exists but the import did not specify a UUID.'));
 
     // Attempt an import with a mismatched UUID and existing ID.
     $edit['import'] .= "\nuuid: " . $uuid->generate();
     $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
-    $this->assertText(t('An entity with this machine name already exists but the UUID does not match.'));
+    $this->assertSession()->responseContains(t('An entity with this machine name already exists but the UUID does not match.'));
 
     // Attempt an import with a custom ID.
     $edit['custom_entity_id'] = 'custom_id';
@@ -216,7 +216,7 @@ public function testImportSimpleConfiguration() {
     $this->assertRaw(t('Are you sure you want to update the %name @type?', ['%name' => $config->getName(), '@type' => 'simple configuration']));
     $this->drupalPostForm(NULL, [], t('Confirm'));
     $this->drupalGet('');
-    $this->assertText('Test simple import');
+    $this->assertSession()->responseContains('Test simple import');
 
     // Ensure that ConfigImporter validation is running when importing simple
     // configuration.
@@ -229,7 +229,7 @@ public function testImportSimpleConfiguration() {
       'import' => Yaml::encode($config_data),
     ];
     $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
-    $this->assertText(t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'));
+    $this->assertSession()->responseContains(t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'));
 
   }
 
diff --git a/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php b/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php
index f47510fe19..daa34c7f92 100644
--- a/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php
+++ b/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php
@@ -44,7 +44,7 @@ public function testFormWithOverride() {
     $this->drupalGet('admin/config/regional/language/detection/url');
 
     // The language-negotiation form should be found.
-    $this->assertText('Path prefix configuration', 'Language-negotiation form found for English.');
+    $this->assertSession()->responseContains('Path prefix configuration', 'Language-negotiation form found for English.');
 
     // The English override should not be found.
     $this->assertNoFieldByName('prefix[en]', $overridden_value_en, 'Language-negotiation config override not found in English.');
@@ -53,7 +53,7 @@ public function testFormWithOverride() {
     $this->drupalGet($overridden_value_es . '/admin/config/regional/language/detection/url');
 
     // The language-negotiation form should be found.
-    $this->assertText('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.');
+    $this->assertSession()->responseContains('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.');
 
     // The Spanish override should not be found.
     $this->assertNoFieldByName('prefix[es]', $overridden_value_es, 'Language-negotiation config override not found in Spanish.');
diff --git a/core/modules/config/tests/src/Functional/SchemaConfigListenerWebTest.php b/core/modules/config/tests/src/Functional/SchemaConfigListenerWebTest.php
index ecc1a7d174..25e9bd26dd 100644
--- a/core/modules/config/tests/src/Functional/SchemaConfigListenerWebTest.php
+++ b/core/modules/config/tests/src/Functional/SchemaConfigListenerWebTest.php
@@ -66,7 +66,7 @@ public function testConfigSchemaChecker() {
 
     // Test that the config event listener is working in the child site.
     $this->drupalGet('config_test/schema_listener');
-    $this->assertText('No schema for config_schema_test.schemaless');
+    $this->assertSession()->responseContains('No schema for config_schema_test.schemaless');
   }
 
 }
diff --git a/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php b/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php
index 5ad7bd3f6b..35c6be1f91 100644
--- a/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php
+++ b/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php
@@ -49,13 +49,13 @@ protected function setUp(): void {
   public function testTransformedExportImport() {
     // After installation there is no snapshot but a new site name.
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertNoText('Warning message');
-    $this->assertNoText('There are no configuration changes to import.');
+    $this->assertSession()->responseNotContains('Warning message');
+    $this->assertSession()->responseNotContains('There are no configuration changes to import.');
 
     // Tests changes of system.site.
     $this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
-    $this->assertText('name: Drupal');
-    $this->assertText(Html::escape("name: 'Drupal Arrr'"));
+    $this->assertSession()->responseContains('name: Drupal');
+    $this->assertSession()->responseContains(Html::escape("name: 'Drupal Arrr'"));
 
     // Add a slogan.
     $originalSlogan = $this->config('system.site')->get('slogan');
@@ -69,8 +69,8 @@ public function testTransformedExportImport() {
 
     // Tests changes of system.site.
     $this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
-    $this->assertText(Html::escape("slogan: ''"));
-    $this->assertText(Html::escape("slogan: $newSlogan"));
+    $this->assertSession()->responseContains(Html::escape("slogan: ''"));
+    $this->assertSession()->responseContains(Html::escape("slogan: $newSlogan"));
 
     // Export the configuration.
     $this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
@@ -83,8 +83,8 @@ public function testTransformedExportImport() {
 
     // Assert the new name and slogan.
     $this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
-    $this->assertText(Html::escape("name: 'Drupal Arrr'"));
-    $this->assertText(Html::escape("slogan: '$originalSlogan Arrr'"));
+    $this->assertSession()->responseContains(Html::escape("name: 'Drupal Arrr'"));
+    $this->assertSession()->responseContains(Html::escape("slogan: '$originalSlogan Arrr'"));
     $this->assertEqual($this->config('system.site')->get('name'), 'Drupal');
     $this->assertEqual($this->config('system.site')->get('slogan'), $newSlogan);
 
@@ -95,7 +95,7 @@ public function testTransformedExportImport() {
 
     // Assert that the event was dispatched again on the new config.
     $this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
-    $this->assertText(Html::escape("name: 'Drupal Arrr Arrr'"));
+    $this->assertSession()->responseContains(Html::escape("name: 'Drupal Arrr Arrr'"));
   }
 
 }
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
index c2501e6002..267e2e6970 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
@@ -147,9 +147,9 @@ public function testFieldConfigTranslation() {
     $this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate");
     $this->clickLink('Add');
 
-    $this->assertText('Translatable field setting');
+    $this->assertSession()->responseContains('Translatable field setting');
     $this->assertEscaped($translatable_field_setting);
-    $this->assertText('Translatable storage setting');
+    $this->assertSession()->responseContains('Translatable storage setting');
     $this->assertEscaped($translatable_storage_setting);
 
     // Add translation for label.
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
index 5fe5916ad9..4499afbe30 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
@@ -137,17 +137,17 @@ public function testHiddenEntities() {
     // Hidden languages are only available to translate through the
     // configuration translation listings.
     $this->drupalGet('admin/config/regional/config-translation/configurable_language');
-    $this->assertText('Not applicable');
+    $this->assertSession()->responseContains('Not applicable');
     $this->assertLinkByHref('admin/config/regional/language/edit/zxx/translate');
-    $this->assertText('Not specified');
+    $this->assertSession()->responseContains('Not specified');
     $this->assertLinkByHref('admin/config/regional/language/edit/und/translate');
 
     // Hidden date formats are only available to translate through the
     // configuration translation listings. Test a couple of them.
     $this->drupalGet('admin/config/regional/config-translation/date_format');
-    $this->assertText('HTML Date');
+    $this->assertSession()->responseContains('HTML Date');
     $this->assertLinkByHref('admin/config/regional/date-time/formats/manage/html_date/translate');
-    $this->assertText('HTML Year');
+    $this->assertSession()->responseContains('HTML Year');
     $this->assertLinkByHref('admin/config/regional/date-time/formats/manage/html_year/translate');
   }
 
@@ -172,8 +172,8 @@ public function testListingPageWithOverrides() {
 
     // Test that the original label on the listing page is intact.
     $this->drupalGet('admin/config/regional/config-translation/config_test');
-    $this->assertText($original_label);
-    $this->assertNoText($overridden_label);
+    $this->assertSession()->responseContains($original_label);
+    $this->assertSession()->responseNotContains($overridden_label);
   }
 
   /**
@@ -198,8 +198,8 @@ public function testListingFieldsPage() {
     $field->save();
 
     $this->drupalGet('admin/config/regional/config-translation/node_fields');
-    $this->assertText('Body');
-    $this->assertText('Basic');
+    $this->assertSession()->responseContains('Body');
+    $this->assertSession()->responseContains('Basic');
     $this->assertLinkByHref('admin/structure/types/manage/basic/fields/node.basic.body/translate');
   }
 
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
index 85ee670e56..4a1e923f9e 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
@@ -193,8 +193,8 @@ public function testSiteInformationTranslationUi() {
 
     // Visit French site to ensure base language string present as source.
     $this->drupalGet("fr/$translation_base_url/fr/edit");
-    $this->assertText($site_name);
-    $this->assertText($site_slogan);
+    $this->assertSession()->responseContains($site_name);
+    $this->assertSession()->responseContains($site_slogan);
 
     // Translate 'Site name' label in French.
     $search = [
@@ -213,19 +213,19 @@ public function testSiteInformationTranslationUi() {
 
     // Ensure that the label is in French (and not in English).
     $this->drupalGet("fr/$translation_base_url/fr/edit");
-    $this->assertText($fr_site_name_label);
-    $this->assertNoText($site_name_label);
+    $this->assertSession()->responseContains($fr_site_name_label);
+    $this->assertSession()->responseNotContains($site_name_label);
 
     // Ensure that the label is also in French (and not in English)
     // when editing another language with the interface in French.
     $this->drupalGet("fr/$translation_base_url/ta/edit");
-    $this->assertText($fr_site_name_label);
-    $this->assertNoText($site_name_label);
+    $this->assertSession()->responseContains($fr_site_name_label);
+    $this->assertSession()->responseNotContains($site_name_label);
 
     // Ensure that the label is not translated when the interface is in English.
     $this->drupalGet("$translation_base_url/fr/edit");
-    $this->assertText($site_name_label);
-    $this->assertNoText($fr_site_name_label);
+    $this->assertSession()->responseContains($site_name_label);
+    $this->assertSession()->responseNotContains($fr_site_name_label);
   }
 
   /**
@@ -263,8 +263,8 @@ public function testSourceValueDuplicateSave() {
     $this->drupalGet("$translation_base_url/fr/edit");
     // Assert that the language configuration does not leak outside of the
     // translation form into the actual site name and slogan.
-    $this->assertNoText('FR ' . $site_name);
-    $this->assertNoText('FR ' . $site_slogan);
+    $this->assertSession()->responseNotContains('FR ' . $site_name);
+    $this->assertSession()->responseNotContains('FR ' . $site_slogan);
     $edit = [
       'translation[config_names][system.site][name]' => $site_name,
       'translation[config_names][system.site][slogan]' => 'FR ' . $site_slogan,
@@ -279,7 +279,7 @@ public function testSourceValueDuplicateSave() {
 
     // Case 3: Keep default value for site name and slogan.
     $this->drupalGet("$translation_base_url/fr/edit");
-    $this->assertNoText('FR ' . $site_slogan);
+    $this->assertSession()->responseNotContains('FR ' . $site_slogan);
     $edit = [
       'translation[config_names][system.site][name]' => $site_name,
       'translation[config_names][system.site][slogan]' => $site_slogan,
@@ -335,7 +335,7 @@ public function testContactConfigEntityTranslation() {
 
     // Visit the form to confirm the changes.
     $this->drupalGet('contact/feedback');
-    $this->assertText($label);
+    $this->assertSession()->responseContains($label);
 
     foreach ($this->langcodes as $langcode) {
       $this->drupalGet($translation_base_url);
@@ -347,7 +347,7 @@ public function testContactConfigEntityTranslation() {
 
       // Make sure original text is present on this page.
       $this->drupalGet($translation_page_url);
-      $this->assertText($label);
+      $this->assertSession()->responseContains($label);
 
       // Update translatable fields.
       $edit = [
@@ -373,7 +373,7 @@ public function testContactConfigEntityTranslation() {
 
       // Visit language specific version of form to check label.
       $this->drupalGet($langcode . '/contact/feedback');
-      $this->assertText('Website feedback - ' . $langcode);
+      $this->assertSession()->responseContains('Website feedback - ' . $langcode);
 
       // Submit feedback.
       $edit = [
@@ -391,7 +391,7 @@ public function testContactConfigEntityTranslation() {
       foreach ($langcode_prefixes as $langcode_prefix) {
         $this->drupalGet(ltrim("$langcode_prefix/$translation_base_url/$langcode/edit", '/'));
         $this->assertFieldByName('translation[config_names][contact.form.feedback][label]', 'Website feedback - ' . $langcode);
-        $this->assertText($label);
+        $this->assertSession()->responseContains($label);
       }
     }
 
@@ -476,7 +476,7 @@ public function testDateFormatTranslation() {
 
       // Make sure original text is present on this page.
       $this->drupalGet($translation_page_url);
-      $this->assertText($label);
+      $this->assertSession()->responseContains($label);
 
       // Make sure that the date library is added.
       $this->assertRaw('core/modules/system/js/system.date.js');
@@ -539,8 +539,8 @@ public function testAccountSettingsConfigurationTranslation() {
       $this->assertFieldByXPath($xpath, $value);
     }
     // Check that labels for email settings appear.
-    $this->assertText(t('Account cancellation confirmation'));
-    $this->assertText(t('Password recovery'));
+    $this->assertSession()->responseContains(t('Account cancellation confirmation'));
+    $this->assertSession()->responseContains(t('Password recovery'));
   }
 
   /**
@@ -758,9 +758,9 @@ public function testFieldConfigTranslation() {
     $this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate");
     $this->clickLink('Add');
 
-    $this->assertText('Translatable field setting');
+    $this->assertSession()->responseContains('Translatable field setting');
     $this->assertEscaped($translatable_field_setting);
-    $this->assertText('Translatable storage setting');
+    $this->assertSession()->responseContains('Translatable storage setting');
     $this->assertEscaped($translatable_storage_setting);
   }
 
@@ -797,7 +797,7 @@ public function testBooleanFieldConfigTranslation() {
 
     // Checks the text of details summary element that surrounds the translation
     // options.
-    $this->assertText(Html::escape(strip_tags($on_label)) . ' Boolean settings');
+    $this->assertSession()->responseContains(Html::escape(strip_tags($on_label)) . ' Boolean settings');
 
     // Checks that the correct on and off labels appear on the form.
     $this->assertEscaped($on_label);
@@ -891,14 +891,14 @@ public function testAlterInfo() {
 
     // Check out if the translation page has the altered in settings.
     $this->drupalGet('admin/config/system/site-information/translate/fr/add');
-    $this->assertText(t('Feed channel'));
-    $this->assertText(t('Feed description'));
+    $this->assertSession()->responseContains(t('Feed channel'));
+    $this->assertSession()->responseContains(t('Feed description'));
 
     // Check if the translation page does not have the altered out settings.
     $this->drupalGet('admin/config/people/accounts/translate/fr/add');
-    $this->assertText(t('Name'));
-    $this->assertNoText(t('Account cancellation confirmation'));
-    $this->assertNoText(t('Password recovery'));
+    $this->assertSession()->responseContains(t('Name'));
+    $this->assertSession()->responseNotContains(t('Account cancellation confirmation'));
+    $this->assertSession()->responseNotContains(t('Password recovery'));
   }
 
   /**
@@ -1067,7 +1067,7 @@ public function testNodeFieldTranslation() {
       'translation[config_names][field.field.node.article.translatable_field][label]' => 'FR label',
     ];
     $this->drupalPostForm(NULL, $form_values, 'Save translation');
-    $this->assertText('Successfully saved French translation.');
+    $this->assertSession()->responseContains('Successfully saved French translation.');
 
     // Check that the translations are saved.
     $this->clickLink('Add');
diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
index d74dec9376..a2a24101c7 100644
--- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
@@ -180,7 +180,7 @@ public function testPersonalContactAccess() {
     $this->drupalLogin($this->adminUser);
     $edit = ['contact_default_status' => FALSE];
     $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'), 'Setting successfully saved.');
     $this->drupalLogout();
 
     // Re-create our contacted user with personal contact forms disabled by
@@ -242,7 +242,7 @@ public function testPersonalContactFlood() {
     // Submit contact form with correct values and check flood interval.
     for ($i = 0; $i < $flood_limit; $i++) {
       $this->submitPersonalContact($this->contactUser);
-      $this->assertText(t('Your message has been sent.'), 'Message sent.');
+      $this->assertSession()->responseContains(t('Your message has been sent.'), 'Message sent.');
     }
 
     // Submit contact form one over limit.
@@ -252,7 +252,7 @@ public function testPersonalContactFlood() {
     // Test that the admin user can still access the contact form even though
     // the flood limit was reached.
     $this->drupalLogin($this->adminUser);
-    $this->assertNoText('Try again later.', 'Admin user not denied access to flooded contact form.');
+    $this->assertSession()->responseNotContains('Try again later.', 'Admin user not denied access to flooded contact form.');
   }
 
   /**
diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
index 3fb719e062..64dee638e7 100644
--- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
@@ -105,7 +105,7 @@ public function testSiteWideContact() {
     $edit = [];
     $edit['contact_default_status'] = TRUE;
     $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
 
     $this->drupalGet('admin/structure/contact');
     // Default form exists.
@@ -128,7 +128,7 @@ public function testSiteWideContact() {
     // Delete old forms to ensure that new forms are used.
     $this->deleteContactForms();
     $this->drupalGet('admin/structure/contact');
-    $this->assertText('Personal', 'Personal form was not deleted');
+    $this->assertSession()->responseContains('Personal', 'Personal form was not deleted');
     $this->assertNoLinkByHref('admin/structure/contact/manage/feedback');
 
     // Ensure that the contact form won't be shown without forms.
@@ -140,7 +140,7 @@ public function testSiteWideContact() {
     $this->drupalLogin($admin_user);
     $this->drupalGet('contact');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('The contact form has not been configured.'));
+    $this->assertSession()->responseContains(t('The contact form has not been configured.'));
     // Test access personal form via site-wide contact page.
     $this->drupalGet('contact/personal');
     $this->assertSession()->statusCodeEquals(403);
@@ -155,18 +155,18 @@ public function testSiteWideContact() {
 
     // Test validation of empty form and recipients fields.
     $this->addContactForm('', '', '', '', TRUE);
-    $this->assertText(t('Label field is required.'));
-    $this->assertText(t('Machine-readable name field is required.'));
-    $this->assertText(t('Recipients field is required.'));
+    $this->assertSession()->responseContains(t('Label field is required.'));
+    $this->assertSession()->responseContains(t('Machine-readable name field is required.'));
+    $this->assertSession()->responseContains(t('Recipients field is required.'));
 
     // Test validation of max_length machine name.
     $recipients = ['simpletest&@example.com', 'simpletest2@example.com', 'simpletest3@example.com'];
     $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
     $max_length_exceeded = $max_length + 1;
     $this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE);
-    $this->assertText(new FormattableMarkup('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', ['@max' => $max_length, '@exceeded' => $max_length_exceeded]));
+    $this->assertSession()->responseContains(new FormattableMarkup('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', ['@max' => $max_length, '@exceeded' => $max_length_exceeded]));
     $this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE);
-    $this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
+    $this->assertSession()->responseContains(t('Contact form @label has been added.', ['@label' => $label]));
 
     // Verify that the creation message contains a link to a contact form.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'contact/']);
@@ -174,7 +174,7 @@ public function testSiteWideContact() {
 
     // Create first valid form.
     $this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE);
-    $this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
+    $this->assertSession()->responseContains(t('Contact form @label has been added.', ['@label' => $label]));
 
     // Verify that the creation message contains a link to a contact form.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'contact/']);
@@ -199,10 +199,10 @@ public function testSiteWideContact() {
     $this->assertEqual($config['recipients'], [$recipients[0], $recipients[1]]);
     $this->assertEqual($config['reply'], $reply);
     $this->assertNotEqual($id, $this->config('contact.settings')->get('default_form'));
-    $this->assertText(t('Contact form @label has been updated.', ['@label' => $label]));
+    $this->assertSession()->responseContains(t('Contact form @label has been updated.', ['@label' => $label]));
     // Ensure the label is displayed on the contact page for this form.
     $this->drupalGet('contact/' . $id);
-    $this->assertText($label);
+    $this->assertSession()->responseContains($label);
 
     // Reset the form back to be the default form.
     $this->config('contact.settings')->set('default_form', $id)->save();
@@ -211,20 +211,20 @@ public function testSiteWideContact() {
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
     $this->drupalLogout();
     $this->drupalGet('contact');
-    $this->assertText(t('Your email address'));
-    $this->assertNoText(t('Form'));
+    $this->assertSession()->responseContains(t('Your email address'));
+    $this->assertSession()->responseNotContains(t('Form'));
     $this->drupalLogin($admin_user);
 
     // Add more forms.
     $this->addContactForm(mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE);
-    $this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
+    $this->assertSession()->responseContains(t('Contact form @label has been added.', ['@label' => $label]));
 
     $this->addContactForm($name = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE);
-    $this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
+    $this->assertSession()->responseContains(t('Contact form @label has been added.', ['@label' => $label]));
 
     // Try adding a form that already exists.
     $this->addContactForm($name, $label, '', '', FALSE);
-    $this->assertNoText(t('Contact form @label has been added.', ['@label' => $label]));
+    $this->assertSession()->responseNotContains(t('Contact form @label has been added.', ['@label' => $label]));
     $this->assertRaw(t('The machine-readable name is already in use. It must be unique.'));
 
     $this->drupalLogout();
@@ -241,19 +241,19 @@ public function testSiteWideContact() {
 
     // Submit contact form with invalid values.
     $this->submitContact('', $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
-    $this->assertText(t('Your name field is required.'));
+    $this->assertSession()->responseContains(t('Your name field is required.'));
 
     $this->submitContact($this->randomMachineName(16), '', $this->randomMachineName(16), $id, $this->randomMachineName(64));
-    $this->assertText(t('Your email address field is required.'));
+    $this->assertSession()->responseContains(t('Your email address field is required.'));
 
     $this->submitContact($this->randomMachineName(16), $invalid_recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
     $this->assertRaw(t('The email address %mail is not valid.', ['%mail' => 'invalid']));
 
     $this->submitContact($this->randomMachineName(16), $recipients[0], '', $id, $this->randomMachineName(64));
-    $this->assertText(t('Subject field is required.'));
+    $this->assertSession()->responseContains(t('Subject field is required.'));
 
     $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, '');
-    $this->assertText(t('Message field is required.'));
+    $this->assertSession()->responseContains(t('Message field is required.'));
 
     // Test contact form with no default form selected.
     $this->config('contact.settings')
@@ -271,7 +271,7 @@ public function testSiteWideContact() {
     // Submit contact form with correct values and check flood interval.
     for ($i = 0; $i < $flood_limit; $i++) {
       $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
-      $this->assertText(t('Your message has been sent.'));
+      $this->assertSession()->responseContains(t('Your message has been sent.'));
     }
     // Submit contact form one over limit.
     $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
@@ -321,11 +321,11 @@ public function testSiteWideContact() {
 
     // Check preview field can be ordered.
     $this->drupalGet('admin/structure/contact/manage/' . $contact_form . '/form-display');
-    $this->assertText(t('Preview'));
+    $this->assertSession()->responseContains(t('Preview'));
 
     // Check that the field is displayed.
     $this->drupalGet('contact/' . $contact_form);
-    $this->assertText($field_label);
+    $this->assertSession()->responseContains($field_label);
 
     // Submit the contact form and verify the content.
     $edit = [
@@ -356,7 +356,7 @@ public function testSiteWideContact() {
       $field_name . '[0][value]' => $this->randomMachineName(),
     ];
     $this->drupalPostForm(NULL, $edit, t('Send message'));
-    $this->assertText('Thanks for your submission.');
+    $this->assertSession()->responseContains('Thanks for your submission.');
     $this->assertUrl('user/' . $admin_user->id());
 
     // Test Empty message.
@@ -468,7 +468,7 @@ public function testAutoReply() {
       ->removeComponent('mail')
       ->save();
     $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'foo', $this->randomString(128));
-    $this->assertNoText('Unable to send email. Contact the site administrator if the problem persists.');
+    $this->assertSession()->responseNotContains('Unable to send email. Contact the site administrator if the problem persists.');
     $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]);
     $this->assertCount(0, $captured_emails);
     $this->drupalLogin($admin_user);
diff --git a/core/modules/contact/tests/src/Functional/ContactStorageTest.php b/core/modules/contact/tests/src/Functional/ContactStorageTest.php
index 3ef5ccc47d..ff343c46ce 100644
--- a/core/modules/contact/tests/src/Functional/ContactStorageTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactStorageTest.php
@@ -54,16 +54,16 @@ public function testContactStorage() {
     $this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$mail]), '', TRUE, 'Your message has been sent.', [
       'send_a_pony' => 1,
     ]);
-    $this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
+    $this->assertSession()->responseContains(t('Contact form @label has been added.', ['@label' => $label]));
 
     // Ensure that anonymous can submit site-wide contact form.
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
     $this->drupalLogout();
     $this->drupalGet('contact');
-    $this->assertText(t('Your email address'));
-    $this->assertNoText(t('Form'));
+    $this->assertSession()->responseContains(t('Your email address'));
+    $this->assertSession()->responseNotContains(t('Form'));
     $this->submitContact($name = $this->randomMachineName(16), $mail, $subject = $this->randomMachineName(16), $id, $message = $this->randomMachineName(64));
-    $this->assertText(t('Your message has been sent.'));
+    $this->assertSession()->responseContains(t('Your message has been sent.'));
 
     $messages = Message::loadMultiple();
     /** @var \Drupal\contact\Entity\Message $message */
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php
index 2fa1b5aa8b..f7d3292b3c 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php
@@ -165,7 +165,7 @@ public function testModerationForm() {
     $this->drupalGet($latest_version_path);
     $this->assertSession()->statusCodeEquals(200);
     $this->assertField('edit-new-state', 'The latest-version page has a moderation form.');
-    $this->assertText('Draft', 'Correct status found on the latest-version page.');
+    $this->assertSession()->responseContains('Draft', 'Correct status found on the latest-version page.');
 
     // Submit the moderation form to change status to published.
     $this->drupalPostForm($latest_version_path, [
@@ -209,7 +209,7 @@ public function testNonBundleModerationForm() {
     // default revision.
     $this->drupalGet('entity_test_mulrevpub/manage/1');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText('Status', 'The node view page has no moderation form.');
+    $this->assertSession()->responseNotContains('Status', 'The node view page has no moderation form.');
 
     // The latest version page should not show, because there is still no
     // pending revision.
@@ -223,14 +223,14 @@ public function testNonBundleModerationForm() {
     // default revision.
     $this->drupalGet('entity_test_mulrevpub/manage/1');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText('Status', 'The node view page has no moderation form.');
+    $this->assertSession()->responseNotContains('Status', 'The node view page has no moderation form.');
 
     // The latest version page should show the moderation form and have "Draft"
     // status, because the pending revision is in "Draft".
     $this->drupalGet('entity_test_mulrevpub/manage/1/latest');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Moderation state', 'Form text found on the latest-version page.');
-    $this->assertText('Draft', 'Correct status found on the latest-version page.');
+    $this->assertSession()->responseContains('Moderation state', 'Form text found on the latest-version page.');
+    $this->assertSession()->responseContains('Draft', 'Correct status found on the latest-version page.');
 
     // Submit the moderation form to change status to published.
     $this->drupalPostForm('entity_test_mulrevpub/manage/1/latest', [
@@ -263,7 +263,7 @@ public function testModerationFormSetsRevisionAuthor() {
     ], t('Apply'));
 
     $this->drupalGet(sprintf('node/%d/revisions', $node->id()));
-    $this->assertText('by ' . $another_user->getAccountName());
+    $this->assertSession()->responseContains('by ' . $another_user->getAccountName());
 
     // Verify the revision creation time has been updated.
     $node = $node->load($node->id());
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php
index f92dcc3d88..bf04cf498b 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php
@@ -72,7 +72,7 @@ public function testTranslateModeratedContent() {
       'moderation_state[0][state]' => 'published',
     ];
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
-    $this->assertText(t('Article Published English node has been created.'));
+    $this->assertSession()->responseContains(t('Article Published English node has been created.'));
     $english_node = $this->drupalGetNodeByTitle('Published English node');
 
     // Add a French translation.
@@ -86,7 +86,7 @@ public function testTranslateModeratedContent() {
     // Here the error has occurred "The website encountered an unexpected error.
     // Please try again later."
     // If the translation has got lost.
-    $this->assertText(t('Article French node Draft has been updated.'));
+    $this->assertSession()->responseContains(t('Article French node Draft has been updated.'));
 
     // Create an article in English.
     $edit = [
@@ -95,7 +95,7 @@ public function testTranslateModeratedContent() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
-    $this->assertText(t('Article English node has been created.'));
+    $this->assertSession()->responseContains(t('Article English node has been created.'));
     $english_node = $this->drupalGetNodeByTitle('English node');
 
     // Add a French translation.
@@ -106,7 +106,7 @@ public function testTranslateModeratedContent() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
-    $this->assertText(t('Article French node has been updated.'));
+    $this->assertSession()->responseContains(t('Article French node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('English node', TRUE);
 
     // Publish the English article and check that the translation stays
@@ -114,7 +114,7 @@ public function testTranslateModeratedContent() {
     $this->drupalPostForm('node/' . $english_node->id() . '/edit', [
       'moderation_state[0][state]' => 'published',
     ], t('Save (this translation)'));
-    $this->assertText(t('Article English node has been updated.'));
+    $this->assertSession()->responseContains(t('Article English node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('English node', TRUE);
     $french_node = $english_node->getTranslation('fr');
     $this->assertEqual('French node', $french_node->label());
@@ -131,7 +131,7 @@ public function testTranslateModeratedContent() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
-    $this->assertText(t('Article Another node has been created.'));
+    $this->assertSession()->responseContains(t('Article Another node has been created.'));
     $english_node = $this->drupalGetNodeByTitle('Another node');
 
     // Add a French translation.
@@ -142,7 +142,7 @@ public function testTranslateModeratedContent() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
-    $this->assertText(t('Article Translated node has been updated.'));
+    $this->assertSession()->responseContains(t('Article Translated node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
 
     // Publish the translation and check that the source language version stays
@@ -150,7 +150,7 @@ public function testTranslateModeratedContent() {
     $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
       'moderation_state[0][state]' => 'published',
     ], t('Save (this translation)'));
-    $this->assertText(t('Article Translated node has been updated.'));
+    $this->assertSession()->responseContains(t('Article Translated node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
     $french_node = $english_node->getTranslation('fr');
     $this->assertEqual($french_node->moderation_state->value, 'published');
@@ -164,7 +164,7 @@ public function testTranslateModeratedContent() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', $edit, t('Save (this translation)'));
-    $this->assertText(t('Article New draft of translated node has been updated.'));
+    $this->assertSession()->responseContains(t('Article New draft of translated node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
     $french_node = $english_node->getTranslation('fr');
     $this->assertEqual($french_node->moderation_state->value, 'published');
@@ -175,7 +175,7 @@ public function testTranslateModeratedContent() {
     $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
       'moderation_state[0][state]' => 'published',
     ], t('Save (this translation)'));
-    $this->assertText(t('Article New draft of translated node has been updated.'));
+    $this->assertSession()->responseContains(t('Article New draft of translated node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
     $french_node = $english_node->getTranslation('fr');
     $this->assertEqual($french_node->moderation_state->value, 'published');
@@ -186,7 +186,7 @@ public function testTranslateModeratedContent() {
     $this->drupalPostForm('node/' . $english_node->id() . '/edit', [
       'moderation_state[0][state]' => 'published',
     ], t('Save (this translation)'));
-    $this->assertText(t('Article Another node has been updated.'));
+    $this->assertSession()->responseContains(t('Article Another node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
     $this->assertEqual($english_node->moderation_state->value, 'published');
 
@@ -194,11 +194,11 @@ public function testTranslateModeratedContent() {
     $this->drupalPostForm('node/' . $english_node->id() . '/edit', [
       'moderation_state[0][state]' => 'archived',
     ], t('Save (this translation)'));
-    $this->assertText(t('Article Another node has been updated.'));
+    $this->assertSession()->responseContains(t('Article Another node has been updated.'));
     $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
       'moderation_state[0][state]' => 'archived',
     ], t('Save (this translation)'));
-    $this->assertText(t('Article New draft of translated node has been updated.'));
+    $this->assertSession()->responseContains(t('Article New draft of translated node has been updated.'));
     $english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
     $french_node = $english_node->getTranslation('fr');
     $this->assertEqual($english_node->moderation_state->value, 'archived');
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php
index 5e97162576..386f17cffd 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php
@@ -68,7 +68,7 @@ public function testCustomBlockModeration() {
       'body[0][value]' => $body,
     ];
     $this->drupalPostForm('block/add', $edit, t('Save'));
-    $this->assertText(t('basic Moderated block has been created.'));
+    $this->assertSession()->responseContains(t('basic Moderated block has been created.'));
 
     // Place the block in the Sidebar First region.
     $instance = [
@@ -83,7 +83,7 @@ public function testCustomBlockModeration() {
     // Navigate to home page and check that the block is visible. It should be
     // visible because it is the default revision.
     $this->drupalGet('');
-    $this->assertText($body);
+    $this->assertSession()->responseContains($body);
 
     // Update the block.
     $updated_body = 'This is the new body value';
@@ -92,13 +92,13 @@ public function testCustomBlockModeration() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm('block/' . $block->id(), $edit, t('Save'));
-    $this->assertText(t('basic Moderated block has been updated.'));
+    $this->assertSession()->responseContains(t('basic Moderated block has been updated.'));
 
     // Navigate to the home page and check that the block shows the updated
     // content. It should show the updated content because the block's default
     // revision is not a published moderation state.
     $this->drupalGet('');
-    $this->assertText($updated_body);
+    $this->assertSession()->responseContains($updated_body);
 
     // Publish the block so we can create a pending revision.
     $this->drupalPostForm('block/' . $block->id(), [
@@ -112,30 +112,30 @@ public function testCustomBlockModeration() {
       'moderation_state[0][state]' => 'draft',
     ];
     $this->drupalPostForm('block/' . $block->id(), $edit, t('Save'));
-    $this->assertText(t('basic Moderated block has been updated.'));
+    $this->assertSession()->responseContains(t('basic Moderated block has been updated.'));
 
     // Navigate to home page and check that the pending revision doesn't show,
     // since it should not be set as the default revision.
     $this->drupalGet('');
-    $this->assertText($updated_body);
+    $this->assertSession()->responseContains($updated_body);
 
     // Open the latest tab and publish the new draft.
     $edit = [
       'new_state' => 'published',
     ];
     $this->drupalPostForm('block/' . $block->id() . '/latest', $edit, t('Apply'));
-    $this->assertText(t('The moderation state has been updated.'));
+    $this->assertSession()->responseContains(t('The moderation state has been updated.'));
 
     // Navigate to home page and check that the pending revision is now the
     // default revision and therefore visible.
     $this->drupalGet('');
-    $this->assertText($pending_revision_body);
+    $this->assertSession()->responseContains($pending_revision_body);
 
     // Check that revision is checked by default when content moderation is
     // enabled.
     $this->drupalGet('/block/' . $block->id());
     $this->assertSession()->checkboxChecked('revision');
-    $this->assertText('Revisions must be required when moderation is enabled.');
+    $this->assertSession()->responseContains('Revisions must be required when moderation is enabled.');
     $this->assertSession()->fieldDisabled('revision');
   }
 
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php
index 2864cc59d0..8922da3cdd 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php
@@ -53,11 +53,11 @@ public function testCreatingContent() {
     $this->assertEqual('published', $node->moderation_state->value);
 
     // Verify that the state field is not shown.
-    $this->assertNoText('Published');
+    $this->assertSession()->responseNotContains('Published');
 
     // Delete the node.
     $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete'));
-    $this->assertText(t('The Moderated content moderated content has been deleted.'));
+    $this->assertSession()->responseContains(t('The Moderated content moderated content has been deleted.'));
 
     // Disable content moderation.
     $edit['bundles[moderated_content]'] = FALSE;
@@ -96,7 +96,7 @@ public function testFormSaveDestination() {
     // After saving, we should be at the canonical URL and viewing the first
     // revision.
     $this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
-    $this->assertText('First version of the content.');
+    $this->assertSession()->responseContains('First version of the content.');
 
     // Create a new draft; after saving, we should still be on the canonical
     // URL, but viewing the second revision.
@@ -105,7 +105,7 @@ public function testFormSaveDestination() {
       'moderation_state[0][state]' => 'draft',
     ], t('Save'));
     $this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
-    $this->assertText('Second version of the content.');
+    $this->assertSession()->responseContains('Second version of the content.');
 
     // Make a new published revision; after saving, we should be at the
     // canonical URL.
@@ -114,7 +114,7 @@ public function testFormSaveDestination() {
       'moderation_state[0][state]' => 'published',
     ], t('Save'));
     $this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
-    $this->assertText('Third version of the content.');
+    $this->assertSession()->responseContains('Third version of the content.');
 
     // Make a new pending revision; after saving, we should be on the "Latest
     // version" tab.
@@ -123,7 +123,7 @@ public function testFormSaveDestination() {
       'moderation_state[0][state]' => 'draft',
     ], t('Save'));
     $this->assertUrl(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()]));
-    $this->assertText('Fourth version of the content.');
+    $this->assertSession()->responseContains('Fourth version of the content.');
   }
 
   /**
diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php
index 8999dae122..65ac7554fb 100644
--- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php
@@ -23,14 +23,14 @@ class ModerationStateNodeTypeTest extends ModerationStateTestBase {
   public function testNotModerated() {
     $this->drupalLogin($this->adminUser);
     $this->createContentTypeFromUi('Not moderated', 'not_moderated');
-    $this->assertText('The content type Not moderated has been added.');
+    $this->assertSession()->responseContains('The content type Not moderated has been added.');
     $this->grantUserPermissionToCreateContentOfType($this->adminUser, 'not_moderated');
     $this->drupalGet('node/add/not_moderated');
     $this->assertRaw('Save');
     $this->drupalPostForm(NULL, [
       'title[0][value]' => 'Test',
     ], t('Save'));
-    $this->assertText('Not moderated Test has been created.');
+    $this->assertSession()->responseContains('Not moderated Test has been created.');
   }
 
   /**
@@ -65,7 +65,7 @@ public function testEnablingOnExistingContent() {
     $this->drupalPostForm(NULL, [
       'title[0][value]' => 'Test',
     ], t('Save'));
-    $this->assertText('Not moderated Test has been created.');
+    $this->assertSession()->responseContains('Not moderated Test has been created.');
 
     // Now enable moderation state.
     $this->enableModerationThroughUi('not_moderated');
diff --git a/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php b/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php
index 5ad27a011c..9269751819 100644
--- a/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php
@@ -65,8 +65,8 @@ public function testModerationInWorkspace() {
     // Check that neither of them are visible in Live.
     $this->switchToLive();
     $this->drupalGet('<front>');
-    $this->assertNoText('First article');
-    $this->assertNoText('Second article');
+    $this->assertSession()->responseNotContains('First article');
+    $this->assertSession()->responseNotContains('Second article');
 
     // Switch back to Stage.
     $this->switchToWorkspace($stage);
@@ -81,7 +81,7 @@ public function testModerationInWorkspace() {
     ], 'Save');
 
     $this->drupalGet('/node/1');
-    $this->assertText('First article - draft');
+    $this->assertSession()->responseContains('First article - draft');
 
     $this->drupalGet('/node/1/edit');
     $this->assertEquals('Current state Draft', $this->cssSelect('#edit-moderation-state-0-current')[0]->getText());
@@ -97,7 +97,7 @@ public function testModerationInWorkspace() {
     ], 'Save');
 
     $this->drupalGet('/node/1');
-    $this->assertText('First article - archived');
+    $this->assertSession()->responseContains('First article - archived');
 
     // Get the second node to a default revision state and publish the
     // workspace.
@@ -110,10 +110,10 @@ public function testModerationInWorkspace() {
 
     // The admin user can see unpublished nodes.
     $this->drupalGet('/node/1');
-    $this->assertText('First article - archived');
+    $this->assertSession()->responseContains('First article - archived');
 
     $this->drupalGet('/node/2');
-    $this->assertText('Second article - published');
+    $this->assertSession()->responseContains('Second article - published');
   }
 
 }
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
index bf9c41b939..2199269e7f 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
@@ -35,8 +35,8 @@ public function testEnable() {
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
 
     // Status messages are shown.
-    $this->assertText(t('This site has only a single language enabled. Add at least one more language in order to translate content.'));
-    $this->assertText(t('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.'));
+    $this->assertSession()->responseContains(t('This site has only a single language enabled. Add at least one more language in order to translate content.'));
+    $this->assertSession()->responseContains(t('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.'));
 
     // No pending updates should be available.
     $this->drupalGet('admin/reports/status');
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
index ac196182f1..880e0c2253 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
@@ -60,7 +60,7 @@ public function testSettingsUI() {
     // Check for the content_translation_menu_links_discovered_alter() changes.
     $this->drupalGet('admin/config');
     $this->assertLink('Content language and translation');
-    $this->assertText('Configure language and translation support for content.');
+    $this->assertSession()->responseContains('Configure language and translation support for content.');
     // Test that the translation settings are ignored if the bundle is marked
     // translatable but the entity type is not.
     $edit = ['settings[comment][comment_article][translatable]' => TRUE];
@@ -230,7 +230,7 @@ public function testAccountLanguageSettingsUI() {
     // Make sure account settings can be saved.
     $this->drupalPostForm('admin/config/people/accounts', ['anonymous' => 'Save me please!'], 'Save configuration');
     $this->assertFieldByName('anonymous', 'Save me please!', 'Anonymous name has been changed.');
-    $this->assertText('The configuration options have been saved.');
+    $this->assertSession()->responseContains('The configuration options have been saved.');
   }
 
   /**
@@ -274,7 +274,7 @@ public function testFieldTranslatableSettingsUI() {
     $path = 'admin/structure/types/manage/article/fields/node.article.field_article_text';
     $this->drupalGet($path);
     $this->assertFieldByXPath('//input[@id="edit-translatable" and @disabled="disabled"]');
-    $this->assertText('To configure translation for this field, enable language support for this type.', 'No translatable setting for field.');
+    $this->assertSession()->responseContains('To configure translation for this field, enable language support for this type.', 'No translatable setting for field.');
 
     // Tests that field has translatable setting if bundle is translatable.
     // Note: this field is not translatable when enable bundle translatability.
@@ -287,7 +287,7 @@ public function testFieldTranslatableSettingsUI() {
     $this->assertSettings('node', 'article', TRUE, $edit);
     $this->drupalGet($path);
     $this->assertFieldByXPath('//input[@id="edit-translatable" and not(@disabled) and @checked="checked"]');
-    $this->assertNoText('To enable translation of this field, enable language support for this type.', 'Translatable setting for field available.');
+    $this->assertSession()->responseNotContains('To enable translation of this field, enable language support for this type.', 'Translatable setting for field available.');
   }
 
   /**
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUISkipTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUISkipTest.php
index 765a4bac6d..98dbb83c1b 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUISkipTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUISkipTest.php
@@ -37,8 +37,8 @@ public function testUICheckSkip() {
     $this->drupalGet('admin/config/regional/content-language');
 
     // Check the message regarding UI integration.
-    $this->assertText('Test entity - Translatable skip UI check');
-    $this->assertText('Test entity - Translatable check UI (Translation is not supported)');
+    $this->assertSession()->responseContains('Test entity - Translatable skip UI check');
+    $this->assertSession()->responseContains('Test entity - Translatable check UI (Translation is not supported)');
   }
 
 }
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
index 162c5d1f81..1d37d497f0 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
@@ -90,7 +90,7 @@ protected function doTestBasicTranslation() {
     $this->assertCacheContexts($this->defaultCacheContexts);
 
     $this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
-    $this->assertNoText('Source language', 'Source language column correctly hidden.');
+    $this->assertSession()->responseNotContains('Source language', 'Source language column correctly hidden.');
 
     $translation = $this->getTranslation($entity, $default_langcode);
     foreach ($values[$default_langcode] as $property => $value) {
@@ -162,7 +162,7 @@ protected function doTestBasicTranslation() {
     $storage->resetCache([$this->entityId]);
     $entity = $storage->load($this->entityId);
     $this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
-    $this->assertNoText('Source language', 'Source language column correctly hidden.');
+    $this->assertSession()->responseNotContains('Source language', 'Source language column correctly hidden.');
 
     // Switch the source language.
     $langcode = 'fr';
@@ -193,7 +193,7 @@ protected function doTestBasicTranslation() {
     $storage->resetCache([$this->entityId]);
     $entity = $storage->load($this->entityId);
     $this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
-    $this->assertText('Source language', 'Source language column correctly shown.');
+    $this->assertSession()->responseContains('Source language', 'Source language column correctly shown.');
 
     // Check that the entered values have been correctly stored.
     foreach ($values as $langcode => $property_values) {
diff --git a/core/modules/datetime/tests/src/Functional/DateFilterTest.php b/core/modules/datetime/tests/src/Functional/DateFilterTest.php
index 402cfbae2f..c284eb5ed6 100644
--- a/core/modules/datetime/tests/src/Functional/DateFilterTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateFilterTest.php
@@ -119,7 +119,7 @@ public function testLimitExposedOperators() {
     $edit['options[operator]'] = '=';
     $edit['options[expose][operator_list][]'] = ['<', '>'];
     $this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, t('Apply'));
-    $this->assertText('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
+    $this->assertSession()->responseContains('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
   }
 
 }
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 2c5ed0b3db..d5b6edef52 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -76,7 +76,7 @@ public function testDateField() {
       $this->drupalPostForm(NULL, $edit, t('Save'));
       preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
       $id = $match[1];
-      $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+      $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
       $this->assertRaw($date->format($date_format));
       $this->assertNoRaw($date->format($time_format));
 
@@ -271,7 +271,7 @@ public function testDatetimeField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
     $this->assertRaw($date->format($date_format));
     $this->assertRaw($date->format($time_format));
 
@@ -491,7 +491,7 @@ public function testDatelistWidget() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $this->assertOptionSelected("edit-$field_name-0-value-year", '2012', 'Correct year selected.');
     $this->assertOptionSelected("edit-$field_name-0-value-month", '12', 'Correct month selected.');
@@ -532,7 +532,7 @@ public function testDatelistWidget() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $this->assertOptionSelected("edit-$field_name-0-value-year", '2012', 'Correct year selected.');
     $this->assertOptionSelected("edit-$field_name-0-value-month", '12', 'Correct month selected.');
@@ -569,7 +569,7 @@ public function testDatelistWidget() {
       $this->drupalPostForm(NULL, $edit, t('Save'));
       $this->assertSession()->statusCodeEquals(200);
       foreach ($expected as $expected_text) {
-        $this->assertText(t($expected_text));
+        $this->assertSession()->responseContains(t($expected_text));
       }
     }
 
@@ -586,7 +586,7 @@ public function testDatelistWidget() {
     $this->assertSession()->statusCodeEquals(200);
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     // Test the widget to ensure zeros are not deselected on validation.
     $this->drupalGet('entity_test/add');
@@ -724,7 +724,7 @@ public function testDefaultValue() {
       ];
       $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings'));
 
-      $this->assertText('The relative date value entered is invalid.');
+      $this->assertSession()->responseContains('The relative date value entered is invalid.');
 
       // Set a relative default_value.
       $field_edit = [
@@ -803,7 +803,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', 'Empty date value has been caught.');
+    $this->assertSession()->responseContains('date is invalid', 'Empty date value has been caught.');
 
     $date_value = 'aaaa-12-01';
     $edit = [
@@ -811,7 +811,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => '00:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid year value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid year value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-75-01';
     $edit = [
@@ -819,7 +819,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => '00:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid month value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid month value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-12-99';
     $edit = [
@@ -827,7 +827,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => '00:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid day value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid day value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-12-01';
     $time_value = '';
@@ -836,7 +836,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', 'Empty time value has been caught.');
+    $this->assertSession()->responseContains('date is invalid', 'Empty time value has been caught.');
 
     $date_value = '2012-12-01';
     $time_value = '49:00:00';
@@ -845,7 +845,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid hour value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid hour value %time has been caught.', ['%time' => $time_value]));
 
     $date_value = '2012-12-01';
     $time_value = '12:99:00';
@@ -854,7 +854,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid minute value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid minute value %time has been caught.', ['%time' => $time_value]));
 
     $date_value = '2012-12-01';
     $time_value = '12:15:99';
@@ -863,7 +863,7 @@ public function testInvalidField() {
       "{$field_name}[0][value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid second value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid second value %time has been caught.', ['%time' => $time_value]));
   }
 
   /**
@@ -906,7 +906,7 @@ public function testDateStorageSettings() {
     $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
     $result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
     $this->assertCount(1, $result, "Changing datetime setting is disabled.");
-    $this->assertText('There is data for this field in the database. The field settings can no longer be changed.');
+    $this->assertSession()->responseContains('There is data for this field in the database. The field settings can no longer be changed.');
   }
 
 }
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index 10e48dbdbd..791b638cf7 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -92,7 +92,7 @@ public function testDateRangeField() {
       $this->drupalPostForm(NULL, $edit, t('Save'));
       preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
       $id = $match[1];
-      $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+      $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
       $this->assertRaw($start_date->format($date_format));
       $this->assertNoRaw($start_date->format($time_format));
       $this->assertRaw($end_date->format($date_format));
@@ -218,7 +218,7 @@ public function testDateRangeField() {
       $this->drupalPostForm(NULL, $edit, t('Save'));
       preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
       $id = $match[1];
-      $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+      $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
       $this->massageTestDate($start_date);
 
@@ -325,7 +325,7 @@ public function testDatetimeRangeField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
     $this->assertRaw($start_date->format($date_format));
     $this->assertRaw($start_date->format($time_format));
     $this->assertRaw($end_date->format($date_format));
@@ -410,7 +410,7 @@ public function testDatetimeRangeField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $this->displayOptions = [
       'type' => 'daterange_default',
@@ -498,7 +498,7 @@ public function testAlldayRangeField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
     $this->assertRaw($start_date->format($date_format));
     $this->assertNoRaw($start_date->format($time_format));
     $this->assertRaw($end_date->format($date_format));
@@ -582,7 +582,7 @@ public function testAlldayRangeField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $this->displayOptions = [
       'type' => 'daterange_default',
@@ -770,7 +770,7 @@ public function testDatelistWidget() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $this->assertOptionSelected("edit-$field_name-0-value-year", '2012', 'Correct year selected.');
     $this->assertOptionSelected("edit-$field_name-0-value-month", '12', 'Correct month selected.');
@@ -825,7 +825,7 @@ public function testDatelistWidget() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $this->assertOptionSelected("edit-$field_name-0-value-year", '2012', 'Correct year selected.');
     $this->assertOptionSelected("edit-$field_name-0-value-month", '12', 'Correct month selected.');
@@ -871,7 +871,7 @@ public function testDatelistWidget() {
       $this->drupalPostForm(NULL, $edit, t('Save'));
       $this->assertSession()->statusCodeEquals(200);
       foreach ($expected as $expected_text) {
-        $this->assertText(t($expected_text));
+        $this->assertSession()->responseContains(t($expected_text));
       }
     }
 
@@ -892,7 +892,7 @@ public function testDatelistWidget() {
     $this->assertSession()->statusCodeEquals(200);
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     // Test the widget to ensure zeros are not deselected on validation.
     $this->drupalGet('entity_test/add');
@@ -1055,7 +1055,7 @@ public function testDefaultValue() {
       'default_value_input[default_end_date]' => '+1 day',
     ];
     $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings'));
-    $this->assertText('The relative start date value entered is invalid.');
+    $this->assertSession()->responseContains('The relative start date value entered is invalid.');
 
     $field_edit = [
       'default_value_input[default_date_type]' => 'relative',
@@ -1064,7 +1064,7 @@ public function testDefaultValue() {
       'default_value_input[default_end_date]' => 'invalid date',
     ];
     $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings'));
-    $this->assertText('The relative end date value entered is invalid.');
+    $this->assertSession()->responseContains('The relative end date value entered is invalid.');
 
     // Set a relative default_value.
     $field_edit = [
@@ -1185,7 +1185,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', 'Empty start date value has been caught.');
+    $this->assertSession()->responseContains('date is invalid', 'Empty start date value has been caught.');
 
     $date_value = 'aaaa-12-01';
     $edit = [
@@ -1195,7 +1195,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid start year value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid start year value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-75-01';
     $edit = [
@@ -1205,7 +1205,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid start month value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid start month value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-12-99';
     $edit = [
@@ -1215,7 +1215,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid start day value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid start day value %date has been caught.', ['%date' => $date_value]));
 
     // Submit invalid start times and ensure they is not accepted.
     $time_value = '';
@@ -1226,7 +1226,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', 'Empty start time value has been caught.');
+    $this->assertSession()->responseContains('date is invalid', 'Empty start time value has been caught.');
 
     $time_value = '49:00:00';
     $edit = [
@@ -1236,7 +1236,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid start hour value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid start hour value %time has been caught.', ['%time' => $time_value]));
 
     $time_value = '12:99:00';
     $edit = [
@@ -1246,7 +1246,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid start minute value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid start minute value %time has been caught.', ['%time' => $time_value]));
 
     $time_value = '12:15:99';
     $edit = [
@@ -1256,7 +1256,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid start second value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid start second value %time has been caught.', ['%time' => $time_value]));
 
     // Submit invalid end dates and ensure they is not accepted.
     $date_value = '';
@@ -1267,7 +1267,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', 'Empty end date value has been caught.');
+    $this->assertSession()->responseContains('date is invalid', 'Empty end date value has been caught.');
 
     $date_value = 'aaaa-12-01';
     $edit = [
@@ -1277,7 +1277,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '00:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid end year value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid end year value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-75-01';
     $edit = [
@@ -1287,7 +1287,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '00:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid end month value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid end month value %date has been caught.', ['%date' => $date_value]));
 
     $date_value = '2012-12-99';
     $edit = [
@@ -1297,7 +1297,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '00:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid end day value %date has been caught.', ['%date' => $date_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid end day value %date has been caught.', ['%date' => $date_value]));
 
     // Submit invalid start times and ensure they is not accepted.
     $time_value = '';
@@ -1308,7 +1308,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', 'Empty end time value has been caught.');
+    $this->assertSession()->responseContains('date is invalid', 'Empty end time value has been caught.');
 
     $time_value = '49:00:00';
     $edit = [
@@ -1318,7 +1318,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid end hour value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid end hour value %time has been caught.', ['%time' => $time_value]));
 
     $time_value = '12:99:00';
     $edit = [
@@ -1328,7 +1328,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid end minute value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid end minute value %time has been caught.', ['%time' => $time_value]));
 
     $time_value = '12:15:99';
     $edit = [
@@ -1338,7 +1338,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => $time_value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('date is invalid', new FormattableMarkup('Invalid end second value %time has been caught.', ['%time' => $time_value]));
+    $this->assertSession()->responseContains('date is invalid', new FormattableMarkup('Invalid end second value %time has been caught.', ['%time' => $time_value]));
 
     $edit = [
       "{$field_name}[0][value][date]" => '2012-12-01',
@@ -1347,7 +1347,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '12:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End date before start date has been caught.');
+    $this->assertSession()->responseContains(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End date before start date has been caught.');
 
     $edit = [
       "{$field_name}[0][value][date]" => '2012-12-01',
@@ -1356,7 +1356,7 @@ public function testInvalidField() {
       "{$field_name}[0][end_value][time]" => '11:00:00',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End time before start time has been caught.');
+    $this->assertSession()->responseContains(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End time before start time has been caught.');
   }
 
   /**
@@ -1400,7 +1400,7 @@ public function testDateStorageSettings() {
     $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
     $result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
     $this->assertCount(1, $result, "Changing datetime setting is disabled.");
-    $this->assertText('There is data for this field in the database. The field settings can no longer be changed.');
+    $this->assertSession()->responseContains('There is data for this field in the database. The field settings can no longer be changed.');
   }
 
 }
diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php
index c8ebd31f59..b23e78be61 100644
--- a/core/modules/dblog/tests/src/Functional/DbLogTest.php
+++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php
@@ -132,7 +132,7 @@ public function testLogEventPage() {
     $this->assertRaw($context['request_uri'], 'Found location on the detail page.');
 
     // Verify severity.
-    $this->assertText('Notice', 'The severity was properly displayed on the detail page.');
+    $this->assertSession()->responseContains('Notice', 'The severity was properly displayed on the detail page.');
   }
 
   /**
@@ -207,10 +207,10 @@ public function testLogEventPageWithMissingInfo() {
     $this->drupalGet('admin/reports/dblog/event/' . $wid);
 
     // Verify table headers are present, even though the referrer is missing.
-    $this->assertText('Referrer', 'Referrer header is present on the detail page.');
+    $this->assertSession()->responseContains('Referrer', 'Referrer header is present on the detail page.');
 
     // Verify severity.
-    $this->assertText('Notice', 'The severity is properly displayed on the detail page.');
+    $this->assertSession()->responseContains('Notice', 'The severity is properly displayed on the detail page.');
 
     // Test log event page with incorrect location.
     $request_uri = '/some/incorrect/url';
@@ -221,10 +221,10 @@ public function testLogEventPageWithMissingInfo() {
     $this->drupalGet('admin/reports/dblog/event/' . $wid);
 
     // Verify table headers are present.
-    $this->assertText('Location', 'Location header is present on the detail page.');
+    $this->assertSession()->responseContains('Location', 'Location header is present on the detail page.');
 
     // Verify severity.
-    $this->assertText('Notice', 'The severity is properly displayed on the detail page.');
+    $this->assertSession()->responseContains('Notice', 'The severity is properly displayed on the detail page.');
 
     // Verify location is available as plain text.
     $this->assertEquals($request_uri, $this->cssSelect('table.dblog-event > tbody > tr:nth-child(4) > td')[0]->getHtml());
@@ -286,34 +286,34 @@ private function verifyReports($response = 200) {
     $this->drupalGet('admin/help/dblog');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Database Logging'), 'DBLog help was displayed');
+      $this->assertSession()->responseContains(t('Database Logging'), 'DBLog help was displayed');
     }
 
     // View the database log report page.
     $this->drupalGet('admin/reports/dblog');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Recent log messages'), 'DBLog report was displayed');
+      $this->assertSession()->responseContains(t('Recent log messages'), 'DBLog report was displayed');
     }
 
     $this->drupalGet('admin/reports/dblog/confirm');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Are you sure you want to delete the recent logs?'), 'DBLog clear logs form was displayed');
+      $this->assertSession()->responseContains(t('Are you sure you want to delete the recent logs?'), 'DBLog clear logs form was displayed');
     }
 
     // View the database log page-not-found report page.
     $this->drupalGet('admin/reports/page-not-found');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText("Top 'page not found' errors", 'DBLog page-not-found report was displayed');
+      $this->assertSession()->responseContains("Top 'page not found' errors", 'DBLog page-not-found report was displayed');
     }
 
     // View the database log access-denied report page.
     $this->drupalGet('admin/reports/access-denied');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText("Top 'access denied' errors", 'DBLog access-denied report was displayed');
+      $this->assertSession()->responseContains("Top 'access denied' errors", 'DBLog access-denied report was displayed');
     }
 
     // View the database log event page.
@@ -321,7 +321,7 @@ private function verifyReports($response = 200) {
     $this->drupalGet('admin/reports/dblog/event/' . $wid);
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Details'), 'DBLog event node was displayed');
+      $this->assertSession()->responseContains(t('Details'), 'DBLog event node was displayed');
     }
   }
 
@@ -364,7 +364,7 @@ private function verifyEvents() {
   public function verifySort($sort = 'asc', $order = 'Date') {
     $this->drupalGet('admin/reports/dblog', ['query' => ['sort' => $sort, 'order' => $order]]);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Recent log messages'), 'DBLog report was displayed correctly and sorting went fine.');
+    $this->assertSession()->responseContains(t('Recent log messages'), 'DBLog report was displayed correctly and sorting went fine.');
   }
 
   /**
@@ -464,7 +464,7 @@ private function doUser() {
     $this->drupalGet('admin/reports/page-not-found');
     $this->assertSession()->statusCodeEquals(200);
     // Check that full-length URL displayed.
-    $this->assertText($not_found_url, 'DBLog event was recorded: [page not found]');
+    $this->assertSession()->responseContains($not_found_url, 'DBLog event was recorded: [page not found]');
   }
 
   /**
@@ -521,13 +521,13 @@ private function doNode($type) {
     $this->drupalGet('admin/reports/access-denied');
     $this->assertSession()->statusCodeEquals(200);
     // Verify that the 'access denied' event was recorded.
-    $this->assertText('admin/reports/dblog', 'DBLog event was recorded: [access denied]');
+    $this->assertSession()->responseContains('admin/reports/dblog', 'DBLog event was recorded: [access denied]');
 
     // View the database log page-not-found report page.
     $this->drupalGet('admin/reports/page-not-found');
     $this->assertSession()->statusCodeEquals(200);
     // Verify that the 'page not found' event was recorded.
-    $this->assertText('node/' . $node->id(), 'DBLog event was recorded: [page not found]');
+    $this->assertSession()->responseContains('node/' . $node->id(), 'DBLog event was recorded: [page not found]');
   }
 
   /**
@@ -678,13 +678,13 @@ public function testFilter() {
 
     $this->drupalGet('admin/reports/dblog', ['query' => ['order' => 'Type']]);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Operations'), 'Operations text found');
+    $this->assertSession()->responseContains(t('Operations'), 'Operations text found');
 
     // Clear all logs and make sure the confirmation message is found.
     $this->clearLogsEntries();
     // Confirm that the logs should be cleared.
     $this->drupalPostForm(NULL, [], 'Confirm');
-    $this->assertText(t('Database log cleared.'), 'Confirmation message found');
+    $this->assertSession()->responseContains(t('Database log cleared.'), 'Confirmation message found');
   }
 
   /**
@@ -802,7 +802,7 @@ public function testTemporaryUser() {
 
     // Check if the full message displays on the details page.
     $this->drupalGet('admin/reports/dblog/event/' . $wid);
-    $this->assertText('Dblog test log message');
+    $this->assertSession()->responseContains('Dblog test log message');
 
     // Delete the user.
     $tempuser->delete();
@@ -811,7 +811,7 @@ public function testTemporaryUser() {
 
     // Check if the full message displays on the details page.
     $this->drupalGet('admin/reports/dblog/event/' . $wid);
-    $this->assertText('Dblog test log message');
+    $this->assertSession()->responseContains('Dblog test log message');
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
index b34504e955..f12775dac2 100644
--- a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
+++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
@@ -107,7 +107,7 @@ public function testBooleanField() {
     // Display creation form.
     $this->drupalGet('entity_test/add');
     $this->assertFieldByName("{$field_name}[value]", '', 'Widget found.');
-    $this->assertText($this->field->label(), 'Uses field label by default.');
+    $this->assertSession()->responseContains($this->field->label(), 'Uses field label by default.');
     $this->assertNoRaw($on, 'Does not use the "On" label.');
 
     // Submit and ensure it is accepted.
@@ -117,7 +117,7 @@ public function testBooleanField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     // Verify that boolean value is displayed.
     $entity = EntityTest::load($id);
@@ -137,7 +137,7 @@ public function testBooleanField() {
     $this->drupalGet('entity_test/add');
     $this->assertFieldByName("{$field_name}[value]", '', 'Widget found.');
     $this->assertRaw($on);
-    $this->assertNoText($this->field->label());
+    $this->assertSession()->responseNotContains($this->field->label());
 
     // Test if we can change the on label.
     $on = $this->randomMachineName();
@@ -157,7 +157,7 @@ public function testBooleanField() {
     // Click on the widget settings button to open the widget settings form.
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'Use field label instead of the "On" label as the label.',
       t('Display setting checkbox available.')
     );
@@ -170,10 +170,10 @@ public function testBooleanField() {
     // Go again to the form display page and check if the setting
     // is stored and has the expected effect.
     $this->drupalGet($fieldEditUrl);
-    $this->assertText('Use field label: Yes', 'Checking the display settings checkbox updated the value.');
+    $this->assertSession()->responseContains('Use field label: Yes', 'Checking the display settings checkbox updated the value.');
 
     $this->drupalPostForm(NULL, [], $field_name . "_settings_edit");
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'Use field label instead of the "On" label as the label.',
       t('Display setting checkbox is available')
     );
@@ -236,7 +236,7 @@ public function testFormAccess() {
     $this->drupalPostForm(NULL, [], t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     // Tell the test module to disable access to the field.
     \Drupal::state()->set('field.test_boolean_field_access_field', $field_name);
@@ -247,7 +247,7 @@ public function testFormAccess() {
     $this->drupalPostForm(NULL, [], t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
   }
 
 }
diff --git a/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php b/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php
index 11b6342633..31e46d0a01 100644
--- a/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php
+++ b/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php
@@ -100,7 +100,7 @@ public function testEmailField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
     $this->assertRaw($value);
 
     // Verify that a mailto link is displayed.
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
index 124fe9d7b6..6f327c8dc6 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
@@ -172,7 +172,7 @@ public function testFieldAdminHandler() {
     $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
 
     // Assert that entity reference autocomplete field is validated.
-    $this->assertText(t('There are no entities matching "@entity"', ['@entity' => 'Test']));
+    $this->assertSession()->responseContains(t('There are no entities matching "@entity"', ['@entity' => 'Test']));
 
     $edit = [
       'title[0][value]' => 'Test',
@@ -182,10 +182,10 @@ public function testFieldAdminHandler() {
 
     // Assert the results multiple times to avoid sorting problem of nodes with
     // the same title.
-    $this->assertText(t('Multiple entities match this reference;'));
-    $this->assertText(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')']));
-    $this->assertText(t("@node2", ['@node2' => $node2->getTitle() . ' (' . $node2->id() . ')']));
-    $this->assertText(t('Specify the one you want by appending the id in parentheses, like "@example".', ['@example' => $node2->getTitle() . ' (' . $node2->id() . ')']));
+    $this->assertSession()->responseContains(t('Multiple entities match this reference;'));
+    $this->assertSession()->responseContains(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')']));
+    $this->assertSession()->responseContains(t("@node2", ['@node2' => $node2->getTitle() . ' (' . $node2->id() . ')']));
+    $this->assertSession()->responseContains(t('Specify the one you want by appending the id in parentheses, like "@example".', ['@example' => $node2->getTitle() . ' (' . $node2->id() . ')']));
 
     $edit = [
       'title[0][value]' => 'Test',
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php
index a962aa92e3..b5e8a59a2c 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php
@@ -140,8 +140,8 @@ public function testAutoCreate() {
 
     // Now try to view the node and check that the referenced node is shown.
     $this->drupalGet('node/' . $referencing_node->id());
-    $this->assertText($referencing_node->label(), 'Referencing node label found.');
-    $this->assertText($referenced_node->label(), 'Referenced node label found.');
+    $this->assertSession()->responseContains($referencing_node->label(), 'Referencing node label found.');
+    $this->assertSession()->responseContains($referenced_node->label(), 'Referenced node label found.');
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
index 404d672fd4..4f23ca90cf 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
@@ -178,13 +178,13 @@ protected function assertEntityReferenceDisplay() {
     $translation_url = $this->referrerEntity->toUrl('canonical', ['language' => ConfigurableLanguage::load($this->translateToLangcode)]);
 
     $this->drupalGet($url);
-    $this->assertText($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
-    $this->assertText($this->originalLabel, 'The default label of translated reference is displayed.');
-    $this->assertNoText($this->translatedLabel, 'The translated label of translated reference is not displayed.');
+    $this->assertSession()->responseContains($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
+    $this->assertSession()->responseContains($this->originalLabel, 'The default label of translated reference is displayed.');
+    $this->assertSession()->responseNotContains($this->translatedLabel, 'The translated label of translated reference is not displayed.');
     $this->drupalGet($translation_url);
-    $this->assertText($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
-    $this->assertNoText($this->originalLabel, 'The default label of translated reference is not displayed.');
-    $this->assertText($this->translatedLabel, 'The translated label of translated reference is displayed.');
+    $this->assertSession()->responseContains($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
+    $this->assertSession()->responseNotContains($this->originalLabel, 'The default label of translated reference is not displayed.');
+    $this->assertSession()->responseContains($this->translatedLabel, 'The translated label of translated reference is displayed.');
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php
index 15529854dd..aa18684f19 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php
@@ -77,7 +77,7 @@ public function testEntityReferenceXSS() {
     $this->drupalGet('node/add/article');
     $this->assertEscaped($referenced_node->getTitle());
     // options_buttons does not support optgroups.
-    $this->assertNoText('bundle with markup');
+    $this->assertSession()->responseNotContains('bundle with markup');
   }
 
 }
diff --git a/core/modules/field/tests/src/Functional/FieldAccessTest.php b/core/modules/field/tests/src/Functional/FieldAccessTest.php
index 4070f6eb39..cd26490dad 100644
--- a/core/modules/field/tests/src/Functional/FieldAccessTest.php
+++ b/core/modules/field/tests/src/Functional/FieldAccessTest.php
@@ -85,14 +85,14 @@ public function testFieldAccess() {
 
     // Assert the text is visible.
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($this->testViewFieldValue);
+    $this->assertSession()->responseContains($this->testViewFieldValue);
 
     // Assert the text is not visible for anonymous users.
     // The field_test module implements hook_entity_field_access() which will
     // specifically target the 'test_view_field' field.
     $this->drupalLogout();
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertNoText($this->testViewFieldValue);
+    $this->assertSession()->responseNotContains($this->testViewFieldValue);
   }
 
 }
diff --git a/core/modules/field/tests/src/Functional/FieldHelpTest.php b/core/modules/field/tests/src/Functional/FieldHelpTest.php
index 7ed4bfb6bd..5392cd939e 100644
--- a/core/modules/field/tests/src/Functional/FieldHelpTest.php
+++ b/core/modules/field/tests/src/Functional/FieldHelpTest.php
@@ -56,7 +56,7 @@ public function testFieldHelp() {
 
     $this->drupalGet('admin/help/field');
     $this->assertLink('Options', 0, 'Options module is listed on the Field help page.');
-    $this->assertText('Field API Test', 'Modules with field types that do not implement hook_help are listed.');
+    $this->assertSession()->responseContains('Field API Test', 'Modules with field types that do not implement hook_help are listed.');
     $this->assertNoLink('Field API Test', 'Modules with field types that do not implement hook_help are not linked.');
     $this->assertNoLink('Link', 'Modules that have not been installed, are not listed.');
   }
diff --git a/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php b/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php
index d1c7647aab..99aee4b92d 100644
--- a/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php
+++ b/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php
@@ -104,7 +104,7 @@ public function testImportDeleteUninstall() {
     $this->drupalGet('admin/config/development/configuration');
     // Test that the message for one field being purged during a configuration
     // synchronization is correct.
-    $this->assertText('This synchronization will delete data from the field entity_test.field_tel.');
+    $this->assertSession()->responseContains('This synchronization will delete data from the field entity_test.field_tel.');
 
     // Stage an uninstall of the datetime module to test the message for
     // multiple fields.
@@ -112,12 +112,12 @@ public function testImportDeleteUninstall() {
     $sync->write('core.extension', $core_extension);
 
     $this->drupalGet('admin/config/development/configuration');
-    $this->assertText('This synchronization will delete data from the fields: entity_test.field_tel, entity_test.field_date.');
+    $this->assertSession()->responseContains('This synchronization will delete data from the fields: entity_test.field_tel, entity_test.field_date.');
 
     // This will purge all the data, delete the field and uninstall the
     // Telephone and Text modules.
     $this->drupalPostForm(NULL, [], t('Import all'));
-    $this->assertNoText('Field data will be deleted by this synchronization.');
+    $this->assertSession()->responseNotContains('Field data will be deleted by this synchronization.');
     $this->rebuildContainer();
     $this->assertFalse(\Drupal::moduleHandler()->moduleExists('telephone'));
     $this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config', $field_storage->uuid()), 'The telephone field has been deleted by the configuration synchronization');
diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php
index dba8c35a69..af37beab53 100644
--- a/core/modules/field/tests/src/Functional/FormTest.php
+++ b/core/modules/field/tests/src/Functional/FormTest.php
@@ -118,16 +118,16 @@ public function testFieldFormSingle() {
 
     // Create token value expected for description.
     $token_description = Html::escape($this->config('system.site')->get('name')) . '_description';
-    $this->assertText($token_description, 'Token replacement for description is displayed');
+    $this->assertSession()->responseContains($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');
 
     // Check that hook_field_widget_form_alter() does not believe this is the
     // default value form.
-    $this->assertNoText('From hook_field_widget_form_alter(): Default form is true.', 'Not default value form in hook_field_widget_form_alter().');
+    $this->assertSession()->responseNotContains('From hook_field_widget_form_alter(): Default form is true.', 'Not default value form in hook_field_widget_form_alter().');
     // Check that hook_field_widget_form_alter() does not believe this is the
     // default value form.
-    $this->assertNoText('From hook_field_widget_multivalue_form_alter(): Default form is true.', 'Not default value form in hook_field_widget_form_alter().');
+    $this->assertSession()->responseNotContains('From hook_field_widget_multivalue_form_alter(): Default form is true.', 'Not default value form in hook_field_widget_form_alter().');
 
     // Submit with invalid value (field-level validation).
     $edit = [
@@ -145,7 +145,7 @@ public function testFieldFormSingle() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
     $entity = EntityTest::load($id);
     $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved');
 
@@ -160,7 +160,7 @@ public function testFieldFormSingle() {
       "{$field_name}[0][value]" => $value,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
+    $this->assertSession()->responseContains(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
     $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
     $entity = EntityTest::load($id);
     $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated');
@@ -171,7 +171,7 @@ public function testFieldFormSingle() {
       "{$field_name}[0][value]" => $value,
     ];
     $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save'));
-    $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
+    $this->assertSession()->responseContains(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
     $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
     $entity = EntityTest::load($id);
     $this->assertTrue($entity->{$field_name}->isEmpty(), 'Field was emptied');
@@ -205,7 +205,7 @@ public function testFieldFormDefaultValue() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created.');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created.');
     $entity = EntityTest::load($id);
     $this->assertTrue($entity->{$field_name}->isEmpty(), 'Field is now empty.');
   }
@@ -235,7 +235,7 @@ public function testFieldFormSingleRequired() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
     $entity = EntityTest::load($id);
     $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved');
 
@@ -317,7 +317,7 @@ public function testFieldFormUnlimited() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
     $entity = EntityTest::load($id);
     ksort($field_values);
     $field_values = array_values($field_values);
@@ -589,7 +589,7 @@ public function testHiddenField() {
     $this->drupalPostForm(NULL, [], t('Save'));
     preg_match('|' . $entity_type . '/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test_rev @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test_rev @id has been created.', ['@id' => $id]), 'Entity was created');
     $storage = $this->container->get('entity_type.manager')
       ->getStorage($entity_type);
 
@@ -615,7 +615,7 @@ public function testHiddenField() {
     $value = mt_rand(1, 127);
     $edit = ["{$field_name}[0][value]" => $value];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('entity_test_rev @id has been updated.', ['@id' => $id]), 'Entity was updated');
+    $this->assertSession()->responseContains(t('entity_test_rev @id has been updated.', ['@id' => $id]), 'Entity was updated');
     $storage->resetCache([$id]);
     $entity = $storage->load($id);
     $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated');
@@ -667,7 +667,7 @@ public function testLabelOnMultiValueFields() {
 
     $this->drupalGet('entity_test_base_field_display/manage/' . $entity->id());
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('A field with multiple values');
+    $this->assertSession()->responseContains('A field with multiple values');
     // Test if labels were XSS filtered.
     $this->assertEscaped("<script>alert('a configurable field');</script>");
   }
diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php
index e4e9358c71..144f142579 100644
--- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php
+++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php
@@ -86,7 +86,7 @@ public function testNumberDecimalField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
     $this->assertRaw($value, 'Value is displayed.');
 
     // Try to create entries with more than one decimal separator; assert fail.
@@ -201,7 +201,7 @@ public function testNumberIntegerField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
 
     // Try to set a value below the minimum value
     $this->drupalGet('entity_test/add');
@@ -250,7 +250,7 @@ public function testNumberIntegerField() {
       $this->drupalPostForm(NULL, $edit, t('Save'));
       preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
       $id = $match[1];
-      $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+      $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
       $this->assertRaw($valid_entry, 'Value is displayed.');
       $this->assertNoFieldByXpath('//div[@content="' . $valid_entry . '"]', NULL, 'The "content" attribute is not present since the Prefix is not being displayed');
     }
@@ -272,7 +272,7 @@ public function testNumberIntegerField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
     $this->drupalGet('entity_test/' . $id);
     $this->assertFieldByXPath('//div[@content="' . $integer_value . '"]', 'ThePrefix' . $integer_value, 'The "content" attribute has been set to the value of the field, and the prefix is being displayed.');
   }
@@ -326,7 +326,7 @@ public function testNumberFloatField() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
 
     // Ensure that the 'number_decimal' formatter displays the number with the
     // expected rounding.
diff --git a/core/modules/field/tests/src/Functional/String/StringFieldTest.php b/core/modules/field/tests/src/Functional/String/StringFieldTest.php
index 15c0f43644..c20db2cea5 100644
--- a/core/modules/field/tests/src/Functional/String/StringFieldTest.php
+++ b/core/modules/field/tests/src/Functional/String/StringFieldTest.php
@@ -98,7 +98,7 @@ public function _testTextfieldWidgets($field_type, $widget_type) {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
 
     // Display the entity.
     $entity = EntityTest::load($id);
diff --git a/core/modules/field/tests/src/Functional/reEnableModuleFieldTest.php b/core/modules/field/tests/src/Functional/reEnableModuleFieldTest.php
index 51f2523225..73b12add24 100644
--- a/core/modules/field/tests/src/Functional/reEnableModuleFieldTest.php
+++ b/core/modules/field/tests/src/Functional/reEnableModuleFieldTest.php
@@ -99,7 +99,7 @@ public function testReEnabledField() {
     $admin_user = $this->drupalCreateUser(['access administration pages', 'administer modules']);
     $this->drupalLogin($admin_user);
     $this->drupalGet('admin/modules/uninstall');
-    $this->assertText("The Telephone number field type is used in the following field: node.field_telephone");
+    $this->assertSession()->responseContains("The Telephone number field type is used in the following field: node.field_telephone");
 
     // Add another telephone field to a different entity type in order to test
     // the message for the case when multiple fields are blocking the
@@ -117,17 +117,17 @@ public function testReEnabledField() {
     ])->save();
 
     $this->drupalGet('admin/modules/uninstall');
-    $this->assertText("The Telephone number field type is used in the following fields: node.field_telephone, user.field_telephone_2");
+    $this->assertSession()->responseContains("The Telephone number field type is used in the following fields: node.field_telephone, user.field_telephone_2");
 
     // Delete both fields.
     $field_storage->delete();
     $field_storage2->delete();
 
     $this->drupalGet('admin/modules/uninstall');
-    $this->assertText('Fields pending deletion');
+    $this->assertSession()->responseContains('Fields pending deletion');
     $this->cronRun();
-    $this->assertNoText("The Telephone number field type is used in the following field: node.field_telephone");
-    $this->assertNoText('Fields pending deletion');
+    $this->assertSession()->responseNotContains("The Telephone number field type is used in the following field: node.field_telephone");
+    $this->assertSession()->responseNotContains('Fields pending deletion');
   }
 
 }
diff --git a/core/modules/field/tests/src/Kernel/DisplayApiTest.php b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
index b1fc135308..01e5187a43 100644
--- a/core/modules/field/tests/src/Kernel/DisplayApiTest.php
+++ b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
@@ -134,9 +134,9 @@ public function testFieldItemListView() {
     $this->render($build);
     $settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('field_test_default');
     $setting = $settings['test_formatter_setting'];
-    $this->assertText($this->label, 'Label was displayed.');
+    $this->assertSession()->responseContains($this->label, 'Label was displayed.');
     foreach ($this->values as $delta => $value) {
-      $this->assertText($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // Display settings: Check hidden field.
@@ -151,14 +151,14 @@ public function testFieldItemListView() {
     $build = $items->view($display);
     $this->render($build);
     $setting = $display['settings']['test_formatter_setting_multiple'];
-    $this->assertNoText($this->label, 'Label was not displayed.');
-    $this->assertText('field_test_entity_display_build_alter', 'Alter fired, display passed.');
-    $this->assertText('entity language is en', 'Language is placed onto the context.');
+    $this->assertSession()->responseNotContains($this->label, 'Label was not displayed.');
+    $this->assertSession()->responseContains('field_test_entity_display_build_alter', 'Alter fired, display passed.');
+    $this->assertSession()->responseContains('entity language is en', 'Language is placed onto the context.');
     $array = [];
     foreach ($this->values as $delta => $value) {
       $array[] = $delta . ':' . $value['value'];
     }
-    $this->assertText($setting . '|' . implode('|', $array), 'Values were displayed with expected setting.');
+    $this->assertSession()->responseContains($setting . '|' . implode('|', $array), 'Values were displayed with expected setting.');
 
     // Display settings: Check visually_hidden field.
     $display = [
@@ -173,13 +173,13 @@ public function testFieldItemListView() {
     $this->render($build);
     $setting = $display['settings']['test_formatter_setting_multiple'];
     $this->assertRaw('visually-hidden', 'Label was visually hidden.');
-    $this->assertText('field_test_entity_display_build_alter', 'Alter fired, display passed.');
-    $this->assertText('entity language is en', 'Language is placed onto the context.');
+    $this->assertSession()->responseContains('field_test_entity_display_build_alter', 'Alter fired, display passed.');
+    $this->assertSession()->responseContains('entity language is en', 'Language is placed onto the context.');
     $array = [];
     foreach ($this->values as $delta => $value) {
       $array[] = $delta . ':' . $value['value'];
     }
-    $this->assertText($setting . '|' . implode('|', $array), 'Values were displayed with expected setting.');
+    $this->assertSession()->responseContains($setting . '|' . implode('|', $array), 'Values were displayed with expected setting.');
 
     // Check the prepare_view steps are invoked.
     $display = [
@@ -192,10 +192,10 @@ public function testFieldItemListView() {
     $build = $items->view($display);
     $this->render($build);
     $setting = $display['settings']['test_formatter_setting_additional'];
-    $this->assertNoText($this->label, 'Label was not displayed.');
-    $this->assertNoText('field_test_entity_display_build_alter', 'Alter not fired.');
+    $this->assertSession()->responseNotContains($this->label, 'Label was not displayed.');
+    $this->assertSession()->responseNotContains('field_test_entity_display_build_alter', 'Alter not fired.');
     foreach ($this->values as $delta => $value) {
-      $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // View mode: check that display settings specified in the display object
@@ -203,9 +203,9 @@ public function testFieldItemListView() {
     $build = $items->view('teaser');
     $this->render($build);
     $setting = $this->displayOptions['teaser']['settings']['test_formatter_setting'];
-    $this->assertText($this->label, 'Label was displayed.');
+    $this->assertSession()->responseContains($this->label, 'Label was displayed.');
     foreach ($this->values as $delta => $value) {
-      $this->assertText($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // Unknown view mode: check that display settings for 'default' view mode
@@ -213,9 +213,9 @@ public function testFieldItemListView() {
     $build = $items->view('unknown_view_mode');
     $this->render($build);
     $setting = $this->displayOptions['default']['settings']['test_formatter_setting'];
-    $this->assertText($this->label, 'Label was displayed.');
+    $this->assertSession()->responseContains($this->label, 'Label was displayed.');
     foreach ($this->values as $delta => $value) {
-      $this->assertText($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
   }
 
@@ -230,7 +230,7 @@ public function testFieldItemView() {
       $item = $this->entity->{$this->fieldName}[$delta];
       $build = $item->view();
       $this->render($build);
-      $this->assertText($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // Check that explicit display settings are used.
@@ -245,7 +245,7 @@ public function testFieldItemView() {
       $item = $this->entity->{$this->fieldName}[$delta];
       $build = $item->view($display);
       $this->render($build);
-      $this->assertText($setting . '|0:' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|0:' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // Check that prepare_view steps are invoked.
@@ -260,7 +260,7 @@ public function testFieldItemView() {
       $item = $this->entity->{$this->fieldName}[$delta];
       $build = $item->view($display);
       $this->render($build);
-      $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // View mode: check that display settings specified in the field are used.
@@ -269,7 +269,7 @@ public function testFieldItemView() {
       $item = $this->entity->{$this->fieldName}[$delta];
       $build = $item->view('teaser');
       $this->render($build);
-      $this->assertText($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
 
     // Unknown view mode: check that display settings for 'default' view mode
@@ -279,7 +279,7 @@ public function testFieldItemView() {
       $item = $this->entity->{$this->fieldName}[$delta];
       $build = $item->view('unknown_view_mode');
       $this->render($build);
-      $this->assertText($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
+      $this->assertSession()->responseContains($setting . '|' . $value['value'], new FormattableMarkup('Value @delta was displayed with expected setting.', ['@delta' => $delta]));
     }
   }
 
@@ -301,7 +301,7 @@ public function testFieldEmpty() {
     $this->render($build);
     // The test field by default contains values, so should not display the
     // default "empty" text.
-    $this->assertNoText($display['settings']['test_empty_string']);
+    $this->assertSession()->responseNotContains($display['settings']['test_empty_string']);
 
     // Now remove the values from the test field and retest.
     $this->entity->{$this->fieldName} = [];
@@ -310,7 +310,7 @@ public function testFieldEmpty() {
     $this->render($build);
     // This time, as the field values have been removed, we *should* show the
     // default "empty" text.
-    $this->assertText($display['settings']['test_empty_string']);
+    $this->assertSession()->responseContains($display['settings']['test_empty_string']);
   }
 
 }
diff --git a/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php b/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php
index 9b37084ed4..5bd1b98e9e 100644
--- a/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php
+++ b/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php
@@ -52,7 +52,7 @@ public function testEntityViewModeUI() {
     $this->drupalLogin($this->drupalCreateUser(['administer display modes']));
     $this->drupalGet('admin/structure/display-modes/view');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Add view mode'));
+    $this->assertSession()->responseContains(t('Add view mode'));
     $this->assertLinkByHref('admin/structure/display-modes/view/add');
     $this->assertLinkByHref('admin/structure/display-modes/view/add/entity_test');
 
@@ -107,7 +107,7 @@ public function testEntityFormModeUI() {
     $this->drupalLogin($this->drupalCreateUser(['administer display modes']));
     $this->drupalGet('admin/structure/display-modes/form');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Add form mode'));
+    $this->assertSession()->responseContains(t('Add form mode'));
     $this->assertLinkByHref('admin/structure/display-modes/form/add');
 
     $this->drupalGet('admin/structure/display-modes/form/add/entity_test_no_label');
diff --git a/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php b/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php
index 6e86f54c0f..66e8840c62 100644
--- a/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php
+++ b/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php
@@ -97,9 +97,9 @@ public function testDeleteField() {
     // Check the config dependencies of the first field, the field storage must
     // not be shown as being deleted yet.
     $this->drupalGet("$bundle_path1/fields/node.$type_name1.$field_name/delete");
-    $this->assertNoText(t('The listed configuration will be deleted.'));
-    $this->assertNoText(t('View'));
-    $this->assertNoText('test_view_field_delete');
+    $this->assertSession()->responseNotContains(t('The listed configuration will be deleted.'));
+    $this->assertSession()->responseNotContains(t('View'));
+    $this->assertSession()->responseNotContains('test_view_field_delete');
 
     // Delete the first field.
     $this->fieldUIDeleteField($bundle_path1, "node.$type_name1.$field_name", $field_label, $type_name1);
@@ -111,9 +111,9 @@ public function testDeleteField() {
 
     // Check the config dependencies of the first field.
     $this->drupalGet("$bundle_path2/fields/node.$type_name2.$field_name/delete");
-    $this->assertText(t('The listed configuration will be updated.'));
-    $this->assertText(t('View'));
-    $this->assertText('test_view_field_delete');
+    $this->assertSession()->responseContains(t('The listed configuration will be updated.'));
+    $this->assertSession()->responseContains(t('View'));
+    $this->assertSession()->responseContains('test_view_field_delete');
 
     $xml = $this->cssSelect('#edit-entity-deletes');
     // Test that nothing is scheduled for deletion.
diff --git a/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php b/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php
index 49ab321cd3..d35eb40361 100644
--- a/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php
+++ b/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php
@@ -40,7 +40,7 @@ protected function setUp(): void {
    */
   public function testFieldUIRoutes() {
     $this->drupalGet('entity_test_no_id/structure/entity_test/fields');
-    $this->assertText('No fields are present yet.');
+    $this->assertSession()->responseContains('No fields are present yet.');
 
     $this->drupalGet('admin/config/people/accounts/fields');
     $this->assertTitle('Manage fields | Drupal');
diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php
index de9a910f8c..ac8c92e7b0 100644
--- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php
@@ -175,7 +175,7 @@ public function testNonInitializedFields() {
    */
   public function testSingleViewMode() {
     $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/display');
-    $this->assertNoText('Use custom display settings for the following view modes', 'Custom display settings fieldset found.');
+    $this->assertSession()->responseNotContains('Use custom display settings for the following view modes', 'Custom display settings fieldset found.');
 
     // This may not trigger a notice when 'view_modes_custom' isn't available.
     $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display', [], t('Save'));
diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
index 902857a001..a78d2567de 100644
--- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
+++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
@@ -218,7 +218,7 @@ public function updateField() {
     $edit = [
       'settings[test_field_setting]' => $string,
     ];
-    $this->assertText(t('Default value'), 'Default value heading is shown');
+    $this->assertSession()->responseContains(t('Default value'), 'Default value heading is shown');
     $this->drupalPostForm(NULL, $edit, t('Save settings'));
 
     // Assert the field settings are correct.
@@ -262,7 +262,7 @@ public function cardinalitySettings() {
       'cardinality_number' => '',
     ];
     $this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
-    $this->assertText('Number of values is required.');
+    $this->assertSession()->responseContains('Number of values is required.');
 
     // Submit a custom number.
     $edit = [
@@ -270,7 +270,7 @@ public function cardinalitySettings() {
       'cardinality_number' => 6,
     ];
     $this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
-    $this->assertText('Updated field Body field settings.');
+    $this->assertSession()->responseContains('Updated field Body field settings.');
     $this->drupalGet($field_edit_path);
     $this->assertFieldByXPath("//select[@name='cardinality']", 'number');
     $this->assertFieldByXPath("//input[@name='cardinality_number']", 6);
@@ -303,7 +303,7 @@ public function cardinalitySettings() {
       'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
     ];
     $this->drupalPostForm($field_edit_path, $edit, t('Save field settings'));
-    $this->assertText('Updated field Body field settings.');
+    $this->assertSession()->responseContains('Updated field Body field settings.');
     $this->drupalGet($field_edit_path);
     $this->assertFieldByXPath("//select[@name='cardinality']", FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
     $this->assertFieldByXPath("//input[@name='cardinality_number']", 1);
@@ -406,12 +406,12 @@ public function testFieldPrefix() {
       'field_name' => $field_exceed_max_length_input,
     ];
     $this->drupalPostForm('admin/structure/types/manage/' . $this->contentType . '/fields/add-field', $edit, t('Save and continue'));
-    $this->assertText('Machine-readable name cannot be longer than 22 characters but is currently 23 characters long.');
+    $this->assertSession()->responseContains('Machine-readable name cannot be longer than 22 characters but is currently 23 characters long.');
 
     // Create a valid field.
     $this->fieldUIAddNewField('admin/structure/types/manage/' . $this->contentType, $this->fieldNameInput, $this->fieldLabel);
     $this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/node.' . $this->contentType . '.' . $field_prefix . $this->fieldNameInput);
-    $this->assertText(new FormattableMarkup('@label settings for @type', ['@label' => $this->fieldLabel, '@type' => $this->contentType]));
+    $this->assertSession()->responseContains(new FormattableMarkup('@label settings for @type', ['@label' => $this->fieldLabel, '@type' => $this->contentType]));
   }
 
   /**
@@ -448,12 +448,12 @@ public function testDefaultValue() {
     // Check that invalid default values are rejected.
     $edit = [$element_name => '-1'];
     $this->drupalPostForm($admin_path, $edit, t('Save settings'));
-    $this->assertText("$field_name does not accept the value -1", 'Form validation failed.');
+    $this->assertSession()->responseContains("$field_name does not accept the value -1", 'Form validation failed.');
 
     // Check that the default value is saved.
     $edit = [$element_name => '1'];
     $this->drupalPostForm($admin_path, $edit, t('Save settings'));
-    $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
+    $this->assertSession()->responseContains("Saved $field_name configuration", 'The form was successfully submitted.');
     $field = FieldConfig::loadByName('node', $this->contentType, $field_name);
     $this->assertEqual($field->getDefaultValueLiteral(), [['value' => 1]], 'The default value was correctly saved.');
 
@@ -464,7 +464,7 @@ public function testDefaultValue() {
     // Check that the default value can be emptied.
     $edit = [$element_name => ''];
     $this->drupalPostForm(NULL, $edit, t('Save settings'));
-    $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
+    $this->assertSession()->responseContains("Saved $field_name configuration", 'The form was successfully submitted.');
     $field = FieldConfig::loadByName('node', $this->contentType, $field_name);
     $this->assertEqual($field->getDefaultValueLiteral(), [], 'The default value was correctly saved.');
 
@@ -482,7 +482,7 @@ public function testDefaultValue() {
 
     $this->drupalGet($admin_path);
     $this->drupalPostForm(NULL, [], t('Save settings'));
-    $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
+    $this->assertSession()->responseContains("Saved $field_name configuration", 'The form was successfully submitted.');
     $field = FieldConfig::loadByName('node', $this->contentType, $field_name);
     $this->assertEqual($field->getDefaultValueLiteral(), [], 'The default value was correctly saved.');
 
@@ -545,13 +545,13 @@ public function testDisallowedFieldNames() {
     $edit['field_name'] = 'title';
     $bundle_path = 'admin/structure/types/manage/' . $this->contentType;
     $this->drupalPostForm("$bundle_path/fields/add-field", $edit, t('Save and continue'));
-    $this->assertText(t('The machine-readable name is already in use. It must be unique.'));
+    $this->assertSession()->responseContains(t('The machine-readable name is already in use. It must be unique.'));
 
     // Try with a base field.
     $edit['field_name'] = 'sticky';
     $bundle_path = 'admin/structure/types/manage/' . $this->contentType;
     $this->drupalPostForm("$bundle_path/fields/add-field", $edit, t('Save and continue'));
-    $this->assertText(t('The machine-readable name is already in use. It must be unique.'));
+    $this->assertSession()->responseContains(t('The machine-readable name is already in use. It must be unique.'));
   }
 
   /**
@@ -654,7 +654,7 @@ public function testDuplicateFieldName() {
     $url = 'admin/structure/types/manage/' . $this->contentType . '/fields/add-field';
     $this->drupalPostForm($url, $edit, t('Save and continue'));
 
-    $this->assertText(t('The machine-readable name is already in use. It must be unique.'));
+    $this->assertSession()->responseContains(t('The machine-readable name is already in use. It must be unique.'));
     $this->assertUrl($url, [], 'Stayed on the same page.');
   }
 
@@ -721,7 +721,7 @@ public function testHelpDescriptions() {
     // Check that hook_field_widget_form_alter() does believe this is the
     // default value form.
     $this->drupalGet('admin/structure/types/manage/article/fields/node.article.field_tags');
-    $this->assertText('From hook_field_widget_form_alter(): Default form is true.', 'Default value form in hook_field_widget_form_alter().');
+    $this->assertSession()->responseContains('From hook_field_widget_form_alter(): Default form is true.', 'Default value form in hook_field_widget_form_alter().');
 
     $edit = [
       'description' => '<em>Test with a non upload field.',
@@ -738,7 +738,7 @@ public function testHelpDescriptions() {
    */
   public function fieldListAdminPage() {
     $this->drupalGet('admin/reports/fields');
-    $this->assertText($this->fieldName, 'Field name is displayed in field list.');
+    $this->assertSession()->responseContains($this->fieldName, 'Field name is displayed in field list.');
     $this->assertLinkByHref('admin/structure/types/manage/' . $this->contentType . '/fields');
   }
 
diff --git a/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php b/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php
index 1d221e443d..9f535e9e9f 100644
--- a/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php
@@ -41,7 +41,7 @@ public function testAnonymousNode() {
     $this->drupalLogout();
     $this->drupalGet('node/add/article');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(strip_tags(t('Create @name', ['@name' => $bundle_label])));
+    $this->assertSession()->responseContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
 
     $edit = [
       'title[0][value]' => $node_title,
@@ -50,7 +50,7 @@ public function testAnonymousNode() {
     $this->drupalPostForm(NULL, $edit, 'Save');
     $this->assertSession()->statusCodeEquals(200);
     $t_args = ['@type' => $bundle_label, '%title' => $node_title];
-    $this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+    $this->assertSession()->responseContains(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
     $matches = [];
     if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
       $nid = end($matches);
@@ -72,7 +72,7 @@ public function testAnonymousNodeWithFile() {
     $this->drupalLogout();
     $this->drupalGet('node/add/article');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(strip_tags(t('Create @name', ['@name' => $bundle_label])));
+    $this->assertSession()->responseContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
 
     // Generate an image file.
     $image = $this->getTestFile('image');
@@ -86,7 +86,7 @@ public function testAnonymousNodeWithFile() {
     $this->drupalPostForm(NULL, $edit, 'Save');
     $this->assertSession()->statusCodeEquals(200);
     $t_args = ['@type' => $bundle_label, '%title' => $node_title];
-    $this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+    $this->assertSession()->responseContains(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
     $matches = [];
     if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
       $nid = end($matches);
@@ -129,7 +129,7 @@ protected function doTestNodeWithFileWithoutTitle() {
     // Load the node form.
     $this->drupalGet('node/add/article');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(strip_tags(t('Create @name', ['@name' => $bundle_label])));
+    $this->assertSession()->responseContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
 
     // Generate an image file.
     $image = $this->getTestFile('image');
@@ -148,8 +148,8 @@ protected function doTestNodeWithFileWithoutTitle() {
     $this->drupalPostForm(NULL, $edit, $label);
     $this->assertSession()->statusCodeEquals(200);
     $t_args = ['@type' => $bundle_label, '%title' => $node_title];
-    $this->assertNoText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
-    $this->assertText('Title field is required.');
+    $this->assertSession()->responseNotContains(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+    $this->assertSession()->responseContains('Title field is required.');
 
     // Submit the form again but this time with the missing title field. This
     // should still work.
@@ -160,7 +160,7 @@ protected function doTestNodeWithFileWithoutTitle() {
 
     // Confirm the final submission actually worked.
     $t_args = ['@type' => $bundle_label, '%title' => $node_title];
-    $this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
+    $this->assertSession()->responseContains(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
     $matches = [];
     if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
       $nid = end($matches);
diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
index 922985cb4e..a73ffbb599 100644
--- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
@@ -56,7 +56,7 @@ public function testNodeDisplay() {
       }
       $this->drupalPostForm("admin/structure/types/manage/$type_name/display", $edit, t('Save'));
       $this->drupalGet('node/' . $node->id());
-      $this->assertNoText($field_name, new FormattableMarkup('Field label is hidden when no file attached for formatter %formatter', ['%formatter' => $formatter]));
+      $this->assertSession()->responseNotContains($field_name, new FormattableMarkup('Field label is hidden when no file attached for formatter %formatter', ['%formatter' => $formatter]));
     }
 
     $this->generateFile('escaped-&-text', 64, 10, 'text');
@@ -94,7 +94,7 @@ public function testNodeDisplay() {
       $field_name . '[0][display]' => TRUE,
     ];
     $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save'));
-    $this->assertText($description);
+    $this->assertSession()->responseContains($description);
 
     // Ensure the filename in the link's title attribute is escaped.
     $this->assertRaw('title="escaped-&amp;-text.txt"');
@@ -181,7 +181,7 @@ public function testDescToggle() {
     $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save'));
     $node = $this->drupalGetNodeByTitle($title);
     $this->drupalGet('node/' . $node->id() . '/edit');
-    $this->assertText(t('The description may be used as the label of the link to the file.'));
+    $this->assertSession()->responseContains(t('The description may be used as the label of the link to the file.'));
   }
 
   /**
diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php
index 51698a6257..fa0631bef8 100644
--- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php
@@ -189,8 +189,8 @@ public function testFileRemoval() {
 
     // Check that the file can still be removed.
     $this->removeNodeFile($nid);
-    $this->assertNoText('Only files with the following extensions are allowed: txt.');
-    $this->assertText('Article ' . $node->getTitle() . ' has been updated.');
+    $this->assertSession()->responseNotContains('Only files with the following extensions are allowed: txt.');
+    $this->assertSession()->responseContains('Article ' . $node->getTitle() . ' has been updated.');
   }
 
 }
diff --git a/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php
index 5712525e3d..9f1839d19f 100644
--- a/core/modules/file/tests/src/Functional/FileListingTest.php
+++ b/core/modules/file/tests/src/Functional/FileListingTest.php
@@ -86,7 +86,7 @@ public function testFileListingPages() {
 
     $this->drupalGet('admin/content/files');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('No files available.');
+    $this->assertSession()->responseContains('No files available.');
     $this->drupalGet('admin/content/files');
     $this->assertSession()->statusCodeEquals(200);
 
@@ -112,7 +112,7 @@ public function testFileListingPages() {
 
     foreach ($nodes as $node) {
       $file = File::load($node->file->target_id);
-      $this->assertText($file->getFilename());
+      $this->assertSession()->responseContains($file->getFilename());
       $this->assertLinkByHref(file_create_url($file->getFileUri()));
       $this->assertLinkByHref('admin/content/files/usage/' . $file->id());
     }
@@ -143,13 +143,13 @@ public function testFileListingPages() {
       $usage = $file_usage->listUsage($file);
       $this->drupalGet('admin/content/files/usage/' . $file->id());
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertText($node->getTitle(), 'Node title found on usage page.');
-      $this->assertText('node', 'Registering entity type found on usage page.');
-      $this->assertText('file', 'Registering module found on usage page.');
+      $this->assertSession()->responseContains($node->getTitle(), 'Node title found on usage page.');
+      $this->assertSession()->responseContains('node', 'Registering entity type found on usage page.');
+      $this->assertSession()->responseContains('file', 'Registering module found on usage page.');
       foreach ($usage as $module) {
         foreach ($module as $entity_type) {
           foreach ($entity_type as $entity) {
-            $this->assertText($entity, 'Usage count found on usage page.');
+            $this->assertSession()->responseContains($entity, 'Usage count found on usage page.');
           }
         }
       }
@@ -201,7 +201,7 @@ public function testFileListingUsageNoLink() {
     $this->assertSession()->statusCodeEquals(200);
     // Entity name should be displayed, but not linked if Entity::toUrl
     // throws an exception
-    $this->assertText($entity_name, 'Entity name is added to file usage listing.');
+    $this->assertSession()->responseContains($entity_name, 'Entity name is added to file usage listing.');
     $this->assertNoLink($entity_name, 'Linked entity name not added to file usage listing.');
     $this->assertLink($node->getTitle());
   }
diff --git a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
index 348cee7d3a..f5dcce0185 100644
--- a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
+++ b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
@@ -50,7 +50,7 @@ public function testManagedFile() {
             $file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri()),
           ];
           $this->drupalPostForm(NULL, $edit, t('Save'));
-          $this->assertText('The form has become outdated. Copy any unsaved work in the form below');
+          $this->assertSession()->responseContains('The form has become outdated. Copy any unsaved work in the form below');
           $last_fid = $this->getLastFileId();
           $this->assertEqual($last_fid_prior, $last_fid, 'File was not saved when uploaded with an invalid form token.');
 
@@ -210,8 +210,8 @@ public function testUnusedPermanentFileValidation() {
     // allowed to reference an unused file.
     $this->drupalGet('file/test/1/0/1/' . $file->id());
     $this->drupalPostForm(NULL, [], 'Save');
-    $this->assertNoText('The file used in the Managed file &amp; butter field may not be referenced.');
-    $this->assertText('The file ids are ' . $file->id());
+    $this->assertSession()->responseNotContains('The file used in the Managed file &amp; butter field may not be referenced.');
+    $this->assertSession()->responseContains('The file ids are ' . $file->id());
 
     // Enable marking unused files as temporary, unused permanent files must not
     // be referenced now.
@@ -220,8 +220,8 @@ public function testUnusedPermanentFileValidation() {
       ->save();
     $this->drupalGet('file/test/1/0/1/' . $file->id());
     $this->drupalPostForm(NULL, [], 'Save');
-    $this->assertText('The file used in the Managed file &amp; butter field may not be referenced.');
-    $this->assertNoText('The file ids are ' . $file->id());
+    $this->assertSession()->responseContains('The file used in the Managed file &amp; butter field may not be referenced.');
+    $this->assertSession()->responseNotContains('The file ids are ' . $file->id());
 
     // Make the file temporary, now using it is allowed.
     $file->setTemporary();
@@ -229,8 +229,8 @@ public function testUnusedPermanentFileValidation() {
 
     $this->drupalGet('file/test/1/0/1/' . $file->id());
     $this->drupalPostForm(NULL, [], 'Save');
-    $this->assertNoText('The file used in the Managed file &amp; butter field may not be referenced.');
-    $this->assertText('The file ids are ' . $file->id());
+    $this->assertSession()->responseNotContains('The file used in the Managed file &amp; butter field may not be referenced.');
+    $this->assertSession()->responseContains('The file ids are ' . $file->id());
 
     // Make the file permanent again and add a usage from itself, referencing is
     // still allowed.
@@ -243,8 +243,8 @@ public function testUnusedPermanentFileValidation() {
 
     $this->drupalGet('file/test/1/0/1/' . $file->id());
     $this->drupalPostForm(NULL, [], 'Save');
-    $this->assertNoText('The file used in the Managed file &amp; butter field may not be referenced.');
-    $this->assertText('The file ids are ' . $file->id());
+    $this->assertSession()->responseNotContains('The file used in the Managed file &amp; butter field may not be referenced.');
+    $this->assertSession()->responseContains('The file ids are ' . $file->id());
   }
 
 }
diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
index bd7891920b..73d3537faa 100644
--- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
+++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
@@ -416,7 +416,7 @@ public function testErrorMessagesAreNotChanged() {
 
     // Ensure the expected error message is present and the counts before and
     // after calling _file_save_upload_from_form() are correct.
-    $this->assertText($error);
+    $this->assertSession()->responseContains($error);
     $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 1');
     $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 1');
 
@@ -432,7 +432,7 @@ public function testErrorMessagesAreNotChanged() {
 
     // Ensure the expected error message is present and the counts before and
     // after calling _file_save_upload_from_form() are correct.
-    $this->assertText($error);
+    $this->assertSession()->responseContains($error);
     $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 1');
     $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 1');
 
@@ -446,7 +446,7 @@ public function testErrorMessagesAreNotChanged() {
 
     // Ensure the error message is not present and the counts before and after
     // calling _file_save_upload_from_form() are correct.
-    $this->assertNoText($error);
+    $this->assertSession()->responseNotContains($error);
     $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 0');
     $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 0');
   }
diff --git a/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/core/modules/filter/tests/src/Functional/FilterAdminTest.php
index 00e2c16f24..b49d5c1c42 100644
--- a/core/modules/filter/tests/src/Functional/FilterAdminTest.php
+++ b/core/modules/filter/tests/src/Functional/FilterAdminTest.php
@@ -172,7 +172,7 @@ public function testFormatAdmin() {
       'name' => 'New format',
     ];
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
-    $this->assertText('The machine-readable name is already in use. It must be unique.');
+    $this->assertSession()->responseContains('The machine-readable name is already in use. It must be unique.');
 
     // Attempt to create a format of the same human readable name as the
     // disabled format but with a different machine name.
@@ -298,7 +298,7 @@ public function testFilterAdmin() {
     $edit['body[0][value]'] = $text;
     $edit['body[0][format]'] = $basic;
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
-    $this->assertText(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Filtered node created.');
+    $this->assertSession()->responseContains(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Filtered node created.');
 
     // Verify that the creation message contains a link to a node.
     $view_link = $this->xpath('//div[contains(@class, "messages")]//a[contains(@href, :href)]', [':href' => 'node/']);
@@ -424,7 +424,7 @@ public function testDisabledFormat() {
     // The format is used and we should see the static text instead of the body
     // value.
     $this->drupalGet($node->toUrl());
-    $this->assertText('filtered text');
+    $this->assertSession()->responseContains('filtered text');
 
     // Disable the format.
     $format->disable()->save();
@@ -432,7 +432,7 @@ public function testDisabledFormat() {
     $this->drupalGet($node->toUrl());
 
     // The format is not used anymore.
-    $this->assertNoText('filtered text');
+    $this->assertSession()->responseNotContains('filtered text');
     // The text is not displayed unfiltered or escaped.
     $this->assertNoRaw($body_value);
     $this->assertNoEscaped($body_value);
diff --git a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php
index 16ca25643d..1bb8a787d7 100644
--- a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php
+++ b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php
@@ -241,13 +241,13 @@ public function testFormatWidgetPermissions() {
     $new_edit = [];
     $new_edit['title[0][value]'] = $this->randomMachineName(8);
     $this->drupalPostForm(NULL, $new_edit, t('Preview'));
-    $this->assertText($edit[$body_value_key], 'Old body found in preview.');
+    $this->assertSession()->responseContains($edit[$body_value_key], 'Old body found in preview.');
 
     // Save and verify that only the title was changed.
     $this->drupalPostForm('node/' . $node->id() . '/edit', $new_edit, t('Save'));
-    $this->assertNoText($edit['title[0][value]'], 'Old title not found.');
-    $this->assertText($new_edit['title[0][value]'], 'New title found.');
-    $this->assertText($edit[$body_value_key], 'Old body found.');
+    $this->assertSession()->responseNotContains($edit['title[0][value]'], 'Old title not found.');
+    $this->assertSession()->responseContains($new_edit['title[0][value]'], 'New title found.');
+    $this->assertSession()->responseContains($edit[$body_value_key], 'Old body found.');
 
     // Check that even an administrator with "administer filters" permission
     // cannot edit the body field if they do not have specific permission to
@@ -283,17 +283,17 @@ public function testFormatWidgetPermissions() {
     $edit = [];
     $edit['title[0][value]'] = $new_title;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
-    $this->assertText(t('@name field is required.', ['@name' => t('Text format')]), 'Error message is displayed.');
+    $this->assertSession()->responseContains(t('@name field is required.', ['@name' => t('Text format')]), 'Error message is displayed.');
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($old_title, 'Old title found.');
-    $this->assertNoText($new_title, 'New title not found.');
+    $this->assertSession()->responseContains($old_title, 'Old title found.');
+    $this->assertSession()->responseNotContains($new_title, 'New title not found.');
 
     // Now select a new text format and make sure the node can be saved.
     $edit[$body_format_key] = filter_fallback_format();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertUrl('node/' . $node->id());
-    $this->assertText($new_title, 'New title found.');
-    $this->assertNoText($old_title, 'Old title not found.');
+    $this->assertSession()->responseContains($new_title, 'New title found.');
+    $this->assertSession()->responseNotContains($old_title, 'Old title not found.');
 
     // Switch the text format to a new one, then disable that format and all
     // other formats on the site (leaving only the fallback format).
@@ -318,15 +318,15 @@ public function testFormatWidgetPermissions() {
     $edit = [];
     $edit['title[0][value]'] = $new_title;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
-    $this->assertText(t('@name field is required.', ['@name' => t('Text format')]), 'Error message is displayed.');
+    $this->assertSession()->responseContains(t('@name field is required.', ['@name' => t('Text format')]), 'Error message is displayed.');
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($old_title, 'Old title found.');
-    $this->assertNoText($new_title, 'New title not found.');
+    $this->assertSession()->responseContains($old_title, 'Old title found.');
+    $this->assertSession()->responseNotContains($new_title, 'New title not found.');
     $edit[$body_format_key] = filter_fallback_format();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertUrl('node/' . $node->id());
-    $this->assertText($new_title, 'New title found.');
-    $this->assertNoText($old_title, 'Old title not found.');
+    $this->assertSession()->responseContains($new_title, 'New title found.');
+    $this->assertSession()->responseNotContains($old_title, 'Old title not found.');
   }
 
   /**
diff --git a/core/modules/filter/tests/src/Functional/FilterHooksTest.php b/core/modules/filter/tests/src/Functional/FilterHooksTest.php
index 8ed68af263..9ca87eb786 100644
--- a/core/modules/filter/tests/src/Functional/FilterHooksTest.php
+++ b/core/modules/filter/tests/src/Functional/FilterHooksTest.php
@@ -47,7 +47,7 @@ public function testFilterHooks() {
     $edit['roles[' . RoleInterface::ANONYMOUS_ID . ']'] = 1;
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
     $this->assertRaw(t('Added text format %format.', ['%format' => $name]));
-    $this->assertText('hook_filter_format_insert invoked.');
+    $this->assertSession()->responseContains('hook_filter_format_insert invoked.');
 
     $format_id = $edit['format'];
 
@@ -56,7 +56,7 @@ public function testFilterHooks() {
     $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
     $this->drupalPostForm('admin/config/content/formats/manage/' . $format_id, $edit, t('Save configuration'));
     $this->assertRaw(t('The text format %format has been updated.', ['%format' => $name]));
-    $this->assertText('hook_filter_format_update invoked.');
+    $this->assertSession()->responseContains('hook_filter_format_update invoked.');
 
     // Use the format created.
     $title = $this->randomMachineName(8);
@@ -65,12 +65,12 @@ public function testFilterHooks() {
     $edit['body[0][value]'] = $this->randomMachineName(32);
     $edit['body[0][format]'] = $format_id;
     $this->drupalPostForm("node/add/{$type->id()}", $edit, t('Save'));
-    $this->assertText(t('@type @title has been created.', ['@type' => $type_name, '@title' => $title]));
+    $this->assertSession()->responseContains(t('@type @title has been created.', ['@type' => $type_name, '@title' => $title]));
 
     // Disable the text format.
     $this->drupalPostForm('admin/config/content/formats/manage/' . $format_id . '/disable', [], t('Disable'));
     $this->assertRaw(t('Disabled text format %format.', ['%format' => $name]));
-    $this->assertText('hook_filter_format_disable invoked.');
+    $this->assertSession()->responseContains('hook_filter_format_disable invoked.');
   }
 
 }
diff --git a/core/modules/filter/tests/src/Functional/FilterSecurityTest.php b/core/modules/filter/tests/src/Functional/FilterSecurityTest.php
index fc6085048e..6d5372db78 100644
--- a/core/modules/filter/tests/src/Functional/FilterSecurityTest.php
+++ b/core/modules/filter/tests/src/Functional/FilterSecurityTest.php
@@ -62,7 +62,7 @@ public function testDisableFilterModule() {
     $body_raw = $node->body->value;
     $format_id = $node->body->format;
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($body_raw, 'Node body found.');
+    $this->assertSession()->responseContains($body_raw, 'Node body found.');
 
     // Enable the filter_test_replace filter.
     $edit = [
@@ -72,15 +72,15 @@ public function testDisableFilterModule() {
 
     // Verify that filter_test_replace filter replaced the content.
     $this->drupalGet('node/' . $node->id());
-    $this->assertNoText($body_raw, 'Node body not found.');
-    $this->assertText('Filter: Testing filter', 'Testing filter output found.');
+    $this->assertSession()->responseNotContains($body_raw, 'Node body not found.');
+    $this->assertSession()->responseContains('Filter: Testing filter', 'Testing filter output found.');
 
     // Disable the text format entirely.
     $this->drupalPostForm('admin/config/content/formats/manage/' . $format_id . '/disable', [], t('Disable'));
 
     // Verify that the content is empty, because the text format does not exist.
     $this->drupalGet('node/' . $node->id());
-    $this->assertNoText($body_raw, 'Node body not found.');
+    $this->assertSession()->responseNotContains($body_raw, 'Node body not found.');
   }
 
   /**
diff --git a/core/modules/forum/tests/src/Functional/ForumBlockTest.php b/core/modules/forum/tests/src/Functional/ForumBlockTest.php
index 7545e49b3f..4241b82230 100644
--- a/core/modules/forum/tests/src/Functional/ForumBlockTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumBlockTest.php
@@ -78,7 +78,7 @@ public function testNewForumTopicsBlock() {
         $this->assertLink($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
       }
       else {
-        $this->assertNoText($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
+        $this->assertSession()->responseNotContains($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
       }
     }
   }
@@ -124,7 +124,7 @@ public function testActiveForumTopicsBlock() {
         $this->assertLink($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
       }
       else {
-        $this->assertNoText($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
+        $this->assertSession()->responseNotContains($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
       }
     }
 
@@ -141,7 +141,7 @@ public function testActiveForumTopicsBlock() {
         $this->assertLink($topics[$index], 0, 'Forum topic found in the "Active forum topics" block.');
       }
       else {
-        $this->assertNoText($topics[$index], 'Forum topic not found in the "Active forum topics" block.');
+        $this->assertSession()->responseNotContains($topics[$index], 'Forum topic not found in the "Active forum topics" block.');
       }
     }
   }
diff --git a/core/modules/forum/tests/src/Functional/ForumIndexTest.php b/core/modules/forum/tests/src/Functional/ForumIndexTest.php
index b14a8e3719..c9687d2fd2 100644
--- a/core/modules/forum/tests/src/Functional/ForumIndexTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumIndexTest.php
@@ -68,7 +68,7 @@ public function testForumIndexStatus() {
 
     // Verify that the node appears on the index.
     $this->drupalGet('forum/' . $tid);
-    $this->assertText($title, 'Published forum topic appears on index.');
+    $this->assertSession()->responseContains($title, 'Published forum topic appears on index.');
     $this->assertCacheTag('node_list');
     $this->assertCacheTag('config:node.type.forum');
     $this->assertCacheTag('comment_list');
@@ -80,11 +80,11 @@ public function testForumIndexStatus() {
     $edit = ['status[value]' => FALSE];
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->drupalGet('node/' . $node->id());
-    $this->assertText(t('Access denied'), 'Unpublished node is no longer accessible.');
+    $this->assertSession()->responseContains(t('Access denied'), 'Unpublished node is no longer accessible.');
 
     // Verify that the node no longer appears on the index.
     $this->drupalGet('forum/' . $tid);
-    $this->assertNoText($title, 'Unpublished forum topic no longer appears on index.');
+    $this->assertSession()->responseNotContains($title, 'Unpublished forum topic no longer appears on index.');
   }
 
 }
diff --git a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php
index 50cb594bca..487f459f0c 100644
--- a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php
@@ -83,16 +83,16 @@ public function testForumNodeAccess() {
     $this->drupalGet('');
 
     // Ensure private node and public node are found.
-    $this->assertText($private_node->getTitle(), 'Private node found in block by $access_user');
-    $this->assertText($public_node->getTitle(), 'Public node found in block by $access_user');
+    $this->assertSession()->responseContains($private_node->getTitle(), 'Private node found in block by $access_user');
+    $this->assertSession()->responseContains($public_node->getTitle(), 'Public node found in block by $access_user');
 
     // Test for $no_access_user.
     $this->drupalLogin($no_access_user);
     $this->drupalGet('');
 
     // Ensure private node is not found but public is found.
-    $this->assertNoText($private_node->getTitle(), 'Private node not found in block by $no_access_user');
-    $this->assertText($public_node->getTitle(), 'Public node found in block by $no_access_user');
+    $this->assertSession()->responseNotContains($private_node->getTitle(), 'Private node not found in block by $no_access_user');
+    $this->assertSession()->responseContains($public_node->getTitle(), 'Public node found in block by $no_access_user');
   }
 
 }
diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php
index 3ae2c55edc..6eb79d93df 100644
--- a/core/modules/forum/tests/src/Functional/ForumTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumTest.php
@@ -171,7 +171,7 @@ public function testForum() {
     $this->drupalLogin($this->webUser);
     // Verify that this user is shown a message that they may not post content.
     $this->drupalGet('forum/' . $this->forum['tid']);
-    $this->assertText(t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect.");
+    $this->assertSession()->responseContains(t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect.");
 
     // Log in, and do basic tests for a user with permission to edit any forum
     // content.
@@ -317,7 +317,7 @@ private function doAdminTests($user) {
     // Verify "edit container" link exists and functions correctly.
     $this->drupalGet('admin/structure/forum');
     // Verify help text is shown.
-    $this->assertText(t('Forums contain forum topics. Use containers to group related forums'));
+    $this->assertSession()->responseContains(t('Forums contain forum topics. Use containers to group related forums'));
     // Verify action links are there.
     $this->assertLink('Add forum');
     $this->assertLink('Add container');
@@ -436,7 +436,7 @@ public function createForum($type, $parent = 0) {
     $this->drupalPostForm('admin/structure/forum/add/' . $type, $edit, t('Save'));
     $this->assertSession()->statusCodeEquals(200);
     $type = ($type == 'container') ? 'forum container' : 'forum';
-    $this->assertText(
+    $this->assertSession()->responseContains(
       t(
         'Created new @type @term.',
         ['@term' => $name, '@type' => t($type)]
@@ -484,9 +484,9 @@ public function deleteForum($tid) {
     // Delete the forum.
     $this->drupalGet('admin/structure/forum/edit/forum/' . $tid);
     $this->clickLink(t('Delete'));
-    $this->assertText('Are you sure you want to delete the forum');
-    $this->assertNoText('Add forum');
-    $this->assertNoText('Add forum container');
+    $this->assertSession()->responseContains('Are you sure you want to delete the forum');
+    $this->assertSession()->responseNotContains('Add forum');
+    $this->assertSession()->responseNotContains('Add forum container');
     $this->drupalPostForm(NULL, [], t('Delete'));
 
     // Assert that the forum no longer exists.
@@ -577,12 +577,12 @@ public function createForumTopic($forum, $container = FALSE) {
 
     $type = t('Forum topic');
     if ($container) {
-      $this->assertNoText(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was not created');
+      $this->assertSession()->responseNotContains(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was not created');
       $this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'Error message was shown');
       return;
     }
     else {
-      $this->assertText(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was created');
+      $this->assertSession()->responseContains(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was created');
       $this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'No error message was shown');
 
       // Verify that the creation message contains a link to a term.
@@ -621,7 +621,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) {
     $this->assertSession()->statusCodeEquals($response2);
     if ($response2 == 200) {
       $this->assertTitle(t('Forum | Drupal'), 'Forum help title was displayed');
-      $this->assertText(t('Forum'), 'Forum help node was displayed');
+      $this->assertSession()->responseContains(t('Forum'), 'Forum help node was displayed');
     }
 
     // View forum container page.
@@ -663,7 +663,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) {
       $edit['taxonomy_forums'] = $this->rootForum['tid'];
       $edit['shadow'] = TRUE;
       $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
-      $this->assertText(t('Forum topic @title has been updated.', ['@title' => $edit['title[0][value]']]), 'Forum node was edited');
+      $this->assertSession()->responseContains(t('Forum topic @title has been updated.', ['@title' => $edit['title[0][value]']]), 'Forum node was edited');
 
       // Verify topic was moved to a different forum.
       $forum_tid = $this->container
diff --git a/core/modules/forum/tests/src/Functional/ForumUninstallTest.php b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php
index 30a84590c1..9357194cca 100644
--- a/core/modules/forum/tests/src/Functional/ForumUninstallTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php
@@ -72,7 +72,7 @@ public function testForumUninstallWithField() {
     $this->drupalGet('admin/modules/uninstall');
     // Assert forum is required.
     $this->assertSession()->fieldDisabled('uninstall[forum]');
-    $this->assertText('To uninstall Forum, first delete all Forum content');
+    $this->assertSession()->responseContains('To uninstall Forum, first delete all Forum content');
 
     // Delete the node.
     $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete'));
@@ -81,7 +81,7 @@ public function testForumUninstallWithField() {
     $this->drupalGet('admin/modules/uninstall');
     // Assert forum is still required.
     $this->assertSession()->fieldDisabled('uninstall[forum]');
-    $this->assertText('To uninstall Forum, first delete all Forums terms');
+    $this->assertSession()->responseContains('To uninstall Forum, first delete all Forums terms');
 
     // Delete any forum terms.
     $vid = $this->config('forum.settings')->get('vocabulary');
@@ -123,7 +123,7 @@ public function testForumUninstallWithField() {
 
     // Double check everything by reinstalling the forum module again.
     $this->drupalPostForm('admin/modules', ['modules[forum][enable]' => 1], 'Install');
-    $this->assertText('Module Forum has been enabled.');
+    $this->assertSession()->responseContains('Module Forum has been enabled.');
   }
 
   /**
diff --git a/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php b/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php
index 76af811233..57275fd3b7 100644
--- a/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php
+++ b/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php
@@ -51,15 +51,15 @@ protected function setUp(): void {
   public function testExperimentalHelp() {
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/help/experimental_module_test');
-    $this->assertText('This module is experimental.');
+    $this->assertSession()->responseContains('This module is experimental.');
 
     // Regular modules should not display the message.
     $this->drupalGet('admin/help/help_page_test');
-    $this->assertNoText('This module is experimental.');
+    $this->assertSession()->responseNotContains('This module is experimental.');
 
     // Ensure the actual help page is displayed to avoid a false positive.
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('online documentation for the Help Page Test module');
+    $this->assertSession()->responseContains('online documentation for the Help Page Test module');
   }
 
 }
diff --git a/core/modules/help/tests/src/Functional/HelpBlockTest.php b/core/modules/help/tests/src/Functional/HelpBlockTest.php
index cc4b750a7f..b0c140d51d 100644
--- a/core/modules/help/tests/src/Functional/HelpBlockTest.php
+++ b/core/modules/help/tests/src/Functional/HelpBlockTest.php
@@ -43,18 +43,18 @@ protected function setUp(): void {
    */
   public function testHelp() {
     $this->drupalGet('help_page_test/has_help');
-    $this->assertText(t('I have help!'));
-    $this->assertText($this->helpBlock->label());
+    $this->assertSession()->responseContains(t('I have help!'));
+    $this->assertSession()->responseContains($this->helpBlock->label());
 
     $this->drupalGet('help_page_test/no_help');
     // The help block should not appear when there is no help.
-    $this->assertNoText($this->helpBlock->label());
+    $this->assertSession()->responseNotContains($this->helpBlock->label());
 
     // Ensure that if two hook_help() implementations both return a render array
     // the output is as expected.
     $this->drupalGet('help_page_test/test_array');
-    $this->assertText('Help text from more_help_page_test_help module.');
-    $this->assertText('Help text from help_page_test_help module.');
+    $this->assertSession()->responseContains('Help text from more_help_page_test_help module.');
+    $this->assertSession()->responseContains('Help text from help_page_test_help module.');
   }
 
 }
diff --git a/core/modules/help/tests/src/Functional/HelpTest.php b/core/modules/help/tests/src/Functional/HelpTest.php
index 3efdb98ce4..b78a0dc517 100644
--- a/core/modules/help/tests/src/Functional/HelpTest.php
+++ b/core/modules/help/tests/src/Functional/HelpTest.php
@@ -78,7 +78,7 @@ public function testHelp() {
     // Verify that an empty section is handled correctly.
     $this->assertRaw('<h2>' . t('Empty section') . '</h2>');
     $this->assertRaw('<p>' . t('This description should appear.'), '</p>');
-    $this->assertText(t('There is currently nothing in this section.'));
+    $this->assertSession()->responseContains(t('There is currently nothing in this section.'));
 
     // Make sure links are properly added for modules implementing hook_help().
     foreach ($this->getModuleList() as $module => $name) {
@@ -116,10 +116,10 @@ protected function verifyHelp($response = 200) {
     $this->drupalGet('admin/index');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText('This page shows you all available administration tasks for each module.');
+      $this->assertSession()->responseContains('This page shows you all available administration tasks for each module.');
     }
     else {
-      $this->assertNoText('This page shows you all available administration tasks for each module.');
+      $this->assertSession()->responseNotContains('This page shows you all available administration tasks for each module.');
     }
 
     foreach ($this->getModuleList() as $module => $name) {
@@ -132,7 +132,7 @@ protected function verifyHelp($response = 200) {
         $info = \Drupal::service('extension.list.module')->getExtensionInfo($module);
         $admin_tasks = system_get_module_admin_tasks($module, $info);
         if (!empty($admin_tasks)) {
-          $this->assertText(t('@module administration pages', ['@module' => $name]));
+          $this->assertSession()->responseContains(t('@module administration pages', ['@module' => $name]));
         }
         foreach ($admin_tasks as $task) {
           $this->assertLink($task['title']);
diff --git a/core/modules/help/tests/src/Functional/NoHelpTest.php b/core/modules/help/tests/src/Functional/NoHelpTest.php
index 63eaf6276a..3c7788d0c7 100644
--- a/core/modules/help/tests/src/Functional/NoHelpTest.php
+++ b/core/modules/help/tests/src/Functional/NoHelpTest.php
@@ -43,9 +43,9 @@ public function testMainPageNoHelp() {
 
     $this->drupalGet('admin/help');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Module overviews are provided by modules');
+    $this->assertSession()->responseContains('Module overviews are provided by modules');
     $this->assertFalse(\Drupal::moduleHandler()->implementsHook('menu_test', 'help'), 'The menu_test module does not implement hook_help');
-    $this->assertNoText(\Drupal::moduleHandler()->getName('menu_test'), 'Making sure the test module menu_test does not display a help link on admin/help.');
+    $this->assertSession()->responseNotContains(\Drupal::moduleHandler()->getName('menu_test'), 'Making sure the test module menu_test does not display a help link on admin/help.');
 
     // Ensure that the module overview help page for a module that does not
     // implement hook_help() results in a 404.
diff --git a/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
index 76907b9f56..098f574621 100644
--- a/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
+++ b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
@@ -249,7 +249,7 @@ public function testUninstall() {
     $edit['uninstall[help_topics]'] = TRUE;
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
     $this->drupalGet('admin/help');
     $this->assertSession()->statusCodeEquals(200);
   }
diff --git a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
index 0041fa3cf7..974c7c1d14 100644
--- a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
+++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
@@ -348,7 +348,7 @@ public function testStyleReplacement() {
       'label' => $new_style_label,
     ];
     $this->drupalPostForm($style_path . $style_name, $edit, t('Save'));
-    $this->assertText(t('Changes to the style have been saved.'), new FormattableMarkup('Style %name was renamed to %new_name.', ['%name' => $style_name, '%new_name' => $new_style_name]));
+    $this->assertSession()->responseContains(t('Changes to the style have been saved.'), new FormattableMarkup('Style %name was renamed to %new_name.', ['%name' => $style_name, '%new_name' => $new_style_name]));
     $this->drupalGet('node/' . $nid);
 
     // Reload the image style using the new name.
@@ -378,15 +378,15 @@ public function testEditEffect() {
     $this->drupalPostForm(NULL, ['label' => 'Test style effect edit', 'name' => $style_name], t('Create new style'));
     $this->drupalPostForm(NULL, ['new' => 'image_scale_and_crop'], t('Add'));
     $this->drupalPostForm(NULL, ['data[width]' => '300', 'data[height]' => '200'], t('Add effect'));
-    $this->assertText(t('Scale and crop 300×200'));
+    $this->assertSession()->responseContains(t('Scale and crop 300×200'));
 
     // There should normally be only one edit link on this page initially.
     $this->clickLink(t('Edit'));
     $this->drupalPostForm(NULL, ['data[width]' => '360', 'data[height]' => '240'], t('Update effect'));
-    $this->assertText(t('Scale and crop 360×240'));
+    $this->assertSession()->responseContains(t('Scale and crop 360×240'));
 
     // Check that the previous effect is replaced.
-    $this->assertNoText(t('Scale and crop 300×200'));
+    $this->assertSession()->responseNotContains(t('Scale and crop 300×200'));
 
     // Add another scale effect.
     $this->drupalGet('admin/config/media/image-styles/add');
@@ -412,8 +412,8 @@ public function testEditEffect() {
     }
     $this->drupalPostForm(NULL, ['new' => 'image_scale'], t('Add'));
     $this->drupalPostForm(NULL, ['data[width]' => '12', 'data[height]' => '19'], t('Add effect'));
-    $this->assertText(t('Scale 24×19'));
-    $this->assertText(t('Scale 12×19'));
+    $this->assertSession()->responseContains(t('Scale 24×19'));
+    $this->assertSession()->responseContains(t('Scale 12×19'));
 
     // Try to edit a nonexistent effect.
     $uuid = $this->container->get('uuid');
diff --git a/core/modules/image/tests/src/Functional/ImageEffectsTest.php b/core/modules/image/tests/src/Functional/ImageEffectsTest.php
index 3a2a1e16ba..5fa0cd0df0 100644
--- a/core/modules/image/tests/src/Functional/ImageEffectsTest.php
+++ b/core/modules/image/tests/src/Functional/ImageEffectsTest.php
@@ -206,7 +206,7 @@ public function testEffectFormValidationErrors() {
     $path = 'admin/config/media/image-styles/manage/thumbnail/effects/' . $uuid;
     $this->drupalPostForm($path, $edit, t('Update effect'));
     // Check that the error message has been displayed.
-    $this->assertText(t('Width and height can not both be blank.'));
+    $this->assertSession()->responseContains(t('Width and height can not both be blank.'));
   }
 
   /**
diff --git a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php
index 3e2bce273a..213678d886 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php
@@ -325,8 +325,8 @@ public function testDefaultImages() {
 
     $non_image = $this->drupalGetTestFiles('text');
     $this->drupalPostForm(NULL, ['files[settings_default_image_uuid]' => \Drupal::service('file_system')->realpath($non_image[0]->uri)], t("Upload"));
-    $this->assertText('The specified file text-0.txt could not be uploaded.');
-    $this->assertText('Only files with the following extensions are allowed: png gif jpg jpeg.');
+    $this->assertSession()->responseContains('The specified file text-0.txt could not be uploaded.');
+    $this->assertSession()->responseContains('Only files with the following extensions are allowed: png gif jpg jpeg.');
 
     // Confirm the default image is shown on the node form.
     $file = File::load($default_images['field_storage_new']->id());
diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
index ccd8dd21ba..907a8ea313 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
@@ -263,9 +263,9 @@ public function testImageFieldSettings() {
     $this->assertFieldByName('settings[min_resolution][y]', '10', 'Expected min resolution Y value of 10.');
 
     $this->drupalGet('node/add/article');
-    $this->assertText(t('50 KB limit.'), 'Image widget max file size is displayed on article form.');
-    $this->assertText(t('Allowed types: @extensions.', ['@extensions' => $test_image_extension]), 'Image widget allowed file types displayed on article form.');
-    $this->assertText(t('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.'), 'Image widget allowed resolution displayed on article form.');
+    $this->assertSession()->responseContains(t('50 KB limit.'), 'Image widget max file size is displayed on article form.');
+    $this->assertSession()->responseContains(t('Allowed types: @extensions.', ['@extensions' => $test_image_extension]), 'Image widget allowed file types displayed on article form.');
+    $this->assertSession()->responseContains(t('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.'), 'Image widget allowed resolution displayed on article form.');
 
     // We have to create the article first and then edit it because the alt
     // and title fields do not display until the image has been attached.
@@ -337,7 +337,7 @@ public function testImageFieldSettings() {
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     // Add the required alt text.
     $this->drupalPostForm(NULL, [$field_name . '[1][alt]' => $alt], t('Save'));
-    $this->assertText(new FormattableMarkup('Article @title has been updated.', ['@title' => $node->getTitle()]));
+    $this->assertSession()->responseContains(new FormattableMarkup('Article @title has been updated.', ['@title' => $node->getTitle()]));
 
     // Assert ImageWidget::process() calls FieldWidget::process().
     $this->drupalGet('node/' . $node->id() . '/edit');
diff --git a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php
index e02b0ed604..d14bc25f39 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php
@@ -148,15 +148,15 @@ public function testResolution() {
       '%height' => $image_that_is_too_small_file->getHeight(),
       ]));
     $this->uploadNodeImage($image_that_is_too_big, $field_names[0], 'article');
-    $this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'));
+    $this->assertSession()->responseContains(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'));
     $this->uploadNodeImage($image_that_is_too_small, $field_names[1], 'article');
     $this->assertRaw(t('The specified file %name could not be uploaded.', ['%name' => $image_that_is_too_small->filename]));
     $this->uploadNodeImage($image_that_is_too_big, $field_names[1], 'article');
-    $this->assertText(t('The image was resized to fit within the maximum allowed width of 100 pixels.'));
+    $this->assertSession()->responseContains(t('The image was resized to fit within the maximum allowed width of 100 pixels.'));
     $this->uploadNodeImage($image_that_is_too_small, $field_names[2], 'article');
     $this->assertRaw(t('The specified file %name could not be uploaded.', ['%name' => $image_that_is_too_small->filename]));
     $this->uploadNodeImage($image_that_is_too_big, $field_names[2], 'article');
-    $this->assertText(t('The image was resized to fit within the maximum allowed height of 100 pixels.'));
+    $this->assertSession()->responseContains(t('The image was resized to fit within the maximum allowed height of 100 pixels.'));
   }
 
   /**
@@ -186,8 +186,8 @@ public function testRequiredAttributes() {
 
     $this->assertTrue(isset($elements[0]), 'Required marker is shown for the required title text.');
 
-    $this->assertText(t('Alternative text field is required.'));
-    $this->assertText(t('Title field is required.'));
+    $this->assertSession()->responseContains(t('Alternative text field is required.'));
+    $this->assertSession()->responseContains(t('Title field is required.'));
 
     $instance->setSetting('alt_field_required', 0);
     $instance->setSetting('title_field_required', 0);
@@ -198,8 +198,8 @@ public function testRequiredAttributes() {
     ];
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
 
-    $this->assertNoText(t('Alternative text field is required.'));
-    $this->assertNoText(t('Title field is required.'));
+    $this->assertSession()->responseNotContains(t('Alternative text field is required.'));
+    $this->assertSession()->responseNotContains(t('Title field is required.'));
 
     $instance->setSetting('required', 0);
     $instance->setSetting('alt_field_required', 1);
@@ -211,8 +211,8 @@ public function testRequiredAttributes() {
     ];
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
 
-    $this->assertNoText(t('Alternative text field is required.'));
-    $this->assertNoText(t('Title field is required.'));
+    $this->assertSession()->responseNotContains(t('Alternative text field is required.'));
+    $this->assertSession()->responseNotContains(t('Title field is required.'));
   }
 
   /**
diff --git a/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php b/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php
index 451beee9a6..03e01cd564 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php
@@ -33,23 +33,23 @@ public function testWidgetElement() {
     $this->drupalGet('node/add/article');
     $this->assertNotCount(0, $this->xpath('//div[contains(@class, "field--widget-image-image")]'), 'Image field widget found on add/node page', NULL);
     $this->assertNotCount(0, $this->xpath('//input[contains(@accept, "image/*")]'), 'Image field widget limits accepted files.', NULL);
-    $this->assertNoText('Image test on [site:name]');
+    $this->assertSession()->responseNotContains('Image test on [site:name]');
 
     // Check for allowed image file extensions - default.
-    $this->assertText('Allowed types: png gif jpg jpeg.');
+    $this->assertSession()->responseContains('Allowed types: png gif jpg jpeg.');
 
     // Try adding to the field config an unsupported extension, should not
     // appear in the allowed types.
     $field_config = FieldConfig::loadByName('node', 'article', $field_name);
     $field_config->setSetting('file_extensions', 'png gif jpg jpeg tiff')->save();
     $this->drupalGet('node/add/article');
-    $this->assertText('Allowed types: png gif jpg jpeg.');
+    $this->assertSession()->responseContains('Allowed types: png gif jpg jpeg.');
 
     // Add a supported extension and remove some supported ones, we should see
     // the intersect of those entered in field config with those supported.
     $field_config->setSetting('file_extensions', 'png jpe tiff')->save();
     $this->drupalGet('node/add/article');
-    $this->assertText('Allowed types: png jpe.');
+    $this->assertSession()->responseContains('Allowed types: png jpe.');
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
index 3d27415e1f..d307f7fc6f 100644
--- a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
@@ -72,7 +72,7 @@ public function testUIBrowserLanguageMappings() {
 
     // Add the same custom mapping again.
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
-    $this->assertText('Browser language codes must be unique.');
+    $this->assertSession()->responseContains('Browser language codes must be unique.');
 
     // Change browser language code of our custom mapping to zh-sg.
     $edit = [
@@ -80,7 +80,7 @@ public function testUIBrowserLanguageMappings() {
       'mappings[xx][drupal_langcode]' => 'en',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
-    $this->assertText(t('Browser language codes must be unique.'));
+    $this->assertSession()->responseContains(t('Browser language codes must be unique.'));
 
     // Change Drupal language code of our custom mapping to zh-hans.
     $edit = [
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigOverrideImportTest.php b/core/modules/language/tests/src/Functional/LanguageConfigOverrideImportTest.php
index 5f5232f5f3..3d424bebb8 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigOverrideImportTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigOverrideImportTest.php
@@ -59,11 +59,11 @@ public function testConfigOverrideImport() {
     $override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'system.site');
     $this->assertEqual('FR default site name', $override->get('name'));
     $this->drupalGet('fr');
-    $this->assertText('FR default site name');
+    $this->assertSession()->responseContains('FR default site name');
 
     $this->drupalLogin($this->rootUser);
     $this->drupalGet('admin/config/development/maintenance/translate/fr/edit');
-    $this->assertText('FR message: @site is currently under maintenance. We should be back shortly. Thank you for your patience');
+    $this->assertSession()->responseContains('FR message: @site is currently under maintenance. We should be back shortly. Thank you for your patience');
   }
 
   /**
@@ -96,7 +96,7 @@ public function testConfigOverrideImportEvents() {
     $this->assertFalse($event_recorder);
 
     $this->drupalGet('fr');
-    $this->assertText('FR default site name');
+    $this->assertSession()->responseContains('FR default site name');
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
index 91e892ebe7..45a2b87bd2 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
@@ -52,7 +52,7 @@ public function testLanguageConfiguration() {
       'predefined_langcode' => 'fr',
     ];
     $this->drupalPostForm(NULL, $edit, 'Add language');
-    $this->assertText('French');
+    $this->assertSession()->responseContains('French');
     $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
     // Langcode for Languages is always 'en'.
     $language = $this->config('language.entity.fr')->get();
@@ -98,7 +98,7 @@ public function testLanguageConfiguration() {
       'prefix[fr]' => '',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
-    $this->assertNoText(t('The prefix may only be left blank for the selected detection fallback language.'), 'The path prefix can be removed for the default language');
+    $this->assertSession()->responseNotContains(t('The prefix may only be left blank for the selected detection fallback language.'), 'The path prefix can be removed for the default language');
 
     // Change default negotiation language.
     $this->config('language.negotiation')->set('selected_langcode', 'fr')->save();
@@ -108,14 +108,14 @@ public function testLanguageConfiguration() {
       'prefix[en]' => '',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
-    $this->assertText(t('The prefix may only be left blank for the selected detection fallback language.'));
+    $this->assertSession()->responseContains(t('The prefix may only be left blank for the selected detection fallback language.'));
 
     //  Check that prefix cannot be changed to contain a slash.
     $edit = [
       'prefix[en]' => 'foo/bar',
     ];
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
-    $this->assertText(t('The prefix may not contain a slash.'), 'English prefix cannot be changed to contain a slash.');
+    $this->assertSession()->responseContains(t('The prefix may not contain a slash.'), 'English prefix cannot be changed to contain a slash.');
 
     // Remove English language and add a new Language to check if langcode of
     // Language entity is 'en'.
diff --git a/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php
index 03dad5c233..1db68f4744 100644
--- a/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php
@@ -41,8 +41,8 @@ public function testLanguageConfiguration() {
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
     // Test validation on missing values.
-    $this->assertText(t('@name field is required.', ['@name' => t('Language code')]));
-    $this->assertText(t('@name field is required.', ['@name' => t('Language name')]));
+    $this->assertSession()->responseContains(t('@name field is required.', ['@name' => t('Language code')]));
+    $this->assertSession()->responseContains(t('@name field is required.', ['@name' => t('Language name')]));
     $empty_language = new Language();
     $this->assertFieldChecked('edit-direction-' . $empty_language->getDirection(), 'Consistent usage of language direction.');
     $this->assertUrl(Url::fromRoute('language.add', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
diff --git a/core/modules/language/tests/src/Functional/LanguageListTest.php b/core/modules/language/tests/src/Functional/LanguageListTest.php
index 173d3c8973..425f15d8b1 100644
--- a/core/modules/language/tests/src/Functional/LanguageListTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageListTest.php
@@ -45,7 +45,7 @@ public function testLanguageList() {
       'predefined_langcode' => 'fr',
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
-    $this->assertText('French', 'Language added successfully.');
+    $this->assertSession()->responseContains('French', 'Language added successfully.');
     $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
 
     // Get the weight of the last language and check that the weight is one unit
@@ -68,7 +68,7 @@ public function testLanguageList() {
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
     $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
     $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
-    $this->assertText(t($name), 'Test language added.');
+    $this->assertSession()->responseContains(t($name), 'Test language added.');
 
     $language = \Drupal::service('language_manager')->getLanguage($langcode);
     $english = \Drupal::service('language_manager')->getLanguage('en');
@@ -112,7 +112,7 @@ public function testLanguageList() {
     // Ensure 'delete' link works.
     $this->drupalGet('admin/config/regional/language');
     $this->clickLink(t('Delete'));
-    $this->assertText(t('Are you sure you want to delete the language'), '"Delete" link is correct.');
+    $this->assertSession()->responseContains(t('Are you sure you want to delete the language'), '"Delete" link is correct.');
     // Delete a language.
     $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
     // First test the 'cancel' link.
@@ -156,7 +156,7 @@ public function testLanguageList() {
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
     $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
-    $this->assertText($name, 'Name found.');
+    $this->assertSession()->responseContains($name, 'Name found.');
 
     // Check if we can change the default language.
     $path = 'admin/config/regional/language';
@@ -196,7 +196,7 @@ public function testLanguageList() {
     $language_storage->load('nl')->delete();
 
     $this->drupalPostForm(NULL, ['site_default_language' => 'nl'], 'Save configuration');
-    $this->assertText(t('Selected default language no longer exists.'));
+    $this->assertSession()->responseContains(t('Selected default language no longer exists.'));
     $this->assertNoFieldChecked('edit-site-default-language-xx', 'The previous default language got deselected.');
   }
 
diff --git a/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php b/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php
index 0fe4c1f6ae..5f78fccb07 100644
--- a/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php
@@ -46,7 +46,7 @@ public function testLanguageLocaleList() {
       'predefined_langcode' => 'fr',
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
-    $this->assertText('The language French has been created and can now be used');
+    $this->assertSession()->responseContains('The language French has been created and can now be used');
     $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
     $this->rebuildContainer();
 
diff --git a/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php b/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php
index 5ee0706cac..0372082cb6 100644
--- a/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php
+++ b/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php
@@ -72,7 +72,7 @@ public function testPageLinks() {
     // Verify that links in this page can be followed and work.
     $this->clickLink(t('Languages'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Add language'), 'Page contains the add language text');
+    $this->assertSession()->responseContains(t('Add language'), 'Page contains the add language text');
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php
index cbefc4f79a..7989156f56 100644
--- a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php
@@ -81,7 +81,7 @@ public function testLanguageBlock() {
   protected function doTestLanguageBlockAuthenticated($block_label) {
     // Assert that the language switching block is displayed on the frontpage.
     $this->drupalGet('');
-    $this->assertText($block_label, 'Language switcher block found.');
+    $this->assertSession()->responseContains($block_label, 'Language switcher block found.');
 
     // Assert that each list item and anchor element has the appropriate data-
     // attributes.
@@ -135,7 +135,7 @@ protected function doTestLanguageBlockAnonymous($block_label) {
     // Assert that the language switching block is displayed on the frontpage
     // and ensure that the active class is added when query params are present.
     $this->drupalGet('', ['query' => ['foo' => 'bar']]);
-    $this->assertText($block_label, 'Language switcher block found.');
+    $this->assertSession()->responseContains($block_label, 'Language switcher block found.');
 
     // Assert that only the current language is marked as active.
     $language_switchers = $this->xpath('//div[@id=:id]/ul/li', [':id' => 'block-test-language-block']);
@@ -199,7 +199,7 @@ public function testLanguageBlockWithDomain() {
       'domain[en]' => '',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
-    $this->assertText(t('The domain may not be left blank for English'), 'The form does not allow blank domains.');
+    $this->assertSession()->responseContains(t('The domain may not be left blank for English'), 'The form does not allow blank domains.');
 
     // Change the domain for the Italian language.
     $edit = [
@@ -208,7 +208,7 @@ public function testLanguageBlockWithDomain() {
       'domain[it]' => 'it.example.com',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved'), 'Domain configuration is saved.');
+    $this->assertSession()->responseContains(t('The configuration options have been saved'), 'Domain configuration is saved.');
 
     // Enable the language switcher block.
     $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, ['id' => 'test_language_block']);
diff --git a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
index 567ab2a25b..4bae7a824a 100644
--- a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
@@ -404,8 +404,8 @@ protected function doRunTest($test) {
     }
     $this->container->get('language_manager')->reset();
     $this->drupalGet($test['path'], $test['path_options'], $test['http_header']);
-    $this->assertText($test['expect'], $test['message']);
-    $this->assertText(t('Language negotiation method: @name', ['@name' => $test['expected_method_id']]));
+    $this->assertSession()->responseContains($test['expect'], $test['message']);
+    $this->assertSession()->responseContains(t('Language negotiation method: @name', ['@name' => $test['expected_method_id']]));
 
     // Get the private file and ensure it is a 200. It is important to
     // invalidate the router cache to ensure the routing system runs a full
@@ -494,7 +494,7 @@ public function testLanguageDomain() {
       'domain[en]' => '',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
-    $this->assertText('The domain may not be left blank for English', 'The form does not allow blank domains.');
+    $this->assertSession()->responseContains('The domain may not be left blank for English', 'The form does not allow blank domains.');
     $this->rebuildContainer();
 
     // Change the domain for the Italian language.
@@ -504,7 +504,7 @@ public function testLanguageDomain() {
       'domain[it]' => 'it.example.com',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
-    $this->assertText('The configuration options have been saved', 'Domain configuration is saved.');
+    $this->assertSession()->responseContains('The configuration options have been saved', 'Domain configuration is saved.');
     $this->rebuildContainer();
 
     // Try to use an invalid domain.
diff --git a/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php b/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php
index dc5ca8e46d..b817734dbf 100644
--- a/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php
@@ -66,7 +66,7 @@ public function testUrlRewritingEdgeCases() {
 
     // Check that URL rewriting is not applied to subrequests.
     $this->drupalGet('language_test/subrequest');
-    $this->assertText($this->webUser->getAccountName(), 'Page correctly retrieved');
+    $this->assertSession()->responseContains($this->webUser->getAccountName(), 'Page correctly retrieved');
   }
 
   /**
diff --git a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderInstallTest.php b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderInstallTest.php
index 79d36ff9e6..93904272f1 100644
--- a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderInstallTest.php
+++ b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderInstallTest.php
@@ -87,7 +87,7 @@ public function testCompatibility() {
     ];
     $this->assertFieldAttributes($this->entity, $new_expected_fields);
     $this->assertNotEmpty($this->cssSelect('.layout--onecol'));
-    $this->assertText('Test string');
+    $this->assertSession()->responseContains('Test string');
   }
 
 }
diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php
index b78fe175bc..854ba72f1a 100644
--- a/core/modules/link/tests/src/Functional/LinkFieldTest.php
+++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php
@@ -220,7 +220,7 @@ protected function assertValidEntries($field_name, array $valid_entries) {
       $this->drupalPostForm('entity_test/add', $edit, t('Save'));
       preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
       $id = $match[1];
-      $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+      $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
       $this->assertRaw('"' . $string . '"');
     }
   }
@@ -239,7 +239,7 @@ protected function assertInvalidEntries($field_name, array $invalid_entries) {
         "{$field_name}[0][uri]" => $invalid_value,
       ];
       $this->drupalPostForm('entity_test/add', $edit, t('Save'));
-      $this->assertText(t($error_message, ['@link_path' => $invalid_value]));
+      $this->assertSession()->responseContains(t($error_message, ['@link_path' => $invalid_value]));
     }
   }
 
@@ -292,7 +292,7 @@ public function testLinkTitle() {
       // Display creation form.
       $this->drupalGet('entity_test/add');
       // Assert label is shown.
-      $this->assertText('Read more about this entity');
+      $this->assertSession()->responseContains('Read more about this entity');
       $this->assertFieldByName("{$field_name}[0][uri]", '', 'URL field found.');
       $this->assertRaw('placeholder="http://example.com"');
 
@@ -310,7 +310,7 @@ public function testLinkTitle() {
             "{$field_name}[0][title]" => 'Example',
           ];
           $this->drupalPostForm(NULL, $edit, t('Save'));
-          $this->assertText(t('The URL field is required when the @title field is specified.', ['@title' => t('Link text')]));
+          $this->assertSession()->responseContains(t('The URL field is required when the @title field is specified.', ['@title' => t('Link text')]));
         }
         if ($title_setting === DRUPAL_REQUIRED) {
           // Verify that the link text is required, if the URL is non-empty.
@@ -318,14 +318,14 @@ public function testLinkTitle() {
             "{$field_name}[0][uri]" => 'http://www.example.com',
           ];
           $this->drupalPostForm(NULL, $edit, t('Save'));
-          $this->assertText(t('@title field is required if there is @uri input.', ['@title' => t('Link text'), '@uri' => t('URL')]));
+          $this->assertSession()->responseContains(t('@title field is required if there is @uri input.', ['@title' => t('Link text'), '@uri' => t('URL')]));
 
           // Verify that the link text is not required, if the URL is empty.
           $edit = [
             "{$field_name}[0][uri]" => '',
           ];
           $this->drupalPostForm(NULL, $edit, t('Save'));
-          $this->assertNoText(t('@name field is required.', ['@name' => t('Link text')]));
+          $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => t('Link text')]));
 
           // Verify that a URL and link text meets requirements.
           $this->drupalGet('entity_test/add');
@@ -334,7 +334,7 @@ public function testLinkTitle() {
             "{$field_name}[0][title]" => 'Example',
           ];
           $this->drupalPostForm(NULL, $edit, t('Save'));
-          $this->assertNoText(t('@name field is required.', ['@name' => t('Link text')]));
+          $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => t('Link text')]));
         }
       }
     }
@@ -348,7 +348,7 @@ public function testLinkTitle() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     $output = $this->renderTestEntity($id);
     $expected_link = (string) Link::fromTextAndUrl($value, Url::fromUri($value))->toString();
@@ -360,7 +360,7 @@ public function testLinkTitle() {
       "{$field_name}[0][title]" => $title,
     ];
     $this->drupalPostForm("entity_test/manage/$id/edit", $edit, t('Save'));
-    $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been updated.', ['@id' => $id]));
 
     $output = $this->renderTestEntity($id);
     $expected_link = (string) Link::fromTextAndUrl($title, Url::fromUri($value))->toString();
@@ -428,11 +428,11 @@ public function testLinkFormatter() {
       "{$field_name}[2][title]" => $title3,
     ];
     // Assert label is shown.
-    $this->assertText('Read more about this entity');
+    $this->assertSession()->responseContains('Read more about this entity');
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     // Verify that the link is output according to the formatter settings.
     // Not using generatePermutations(), since that leads to 32 cases, which
@@ -583,7 +583,7 @@ public function testLinkSeparateFormatter() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]));
 
     // Verify that the link is output according to the formatter settings.
     $options = [
diff --git a/core/modules/link/tests/src/Functional/LinkFieldUITest.php b/core/modules/link/tests/src/Functional/LinkFieldUITest.php
index a2b7a7898f..3829ac424c 100644
--- a/core/modules/link/tests/src/Functional/LinkFieldUITest.php
+++ b/core/modules/link/tests/src/Functional/LinkFieldUITest.php
@@ -167,7 +167,7 @@ public function runFieldUIItem($cardinality, $link_type, $title, $label, $field_
     // generate warnings.
     // @todo Mess with the formatter settings a bit here.
     $this->drupalGet("$type_path/display");
-    $this->assertText(t('Link text trimmed to @limit characters', ['@limit' => 80]));
+    $this->assertSession()->responseContains(t('Link text trimmed to @limit characters', ['@limit' => 80]));
 
     $storage = FieldStorageConfig::create([
       'field_name' => $field_name,
diff --git a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php
index 3197ff9ad6..9d5ef46049 100644
--- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php
@@ -110,7 +110,7 @@ public function testConfigTranslationModuleInstall() {
 
     // Get the front page and ensure that the translated configuration appears.
     $this->drupalGet('af');
-    $this->assertText('Test site slogan in Afrikaans');
+    $this->assertSession()->responseContains('Test site slogan in Afrikaans');
 
     $override = \Drupal::languageManager()->getLanguageConfigOverride('af', 'locale_test_translate.settings');
     $this->assertEqual('Locale can translate Afrikaans', $override->get('translatable_default_with_translation'));
@@ -124,12 +124,12 @@ public function testConfigTranslationModuleInstall() {
 
     // Install any module.
     $this->drupalPostForm('admin/modules', ['modules[dblog][enable]' => 'dblog'], t('Install'));
-    $this->assertText('Module Database Logging has been enabled.');
+    $this->assertSession()->responseContains('Module Database Logging has been enabled.');
 
     // Get the front page and ensure that the translated configuration still
     // appears.
     $this->drupalGet('af');
-    $this->assertText('Test site slogan in Afrikaans');
+    $this->assertSession()->responseContains('Test site slogan in Afrikaans');
 
     $this->rebuildContainer();
     $override = \Drupal::languageManager()->getLanguageConfigOverride('af', 'locale_test_translate.settings');
diff --git a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
index 9e2f53e269..e0c432ea01 100644
--- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
@@ -193,7 +193,7 @@ public function testConfigTranslation() {
     // translation. This test ensures the entity loaded from the request
     // upcasting will already work.
     $this->drupalGet($this->langcode . '/contact/feedback');
-    $this->assertText($category_label);
+    $this->assertSession()->responseContains($category_label);
 
     // Check if the UI does not show the translated String.
     $this->drupalGet('admin/structure/contact/manage/feedback');
diff --git a/core/modules/locale/tests/src/Functional/LocaleContentTest.php b/core/modules/locale/tests/src/Functional/LocaleContentTest.php
index 09459f9e8e..eb2d37798e 100644
--- a/core/modules/locale/tests/src/Functional/LocaleContentTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleContentTest.php
@@ -83,7 +83,7 @@ public function testContentTypeLanguageConfiguration() {
 
     // Set the content type to use multilingual support.
     $this->drupalGet("admin/structure/types/manage/{$type2->id()}");
-    $this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.');
+    $this->assertSession()->responseContains(t('Language settings'), 'Multilingual support widget present on content type configuration form.');
     $edit = [
       'language_configuration[language_alterable]' => TRUE,
     ];
@@ -103,7 +103,7 @@ public function testContentTypeLanguageConfiguration() {
     // Verify language select list is present.
     $this->assertFieldByName('langcode[0][value]', NULL, 'Language select present on the node add form.');
     // Ensure language appears.
-    $this->assertText($name, 'Language present.');
+    $this->assertSession()->responseContains($name, 'Language present.');
 
     // Create a node.
     $node_title = $this->randomMachineName();
@@ -124,7 +124,7 @@ public function testContentTypeLanguageConfiguration() {
       'langcode[0][value]' => 'en',
     ];
     $this->drupalPostForm($path, $edit, t('Save'));
-    $this->assertText(t('@title has been updated.', ['@title' => $node_title]));
+    $this->assertSession()->responseContains(t('@title has been updated.', ['@title' => $node_title]));
 
     // Verify that the creation message contains a link to a node.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'node/' . $node->id()]);
diff --git a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
index 5ed2632e3e..7bd2c3711c 100644
--- a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
@@ -138,7 +138,7 @@ public function testStandalonePoFile() {
       'files[file]' => $name,
     ], t('Import'));
     $this->assertUrl(Url::fromRoute('locale.translate_import', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
-    $this->assertText(t('File to import not found.'), 'File to import not found message.');
+    $this->assertSession()->responseContains(t('File to import not found.'), 'File to import not found message.');
 
     // Try importing a .po file with overriding strings, and ensure existing
     // strings are kept.
@@ -155,7 +155,7 @@ public function testStandalonePoFile() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), 'String not overwritten by imported string.');
+    $this->assertSession()->responseContains(t('No strings available.'), 'String not overwritten by imported string.');
 
     // This import should not have changed number of plural forms.
     $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr');
@@ -177,7 +177,7 @@ public function testStandalonePoFile() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'String overwritten by imported string.');
     // This import should have changed number of plural forms.
     $locale_plurals = \Drupal::service('locale.plural.formula')->reset()->getNumberOfPlurals('fr');
     $this->assertEqual(3, $locale_plurals, 'Plural numbers changed.');
@@ -213,7 +213,7 @@ public function testStandalonePoFile() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), 'Customized string not overwritten by imported string.');
+    $this->assertSession()->responseContains(t('No strings available.'), 'Customized string not overwritten by imported string.');
 
     // Try importing a .po file with overriding strings, and ensure existing
     // customized strings are overwritten.
@@ -232,7 +232,7 @@ public function testStandalonePoFile() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'Customized string overwritten by imported string.');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'Customized string overwritten by imported string.');
 
   }
 
@@ -279,7 +279,7 @@ public function testEmptyMsgstr() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText($str, 'Search found the string as untranslated.');
+    $this->assertSession()->responseContains($str, 'Search found the string as untranslated.');
   }
 
   /**
@@ -333,7 +333,7 @@ public function testConfigPoFile() {
         'translation' => 'all',
       ];
       $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-      $this->assertText($config_string[1], new FormattableMarkup('Translation of @string found.', ['@string' => $config_string[0]]));
+      $this->assertSession()->responseContains($config_string[1], new FormattableMarkup('Translation of @string found.', ['@string' => $config_string[0]]));
     }
 
     // Test that translations got recorded in the config system.
diff --git a/core/modules/locale/tests/src/Functional/LocalePathTest.php b/core/modules/locale/tests/src/Functional/LocalePathTest.php
index e1fbc15194..58eb42787c 100644
--- a/core/modules/locale/tests/src/Functional/LocalePathTest.php
+++ b/core/modules/locale/tests/src/Functional/LocalePathTest.php
@@ -69,7 +69,7 @@ public function testPathLanguageConfiguration() {
     // Check that the "xx" front page is readily available because path prefix
     // negotiation is pre-configured.
     $this->drupalGet($prefix);
-    $this->assertText(t('Welcome to Drupal'), 'The "xx" front page is readibly available.');
+    $this->assertSession()->responseContains(t('Welcome to Drupal'), 'The "xx" front page is readibly available.');
 
     // Create a node.
     $node = $this->drupalCreateNode(['type' => 'page']);
@@ -95,11 +95,11 @@ public function testPathLanguageConfiguration() {
 
     // Confirm English language path alias works.
     $this->drupalGet($english_path);
-    $this->assertText($node->label(), 'English alias works.');
+    $this->assertSession()->responseContains($node->label(), 'English alias works.');
 
     // Confirm custom language path alias works.
     $this->drupalGet($prefix . '/' . $custom_language_path);
-    $this->assertText($node->label(), 'Custom language alias works.');
+    $this->assertSession()->responseContains($node->label(), 'Custom language alias works.');
 
     // Create a custom path.
     $custom_path = $this->randomMachineName(8);
@@ -134,11 +134,11 @@ public function testPathLanguageConfiguration() {
 
     // Confirm that the custom path leads to the first node.
     $this->drupalGet($custom_path);
-    $this->assertText($first_node->label(), 'Custom alias returns first node.');
+    $this->assertSession()->responseContains($first_node->label(), 'Custom alias returns first node.');
 
     // Confirm that the custom path with prefix leads to the second node.
     $this->drupalGet($prefix . '/' . $custom_path);
-    $this->assertText($second_node->label(), 'Custom alias with prefix returns second node.');
+    $this->assertSession()->responseContains($second_node->label(), 'Custom alias with prefix returns second node.');
 
   }
 
diff --git a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
index 869496ef7c..9cf9203462 100644
--- a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
+++ b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
@@ -174,7 +174,7 @@ public function testPluralEditDateFormatter() {
     $this->drupalGet('user');
 
     // Member for time should be translated.
-    $this->assertText("seconde", "'Member for' text is translated.");
+    $this->assertSession()->responseContains("seconde", "'Member for' text is translated.");
 
     $path = 'admin/config/regional/translate/';
     $search = [
@@ -185,8 +185,8 @@ public function testPluralEditDateFormatter() {
     ];
     $this->drupalPostForm($path, $search, t('Filter'));
     // Plural values for the langcode fr.
-    $this->assertText('@count seconde');
-    $this->assertText('@count secondes');
+    $this->assertSession()->responseContains('@count seconde');
+    $this->assertSession()->responseContains('@count secondes');
 
     // Inject a plural source string to the database. We need to use a specific
     // langcode here because the language will be English by default and will
@@ -216,7 +216,7 @@ public function testPluralEditDateFormatter() {
     // second or minute.
     $this->adminUser->set('created', time() - 2)->save();
     $this->drupalGet('user');
-    $this->assertText("secondes updated", "'Member for' text is translated.");
+    $this->assertSession()->responseContains("secondes updated", "'Member for' text is translated.");
   }
 
   /**
@@ -256,8 +256,8 @@ public function testPluralEditExport() {
 
     // Check if the source appears on the translation page.
     $this->drupalGet('admin/config/regional/translate');
-    $this->assertText("1 hour");
-    $this->assertText("@count hours");
+    $this->assertSession()->responseContains("1 hour");
+    $this->assertSession()->responseContains("@count hours");
 
     // Look up editing page for this plural string and check fields.
     $path = 'admin/config/regional/translate/';
@@ -266,15 +266,15 @@ public function testPluralEditExport() {
     ];
     $this->drupalPostForm($path, $search, t('Filter'));
     // Labels for plural editing elements.
-    $this->assertText('Singular form');
-    $this->assertText('First plural form');
-    $this->assertText('2. plural form');
-    $this->assertNoText('3. plural form');
+    $this->assertSession()->responseContains('Singular form');
+    $this->assertSession()->responseContains('First plural form');
+    $this->assertSession()->responseContains('2. plural form');
+    $this->assertSession()->responseNotContains('3. plural form');
 
     // Plural values for langcode hr.
-    $this->assertText('@count sat');
-    $this->assertText('@count sata');
-    $this->assertText('@count sati');
+    $this->assertSession()->responseContains('@count sat');
+    $this->assertSession()->responseContains('@count sata');
+    $this->assertSession()->responseContains('@count sati');
 
     $connection = Database::getConnection();
     // Edit langcode hr translations and see if that took effect.
@@ -289,9 +289,9 @@ public function testPluralEditExport() {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     // Plural values for the langcode fr.
-    $this->assertText('@count heure');
-    $this->assertText('@count heures');
-    $this->assertNoText('2. plural form');
+    $this->assertSession()->responseContains('@count heure');
+    $this->assertSession()->responseContains('@count heures');
+    $this->assertSession()->responseNotContains('2. plural form');
 
     // Edit langcode fr translations and see if that took effect.
     $edit = [
diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php
index e7b9258b83..0efde12a40 100644
--- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php
@@ -69,7 +69,7 @@ public function testStringTranslation() {
     // Reset locale cache.
     $this->container->get('string_translation')->reset();
     $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
-    $this->assertText(t($name), 'Test language added.');
+    $this->assertSession()->responseContains(t($name), 'Test language added.');
     $this->drupalLogout();
 
     // Search for the name and translate it.
@@ -80,10 +80,10 @@ public function testStringTranslation() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText($name, 'Search found the string as untranslated.');
+    $this->assertSession()->responseContains($name, 'Search found the string as untranslated.');
 
     // No t() here, it's surely not translated yet.
-    $this->assertText($name, 'name found on edit screen.');
+    $this->assertSession()->responseContains($name, 'name found on edit screen.');
     // Verify that there is no way to translate the string to English.
     $this->assertSession()->optionNotExists('edit-langcode', 'en');
     $this->drupalLogout();
@@ -92,7 +92,7 @@ public function testStringTranslation() {
     $this->drupalLogout();
     $this->drupalLogin($translate_user);
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText($name, 'Search found the string as untranslated.');
+    $this->assertSession()->responseContains($name, 'Search found the string as untranslated.');
 
     // Assume this is the only result, given the random name.
     $textarea = current($this->xpath('//textarea'));
@@ -101,7 +101,7 @@ public function testStringTranslation() {
       $lid => $translation,
     ];
     $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
-    $this->assertText(t('The strings have been saved.'), 'The strings have been saved.');
+    $this->assertSession()->responseContains(t('The strings have been saved.'), 'The strings have been saved.');
     $url_bits = explode('?', $this->getUrl());
     $this->assertEqual($url_bits[0], Url::fromRoute('locale.translate_page', [], ['absolute' => TRUE])->toString(), 'Correct page redirection.');
     $search = [
@@ -147,12 +147,12 @@ public function testStringTranslation() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), 'String is translated.');
+    $this->assertSession()->responseContains(t('No strings available.'), 'String is translated.');
 
     // Test invalidation of 'rendered' cache tag after string translation.
     $this->drupalLogout();
     $this->drupalGet('xx/user/login');
-    $this->assertText('Enter the password that accompanies your username.');
+    $this->assertSession()->responseContains('Enter the password that accompanies your username.');
 
     $this->drupalLogin($translate_user);
     $search = [
@@ -170,7 +170,7 @@ public function testStringTranslation() {
 
     $this->drupalLogout();
     $this->drupalGet('xx/user/login');
-    $this->assertText('Please enter your Llama username.');
+    $this->assertSession()->responseContains('Please enter your Llama username.');
 
     // Delete the language.
     $this->drupalLogin($admin_user);
@@ -209,7 +209,7 @@ public function testStringTranslation() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'The translation has been removed');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'The translation has been removed');
   }
 
   /**
@@ -325,7 +325,7 @@ public function testStringValidation() {
       // Check for a form error on the textarea.
       $form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class');
       $this->assertStringContainsString('error', $form_class[0]->getText(), 'The string was rejected as unsafe.');
-      $this->assertNoText(t('The string has been saved.'), 'The string was not saved.');
+      $this->assertSession()->responseNotContains(t('The string has been saved.'), 'The string was not saved.');
     }
   }
 
@@ -377,10 +377,10 @@ public function testStringSearch() {
       'translation' => 'all',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    // assertText() seems to remove the input field where $name always could be
+    // assertSession()->responseContains() seems to remove the input field where $name always could be
     // found, so this is not a false assert. See how assertNoText succeeds
     // later.
-    $this->assertText($name, 'Search found the string.');
+    $this->assertSession()->responseContains($name, 'Search found the string.');
 
     // Ensure untranslated string doesn't appear if searching on 'only
     // translated strings'.
@@ -390,7 +390,7 @@ public function testStringSearch() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), "Search didn't find the string.");
+    $this->assertSession()->responseContains(t('No strings available.'), "Search didn't find the string.");
 
     // Ensure untranslated string appears if searching on 'only untranslated
     // strings'.
@@ -400,7 +400,7 @@ public function testStringSearch() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'Search found the string.');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'Search found the string.');
 
     // Add translation.
     // Assume this is the only result, given the random name.
@@ -420,7 +420,7 @@ public function testStringSearch() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'Search found the translation.');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'Search found the translation.');
 
     // Ensure translated source string doesn't appear if searching on 'only
     // untranslated strings'.
@@ -430,7 +430,7 @@ public function testStringSearch() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), "Search didn't find the source string.");
+    $this->assertSession()->responseContains(t('No strings available.'), "Search didn't find the source string.");
 
     // Ensure translated string doesn't appear if searching on 'only
     // untranslated strings'.
@@ -440,7 +440,7 @@ public function testStringSearch() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), "Search didn't find the translation.");
+    $this->assertSession()->responseContains(t('No strings available.'), "Search didn't find the translation.");
 
     // Ensure translated string does appear if searching on the custom language.
     $search = [
@@ -449,7 +449,7 @@ public function testStringSearch() {
       'translation' => 'all',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'Search found the translation.');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'Search found the translation.');
 
     // Ensure translated string doesn't appear if searching in System (English).
     $search = [
@@ -458,7 +458,7 @@ public function testStringSearch() {
       'translation' => 'all',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), "Search didn't find the translation.");
+    $this->assertSession()->responseContains(t('No strings available.'), "Search didn't find the translation.");
 
     // Search for a string that isn't in the system.
     $unavailable_string = $this->randomMachineName(16);
@@ -468,7 +468,7 @@ public function testStringSearch() {
       'translation' => 'all',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText(t('No strings available.'), "Search didn't find the invalid string.");
+    $this->assertSession()->responseContains(t('No strings available.'), "Search didn't find the invalid string.");
   }
 
   /**
@@ -506,7 +506,7 @@ public function testUICustomizedStrings() {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
 
-    $this->assertText($translation->getString(), 'Translation is found in search result.');
+    $this->assertSession()->responseContains($translation->getString(), 'Translation is found in search result.');
 
     // Submit the translations without changing the translation.
     $textarea = current($this->xpath('//textarea'));
@@ -525,7 +525,7 @@ public function testUICustomizedStrings() {
       'customized' => '0',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText($string->getString(), 'Translation is not marked as customized.');
+    $this->assertSession()->responseContains($string->getString(), 'Translation is not marked as customized.');
 
     // Submit the translations with a new translation.
     $textarea = current($this->xpath('//textarea'));
@@ -544,7 +544,7 @@ public function testUICustomizedStrings() {
       'customized' => '1',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText($string->getString(), "Translation is marked as customized.");
+    $this->assertSession()->responseContains($string->getString(), "Translation is marked as customized.");
   }
 
 }
diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php
index 99114f56d5..84e225966a 100644
--- a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php
@@ -43,7 +43,7 @@ public function testInterface() {
     // No language added.
     // Check status page and Available translation updates page.
     $this->drupalGet('admin/reports/status');
-    $this->assertNoText(t('Translation update status'), 'No status message');
+    $this->assertSession()->responseNotContains(t('Translation update status'), 'No status message');
 
     $this->drupalGet('admin/reports/translations');
     $this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()]), 'Language message');
@@ -58,10 +58,10 @@ public function testInterface() {
 
     // One language added, all translations up to date.
     $this->drupalGet('admin/reports/status');
-    $this->assertText(t('Translation update status'), 'Status message');
-    $this->assertText(t('Up to date'), 'Translations up to date');
+    $this->assertSession()->responseContains(t('Translation update status'), 'Status message');
+    $this->assertSession()->responseContains(t('Up to date'), 'Translations up to date');
     $this->drupalGet('admin/reports/translations');
-    $this->assertText(t('All translations up to date.'), 'Translations up to date');
+    $this->assertSession()->responseContains(t('All translations up to date.'), 'Translations up to date');
 
     // Set locale_test_translate module to have a local translation available.
     $status = locale_translation_get_status();
@@ -70,10 +70,10 @@ public function testInterface() {
 
     // Check if updates are available for German.
     $this->drupalGet('admin/reports/status');
-    $this->assertText(t('Translation update status'), 'Status message');
+    $this->assertSession()->responseContains(t('Translation update status'), 'Status message');
     $this->assertRaw(t('Updates available for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Updates available message');
     $this->drupalGet('admin/reports/translations');
-    $this->assertText(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available');
+    $this->assertSession()->responseContains(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available');
 
     // Set locale_test_translate module to have a dev release and no
     // translation found.
@@ -84,10 +84,10 @@ public function testInterface() {
 
     // Check if no updates were found.
     $this->drupalGet('admin/reports/status');
-    $this->assertText(t('Translation update status'), 'Status message');
+    $this->assertSession()->responseContains(t('Translation update status'), 'Status message');
     $this->assertRaw(t('Missing translations for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Missing translations message');
     $this->drupalGet('admin/reports/translations');
-    $this->assertText(t('Missing translations for one project'), 'No translations found');
+    $this->assertSession()->responseContains(t('Missing translations for one project'), 'No translations found');
     $release_details = new FormattableMarkup('@module (@version). @info', [
       '@module' => 'Locale test translate',
       '@version' => '1.3-dev',
@@ -104,8 +104,8 @@ public function testInterface() {
 
     // Check if Drupal core is not translated.
     $this->drupalGet('admin/reports/translations');
-    $this->assertText(t('Missing translations for 2 projects'), 'No translations found');
-    $this->assertText(t('@module (@version).', ['@module' => t('Drupal core'), '@version' => '8.1.1']), 'Release details');
+    $this->assertSession()->responseContains(t('Missing translations for 2 projects'), 'No translations found');
+    $this->assertSession()->responseContains(t('@module (@version).', ['@module' => t('Drupal core'), '@version' => '8.1.1']), 'Release details');
 
     // Override Drupal core translation status as 'translations available'.
     $status = locale_translation_get_status();
@@ -116,8 +116,8 @@ public function testInterface() {
 
     // Check if translations are available for Drupal core.
     $this->drupalGet('admin/reports/translations');
-    $this->assertText(t('Updates for: @project', ['@project' => t('Drupal core')]), 'Translations found');
-    $this->assertText(new FormattableMarkup('@module (@date)', [
+    $this->assertSession()->responseContains(t('Updates for: @project', ['@project' => t('Drupal core')]), 'Translations found');
+    $this->assertSession()->responseContains(new FormattableMarkup('@module (@date)', [
       '@module' => t('Drupal core'),
       '@date' => $this->container->get('date.formatter')->format(REQUEST_TIME, 'html_date'),
     ]), 'Core translation update');
diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
index 7c470056a5..6a330194cd 100644
--- a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
@@ -49,7 +49,7 @@ protected function setUp(): void {
   public function testUpdateCheckStatus() {
     // Case when contributed modules are absent.
     $this->drupalGet('admin/reports/translations');
-    $this->assertText(t('Missing translations for one project'));
+    $this->assertSession()->responseContains(t('Missing translations for one project'));
 
     $config = $this->config('locale.settings');
     // Set a flag to let the locale_test module replace the project data with a
@@ -122,11 +122,11 @@ public function testUpdateImportSourceRemote() {
 
     // Check the status on the Available translation status page.
     $this->assertRaw('<label for="edit-langcodes-de" class="visually-hidden">Update German</label>', 'German language found');
-    $this->assertText('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test', 'Updates found');
+    $this->assertSession()->responseContains('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test', 'Updates found');
     /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
     $date_formatter = $this->container->get('date.formatter');
-    $this->assertText('Contributed module one (' . $date_formatter->format($this->timestampNew, 'html_date') . ')', 'Updates for Contrib module one');
-    $this->assertText('Contributed module two (' . $date_formatter->format($this->timestampNew, 'html_date') . ')', 'Updates for Contrib module two');
+    $this->assertSession()->responseContains('Contributed module one (' . $date_formatter->format($this->timestampNew, 'html_date') . ')', 'Updates for Contrib module one');
+    $this->assertSession()->responseContains('Contributed module two (' . $date_formatter->format($this->timestampNew, 'html_date') . ')', 'Updates for Contrib module two');
 
     // Execute the translation update.
     $this->drupalPostForm('admin/reports/translations', [], t('Update translations'));
@@ -395,8 +395,8 @@ public function testEnableCustomLanguage() {
 
     // Ensure the translation file is automatically imported when the language
     // was added.
-    $this->assertText(t('One translation file imported.'), 'Language file automatically imported.');
-    $this->assertText(t('One translation string was skipped because of disallowed or malformed HTML'), 'Language file automatically imported.');
+    $this->assertSession()->responseContains(t('One translation file imported.'), 'Language file automatically imported.');
+    $this->assertSession()->responseContains(t('One translation string was skipped because of disallowed or malformed HTML'), 'Language file automatically imported.');
 
     // Ensure the strings were successfully imported.
     $search = [
@@ -405,7 +405,7 @@ public function testEnableCustomLanguage() {
       'translation' => 'translated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available.'), 'String successfully imported.');
+    $this->assertSession()->responseNotContains(t('No strings available.'), 'String successfully imported.');
 
     // Ensure the multiline string was imported.
     $search = [
@@ -414,7 +414,7 @@ public function testEnableCustomLanguage() {
       'translation' => 'all',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText('Multiline translation string to make sure that import works with it.', 'String successfully imported.');
+    $this->assertSession()->responseContains('Multiline translation string to make sure that import works with it.', 'String successfully imported.');
 
     // Ensure 'Allowed HTML source string' was imported but the translation for
     // 'Another allowed HTML source string' was not because it contains invalid
@@ -425,8 +425,8 @@ public function testEnableCustomLanguage() {
       'translation' => 'all',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertText('Allowed HTML source string', 'String successfully imported.');
-    $this->assertNoText('Another allowed HTML source string', 'String with disallowed translation not imported.');
+    $this->assertSession()->responseContains('Allowed HTML source string', 'String successfully imported.');
+    $this->assertSession()->responseNotContains('Another allowed HTML source string', 'String with disallowed translation not imported.');
   }
 
 }
diff --git a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php
index 3769a8dadb..d3aabcca7c 100644
--- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php
+++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php
@@ -47,7 +47,7 @@ public function testMenuLinkContentDeleteForm() {
       ],
       t('Save')
     );
-    $this->assertText(t('The menu link has been saved.'));
+    $this->assertSession()->responseContains(t('The menu link has been saved.'));
 
     $menu_link = MenuLinkContent::load(1);
     $this->drupalGet($menu_link->toUrl('delete-form'));
diff --git a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php
index 1e590223ad..7c36bc124a 100644
--- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php
+++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php
@@ -94,7 +94,7 @@ public function testMenuLinkContentForm() {
       ],
       t('Save')
     );
-    $this->assertText(t('The menu link has been saved.'));
+    $this->assertSession()->responseContains(t('The menu link has been saved.'));
   }
 
   /**
@@ -110,7 +110,7 @@ public function testMenuLinkContentFormValidation() {
       ],
       t('Save')
     );
-    $this->assertText(t('Manually entered paths should start with one of the following characters: / ? #'));
+    $this->assertSession()->responseContains(t('Manually entered paths should start with one of the following characters: / ? #'));
   }
 
 }
diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php
index 256f175775..608616b444 100644
--- a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php
+++ b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php
@@ -93,8 +93,8 @@ public function testMenuNodeFormWidget() {
 
     // Verify that no menu settings are displayed and nodes can be created.
     $this->drupalGet('node/add/page');
-    $this->assertText(t('Create Basic page'));
-    $this->assertNoText(t('Menu settings'));
+    $this->assertSession()->responseContains(t('Create Basic page'));
+    $this->assertSession()->responseNotContains(t('Menu settings'));
     $node_title = $this->randomMachineName();
     $edit = [
       'title[0][value]' => $node_title,
@@ -111,7 +111,7 @@ public function testMenuNodeFormWidget() {
       'menu_parent' => 'main:',
     ];
     $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
-    $this->assertText(t('The selected menu item is not under one of the selected menus.'));
+    $this->assertSession()->responseContains(t('The selected menu item is not under one of the selected menus.'));
     $this->assertNoRaw(t('The content type %name has been updated.', ['%name' => 'Basic page']));
 
     // Enable Tools menu as available menu.
@@ -226,7 +226,7 @@ public function testMenuNodeFormWidget() {
     // Assert that disabled Administration menu is not shown on the
     // node/$nid/edit page.
     $this->drupalGet('node/' . $node->id() . '/edit');
-    $this->assertText('Provide a menu link', 'Link in not allowed menu not shown in node edit form');
+    $this->assertSession()->responseContains('Provide a menu link', 'Link in not allowed menu not shown in node edit form');
     // Assert that the link is still in the Administration menu after save.
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $link = MenuLinkContent::load($item->id());
diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
index 3106a22946..ff57197eb7 100644
--- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
+++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
@@ -155,7 +155,7 @@ public function testMenu() {
     $id = $instance->getPluginId();
     $this->drupalPostForm("admin/structure/menu/link/$id/edit", $edit, t('Save'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The menu link has been saved.');
+    $this->assertSession()->responseContains('The menu link has been saved.');
     $menu_link_manager->resetDefinitions();
 
     $instance = $menu_link_manager->createInstance($instance->getPluginId());
@@ -230,12 +230,12 @@ public function addCustomMenu() {
     // Verify that the confirmation message is displayed.
     $this->assertRaw(t('Menu %label has been added.', ['%label' => $label]));
     $this->drupalGet('admin/structure/menu');
-    $this->assertText($label, 'Menu created');
+    $this->assertSession()->responseContains($label, 'Menu created');
 
     // Confirm that the custom menu block is available.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
     $this->clickLink('Place block');
-    $this->assertText($label);
+    $this->assertSession()->responseContains($label);
 
     // Enable the block.
     $block = $this->drupalPlaceBlock('system_menu_block:' . $menu_name);
@@ -269,7 +269,7 @@ public function deleteCustomMenu() {
 
     // Try to delete the main menu.
     $this->drupalGet('admin/structure/menu/manage/main/delete');
-    $this->assertText(t('You are not authorized to access this page.'));
+    $this->assertSession()->responseContains(t('You are not authorized to access this page.'));
   }
 
   /**
@@ -550,7 +550,7 @@ public function testSystemMenuRename() {
     $default_theme = $this->config('system.theme')->get('default');
     $this->drupalget('admin/structure/block/list/' . $default_theme);
     $this->clickLink('Place block');
-    $this->assertText($edit['label']);
+    $this->assertSession()->responseContains($edit['label']);
   }
 
   /**
@@ -572,7 +572,7 @@ public function testUnpublishedNodeMenuItem() {
     $this->drupalLogout();
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/structure/menu/manage/' . $item->getMenuName());
-    $this->assertNoText($item->getTitle(), "Menu link pointing to unpublished node is only visible to users with 'bypass node access' permission");
+    $this->assertSession()->responseNotContains($item->getTitle(), "Menu link pointing to unpublished node is only visible to users with 'bypass node access' permission");
     // The cache contexts associated with the (in)accessible menu links are
     // bubbled. See DefaultMenuLinkTreeManipulators::menuLinkCheckAccess().
     $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Contexts', 'user.permissions');
@@ -616,7 +616,7 @@ public function addMenuLink($parent = '', $path = '/', $menu_name = 'tools', $ex
     // Add menu link.
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The menu link has been saved.');
+    $this->assertSession()->responseContains('The menu link has been saved.');
 
     $menu_links = \Drupal::entityTypeManager()->getStorage('menu_link_content')->loadByProperties(['title' => $title]);
 
@@ -759,10 +759,10 @@ public function modifyMenuLink(MenuLinkContent $item) {
     $edit['title[0][value]'] = $title;
     $this->drupalPostForm("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The menu link has been saved.');
+    $this->assertSession()->responseContains('The menu link has been saved.');
     // Verify menu link.
     $this->drupalGet('admin/structure/menu/manage/' . $item->getMenuName());
-    $this->assertText($title, 'Menu link was edited');
+    $this->assertSession()->responseContains($title, 'Menu link was edited');
   }
 
   /**
@@ -801,7 +801,7 @@ public function deleteMenuLink(MenuLinkContent $item) {
 
     // Verify deletion.
     $this->drupalGet('');
-    $this->assertNoText($title, 'Menu link was deleted');
+    $this->assertSession()->responseNotContains($title, 'Menu link was deleted');
   }
 
   /**
@@ -815,12 +815,12 @@ public function toggleMenuLink(MenuLinkContent $item) {
 
     // Verify menu link is absent.
     $this->drupalGet('');
-    $this->assertNoText($item->getTitle(), 'Menu link was not displayed');
+    $this->assertSession()->responseNotContains($item->getTitle(), 'Menu link was not displayed');
     $this->enableMenuLink($item);
 
     // Verify menu link is displayed.
     $this->drupalGet('');
-    $this->assertText($item->getTitle(), 'Menu link was displayed');
+    $this->assertSession()->responseContains($item->getTitle(), 'Menu link was displayed');
   }
 
   /**
@@ -939,21 +939,21 @@ private function verifyAccess($response = 200) {
     $this->drupalGet('admin/help/menu');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Menu'), 'Menu help was displayed');
+      $this->assertSession()->responseContains(t('Menu'), 'Menu help was displayed');
     }
 
     // View menu build overview page.
     $this->drupalGet('admin/structure/menu');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Menus'), 'Menu build overview page was displayed');
+      $this->assertSession()->responseContains(t('Menus'), 'Menu build overview page was displayed');
     }
 
     // View tools menu customization page.
     $this->drupalGet('admin/structure/menu/manage/' . $this->menu->id());
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Tools'), 'Tools menu page was displayed');
+      $this->assertSession()->responseContains(t('Tools'), 'Tools menu page was displayed');
     }
 
     // View menu edit page for a static link.
@@ -961,14 +961,14 @@ private function verifyAccess($response = 200) {
     $this->drupalGet('admin/structure/menu/link/' . $item->getPluginId() . '/edit');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Edit menu item'), 'Menu edit page was displayed');
+      $this->assertSession()->responseContains(t('Edit menu item'), 'Menu edit page was displayed');
     }
 
     // View add menu page.
     $this->drupalGet('admin/structure/menu/add');
     $this->assertSession()->statusCodeEquals($response);
     if ($response == 200) {
-      $this->assertText(t('Menus'), 'Add menu page was displayed');
+      $this->assertSession()->responseContains(t('Menus'), 'Add menu page was displayed');
     }
   }
 
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php
index 32c93a626a..99c8166652 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php
@@ -30,13 +30,13 @@ public function testAccess() {
     $this->drupalLogin($this->rootUser);
     $this->drupalGet('upgrade');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Upgrade'));
+    $this->assertSession()->responseContains(t('Upgrade'));
 
     $user = $this->createUser(['administer software updates']);
     $this->drupalLogin($user);
     $this->drupalGet('upgrade');
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertNoText(t('Upgrade'));
+    $this->assertSession()->responseNotContains(t('Upgrade'));
   }
 
 }
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
index 5eb14ccdd5..b10f19f4d5 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
@@ -140,7 +140,7 @@ public function testMigrateUpgradeExecute() {
     $this->assertReviewPage($session, $available_paths, $missing_paths);
 
     $this->drupalPostForm(NULL, [], t('Perform upgrade'));
-    $this->assertText(t('Congratulations, you upgraded Drupal!'));
+    $this->assertSession()->responseContains(t('Congratulations, you upgraded Drupal!'));
     $this->assertMigrationResults($this->getEntityCounts(), $version);
 
     \Drupal::service('module_installer')->install(['forum']);
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
index 4b6754487c..d4305a859f 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
@@ -176,7 +176,7 @@ protected function assertUpgradePaths(WebAssert $session, array $available_paths
    *   An array of modules that will not be upgraded.
    */
   protected function assertReviewPage(WebAssert $session, array $available_paths, array $missing_paths) {
-    $this->assertText('What will be upgraded?');
+    $this->assertSession()->responseContains('What will be upgraded?');
 
     // Ensure there are no errors about the missing modules from the test module.
     $session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.'));
diff --git a/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php b/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php
index 53ac68709c..8bd03ecfb7 100644
--- a/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php
+++ b/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php
@@ -88,12 +88,12 @@ public function testNodeAccessAdministerField() {
     // Log in as the administrator and confirm that the field value is present.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($value, 'The saved field value is visible to an administrator.');
+    $this->assertSession()->responseContains($value, 'The saved field value is visible to an administrator.');
 
     // Log in as the content admin and try to view the node.
     $this->drupalLogin($this->contentAdminUser);
     $this->drupalGet('node/' . $node->id());
-    $this->assertText('Access denied', 'Access is denied for the content admin.');
+    $this->assertSession()->responseContains('Access denied', 'Access is denied for the content admin.');
 
     // Modify the field default as the content admin.
     $edit = [];
@@ -110,7 +110,7 @@ public function testNodeAccessAdministerField() {
 
     // Confirm that the existing node still has the correct field value.
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($value, 'The original field value is visible to an administrator.');
+    $this->assertSession()->responseContains($value, 'The original field value is visible to an administrator.');
 
     // Confirm that the new default value appears when creating a new node.
     $this->drupalGet('node/add/page');
diff --git a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
index ffb2b77678..1d763c2c89 100644
--- a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
+++ b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
@@ -64,8 +64,8 @@ public function testCommentPager() {
     // View the node page. With the default 50 comments per page there should
     // be two pages (0, 1) but no third (2) page.
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($node->label());
-    $this->assertText(t('Comments'));
+    $this->assertSession()->responseContains($node->label());
+    $this->assertSession()->responseContains(t('Comments'));
     $this->assertRaw('page=1');
     $this->assertNoRaw('page=2');
   }
diff --git a/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php b/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php
index eb08edb0c2..2a7b4d354b 100644
--- a/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php
+++ b/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php
@@ -77,7 +77,7 @@ public function testNodeAccessRebuildNodeGrants() {
     $this->drupalGet('admin/reports/status');
     $this->clickLink(t('Rebuild permissions'));
     $this->drupalPostForm(NULL, [], t('Rebuild permissions'));
-    $this->assertText(t('The content access permissions have been rebuilt.'));
+    $this->assertSession()->responseContains(t('The content access permissions have been rebuilt.'));
 
     // Test if the rebuild by user that cannot bypass node access and does not
     // have access to the nodes has been successful.
@@ -113,7 +113,7 @@ public function testNodeAccessRebuildNoAccessModules() {
     $this->drupalGet('admin/reports/status');
     $this->clickLink(t('Rebuild permissions'));
     $this->drupalPostForm(NULL, [], t('Rebuild permissions'));
-    $this->assertText(t('Content permissions have been rebuilt.'));
+    $this->assertSession()->responseContains(t('Content permissions have been rebuilt.'));
     $this->assertNull(\Drupal::state()->get('node.node_access_needs_rebuild'), 'Node access permissions have been rebuilt');
 
     // Default realm access is still present.
diff --git a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php
index 11c646df8c..5d87b888f7 100644
--- a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php
+++ b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php
@@ -50,8 +50,8 @@ public function testAssignOwnerNodeActionConfiguration() {
     $action_id = $edit['id'];
 
     // Make sure that the new action was saved properly.
-    $this->assertText(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully saved.');
-    $this->assertText($action_label, 'The label of the node_assign_owner_action action appears on the actions administration page after saving.');
+    $this->assertSession()->responseContains(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully saved.');
+    $this->assertSession()->responseContains($action_label, 'The label of the node_assign_owner_action action appears on the actions administration page after saving.');
 
     // Make another POST request to the action edit page.
     $this->clickLink(t('Configure'));
@@ -63,9 +63,9 @@ public function testAssignOwnerNodeActionConfiguration() {
     $this->assertSession()->statusCodeEquals(200);
 
     // Make sure that the action updated properly.
-    $this->assertText(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully updated.');
-    $this->assertNoText($action_label, 'The old label for the node_assign_owner_action action does not appear on the actions administration page after updating.');
-    $this->assertText($new_action_label, 'The new label for the node_assign_owner_action action appears on the actions administration page after updating.');
+    $this->assertSession()->responseContains(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully updated.');
+    $this->assertSession()->responseNotContains($action_label, 'The old label for the node_assign_owner_action action does not appear on the actions administration page after updating.');
+    $this->assertSession()->responseContains($new_action_label, 'The new label for the node_assign_owner_action action appears on the actions administration page after updating.');
 
     // Make sure that deletions work properly.
     $this->drupalGet('admin/config/system/actions');
@@ -79,7 +79,7 @@ public function testAssignOwnerNodeActionConfiguration() {
     $this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]), 'The delete confirmation message appears after deleting the node_assign_owner_action action.');
     $this->drupalGet('admin/config/system/actions');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText($new_action_label, 'The label for the node_assign_owner_action action does not appear on the actions administration page after deleting.');
+    $this->assertSession()->responseNotContains($new_action_label, 'The label for the node_assign_owner_action action does not appear on the actions administration page after deleting.');
 
     $action = Action::load($action_id);
     $this->assertNull($action, 'The node_assign_owner_action action is not available after being deleted.');
diff --git a/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php b/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php
index 1bf46d2aef..3a8bb099ee 100644
--- a/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php
+++ b/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php
@@ -67,7 +67,7 @@ public function testRecentNodeBlock() {
 
     // Test that block is not visible without nodes.
     $this->drupalGet('');
-    $this->assertText(t('No content available.'), 'Block with "No content available." found.');
+    $this->assertSession()->responseContains(t('No content available.'), 'Block with "No content available." found.');
 
     // Add some test nodes.
     $default_settings = ['uid' => $this->webUser->id(), 'type' => 'article'];
@@ -94,13 +94,13 @@ public function testRecentNodeBlock() {
     // see the block.
     $this->drupalLogout();
     $this->drupalGet('');
-    $this->assertNoText($block->label(), 'Block was not found.');
+    $this->assertSession()->responseNotContains($block->label(), 'Block was not found.');
 
     // Test that only the 2 latest nodes are shown.
     $this->drupalLogin($this->webUser);
-    $this->assertNoText($node1->label(), 'Node not found in block.');
-    $this->assertText($node2->label(), 'Node found in block.');
-    $this->assertText($node3->label(), 'Node found in block.');
+    $this->assertSession()->responseNotContains($node1->label(), 'Node not found in block.');
+    $this->assertSession()->responseContains($node2->label(), 'Node found in block.');
+    $this->assertSession()->responseContains($node3->label(), 'Node found in block.');
 
     // Check to make sure nodes are in the right order.
     $this->assertNotEmpty($this->xpath('//div[@id="block-test-block"]//div[@class="item-list"]/ul/li[1]/div/span/a[text() = "' . $node3->label() . '"]'), 'Nodes were ordered correctly in block.');
@@ -117,10 +117,10 @@ public function testRecentNodeBlock() {
 
     // Test that all four nodes are shown.
     $this->drupalGet('');
-    $this->assertText($node1->label(), 'Node found in block.');
-    $this->assertText($node2->label(), 'Node found in block.');
-    $this->assertText($node3->label(), 'Node found in block.');
-    $this->assertText($node4->label(), 'Node found in block.');
+    $this->assertSession()->responseContains($node1->label(), 'Node found in block.');
+    $this->assertSession()->responseContains($node2->label(), 'Node found in block.');
+    $this->assertSession()->responseContains($node3->label(), 'Node found in block.');
+    $this->assertSession()->responseContains($node4->label(), 'Node found in block.');
 
     $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user']);
 
@@ -146,7 +146,7 @@ public function testRecentNodeBlock() {
     // Verify visibility rules.
     $this->drupalGet('');
     $label = $block->label();
-    $this->assertNoText($label, 'Block was not displayed on the front page.');
+    $this->assertSession()->responseNotContains($label, 'Block was not displayed on the front page.');
     $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user', 'route']);
 
     // Ensure that a page that does not have a node context can still be cached,
@@ -155,21 +155,21 @@ public function testRecentNodeBlock() {
     $this->assertSame('HIT', $this->getSession()->getResponseHeader('X-Drupal-Dynamic-Cache'));
 
     $this->drupalGet('node/add/article');
-    $this->assertText($label, 'Block was displayed on the node/add/article page.');
+    $this->assertSession()->responseContains($label, 'Block was displayed on the node/add/article page.');
     $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'session', 'theme', 'url.path', 'url.query_args', 'user', 'route']);
 
     // The node/add/article page is an admin path and currently uncacheable.
     $this->assertSame('UNCACHEABLE', $this->getSession()->getResponseHeader('X-Drupal-Dynamic-Cache'));
 
     $this->drupalGet('node/' . $node1->id());
-    $this->assertText($label, 'Block was displayed on the node/N when node is of type article.');
+    $this->assertSession()->responseContains($label, 'Block was displayed on the node/N when node is of type article.');
     $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.site', 'user', 'route', 'timezone']);
     $this->assertSame('MISS', $this->getSession()->getResponseHeader('X-Drupal-Dynamic-Cache'));
     $this->drupalGet('node/' . $node1->id());
     $this->assertSame('HIT', $this->getSession()->getResponseHeader('X-Drupal-Dynamic-Cache'));
 
     $this->drupalGet('node/' . $node5->id());
-    $this->assertNoText($label, 'Block was not displayed on nodes of type page.');
+    $this->assertSession()->responseNotContains($label, 'Block was not displayed on nodes of type page.');
     $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.site', 'user', 'route', 'timezone']);
     $this->assertSame('MISS', $this->getSession()->getResponseHeader('X-Drupal-Dynamic-Cache'));
     $this->drupalGet('node/' . $node5->id());
@@ -177,7 +177,7 @@ public function testRecentNodeBlock() {
 
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/structure/block');
-    $this->assertText($label, 'Block was displayed on the admin/structure/block page.');
+    $this->assertSession()->responseContains($label, 'Block was displayed on the admin/structure/block page.');
     $this->assertLinkByHref($block->toUrl()->toString());
   }
 
diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php
index c2685a5cfc..895a8b403b 100644
--- a/core/modules/node/tests/src/Functional/NodeCreationTest.php
+++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php
@@ -57,7 +57,7 @@ public function testNodeCreation() {
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
 
     // Check that the Basic page has been created.
-    $this->assertText(t('@post @title has been created.', ['@post' => 'Basic page', '@title' => $edit['title[0][value]']]), 'Basic page created.');
+    $this->assertSession()->responseContains(t('@post @title has been created.', ['@post' => 'Basic page', '@title' => $edit['title[0][value]']]), 'Basic page created.');
 
     // Verify that the creation message contains a link to a node.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'node/']);
@@ -69,8 +69,8 @@ public function testNodeCreation() {
 
     // Verify that pages do not show submitted information by default.
     $this->drupalGet('node/' . $node->id());
-    $this->assertNoText($node->getOwner()->getAccountName());
-    $this->assertNoText($this->container->get('date.formatter')->format($node->getCreatedTime()));
+    $this->assertSession()->responseNotContains($node->getOwner()->getAccountName());
+    $this->assertSession()->responseNotContains($this->container->get('date.formatter')->format($node->getCreatedTime()));
 
     // Change the node type setting to show submitted by information.
     /** @var \Drupal\node\NodeTypeInterface $node_type */
@@ -79,8 +79,8 @@ public function testNodeCreation() {
     $node_type->save();
 
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($node->getOwner()->getAccountName());
-    $this->assertText($this->container->get('date.formatter')->format($node->getCreatedTime()));
+    $this->assertSession()->responseContains($node->getOwner()->getAccountName());
+    $this->assertSession()->responseContains($this->container->get('date.formatter')->format($node->getCreatedTime()));
 
     // Check if the node revision checkbox is not rendered on node creation form.
     $admin_user = $this->drupalCreateUser(['administer nodes', 'create page content']);
@@ -142,10 +142,10 @@ public function testUnpublishedNodeCreation() {
 
     // Check that the user was redirected to the home page.
     $this->assertUrl('');
-    $this->assertText(t('Test page text'));
+    $this->assertSession()->responseContains(t('Test page text'));
 
     // Confirm that the node was created.
-    $this->assertText(t('@post @title has been created.', ['@post' => 'Basic page', '@title' => $edit['title[0][value]']]));
+    $this->assertSession()->responseContains(t('@post @title has been created.', ['@post' => 'Basic page', '@title' => $edit['title[0][value]']]));
 
     // Verify that the creation message contains a link to a node.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'node/']);
diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php
index fea180f3ae..b34a38aaa5 100644
--- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php
+++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php
@@ -91,8 +91,8 @@ public function testNodeEdit() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
 
     // Check that the title and body fields are displayed with the updated values.
-    $this->assertText($edit[$title_key], 'Title displayed.');
-    $this->assertText($edit[$body_key], 'Body displayed.');
+    $this->assertSession()->responseContains($edit[$title_key], 'Title displayed.');
+    $this->assertSession()->responseContains($edit[$body_key], 'Body displayed.');
 
     // Log in as a second administrator user.
     $second_web_user = $this->drupalCreateUser(['administer nodes', 'edit any page content']);
@@ -212,7 +212,7 @@ public function testNodeMetaInformation() {
     // can not see the meta information.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('node/add/page');
-    $this->assertNoText('Not saved yet');
+    $this->assertSession()->responseNotContains('Not saved yet');
 
     // Create node to edit.
     $edit['title[0][value]'] = $this->randomMachineName(8);
@@ -221,14 +221,14 @@ public function testNodeMetaInformation() {
 
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->drupalGet("node/" . $node->id() . "/edit");
-    $this->assertNoText('Published');
-    $this->assertNoText($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'));
+    $this->assertSession()->responseNotContains('Published');
+    $this->assertSession()->responseNotContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'));
 
     // Check that users with the 'administer nodes' permission can see the meta
     // information.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('node/add/page');
-    $this->assertText('Not saved yet');
+    $this->assertSession()->responseContains('Not saved yet');
 
     // Create node to edit.
     $edit['title[0][value]'] = $this->randomMachineName(8);
@@ -237,8 +237,8 @@ public function testNodeMetaInformation() {
 
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->drupalGet("node/" . $node->id() . "/edit");
-    $this->assertText('Published');
-    $this->assertText($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'));
+    $this->assertSession()->responseContains('Published');
+    $this->assertSession()->responseContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'));
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php b/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php
index 1575e9cf00..5f33522f1b 100644
--- a/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php
@@ -46,9 +46,9 @@ public function testNodeViewModeChange() {
     $this->drupalGet('node/' . $node->id());
 
     // Check that teaser mode is viewed.
-    $this->assertText('Extra data that should appear only in the teaser for the node.', 'Teaser text present');
+    $this->assertSession()->responseContains('Extra data that should appear only in the teaser for the node.', 'Teaser text present');
     // Make sure body text is not present.
-    $this->assertNoText('Data that should appear only in the body for the node.', 'Body text not present');
+    $this->assertSession()->responseNotContains('Data that should appear only in the body for the node.', 'Body text not present');
 
     // Test that the correct build mode has been set.
     $build = $this->buildEntityView($node);
diff --git a/core/modules/node/tests/src/Functional/NodeHelpTest.php b/core/modules/node/tests/src/Functional/NodeHelpTest.php
index 59a127aa30..7cbe375f9c 100644
--- a/core/modules/node/tests/src/Functional/NodeHelpTest.php
+++ b/core/modules/node/tests/src/Functional/NodeHelpTest.php
@@ -70,13 +70,13 @@ public function testNodeShowHelpText() {
     // Check the node add form.
     $this->drupalGet('node/add/' . $this->testType);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($this->testText);
+    $this->assertSession()->responseContains($this->testText);
 
     // Create node and check the node edit form.
     $node = $this->drupalCreateNode(['type' => $this->testType]);
     $this->drupalGet('node/' . $node->id() . '/edit');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($this->testText);
+    $this->assertSession()->responseContains($this->testText);
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeLinksTest.php b/core/modules/node/tests/src/Functional/NodeLinksTest.php
index 327704c7a0..57abb6c784 100644
--- a/core/modules/node/tests/src/Functional/NodeLinksTest.php
+++ b/core/modules/node/tests/src/Functional/NodeLinksTest.php
@@ -34,7 +34,7 @@ public function testHideLinks() {
 
     // Links are displayed by default.
     $this->drupalGet('node');
-    $this->assertText($node->getTitle());
+    $this->assertSession()->responseContains($node->getTitle());
     $this->assertLink('Read more');
 
     // Hide links.
@@ -44,7 +44,7 @@ public function testHideLinks() {
       ->save();
 
     $this->drupalGet('node');
-    $this->assertText($node->getTitle());
+    $this->assertSession()->responseContains($node->getTitle());
     $this->assertNoLink('Read more');
   }
 
diff --git a/core/modules/node/tests/src/Functional/NodeLoadMultipleTest.php b/core/modules/node/tests/src/Functional/NodeLoadMultipleTest.php
index 367f66fdb1..209d783086 100644
--- a/core/modules/node/tests/src/Functional/NodeLoadMultipleTest.php
+++ b/core/modules/node/tests/src/Functional/NodeLoadMultipleTest.php
@@ -40,10 +40,10 @@ public function testNodeMultipleLoad() {
 
     // Confirm that promoted nodes appear in the default node listing.
     $this->drupalGet('node');
-    $this->assertText($node1->label(), 'Node title appears on the default listing.');
-    $this->assertText($node2->label(), 'Node title appears on the default listing.');
-    $this->assertNoText($node3->label(), 'Node title does not appear in the default listing.');
-    $this->assertNoText($node4->label(), 'Node title does not appear in the default listing.');
+    $this->assertSession()->responseContains($node1->label(), 'Node title appears on the default listing.');
+    $this->assertSession()->responseContains($node2->label(), 'Node title appears on the default listing.');
+    $this->assertSession()->responseNotContains($node3->label(), 'Node title does not appear in the default listing.');
+    $this->assertSession()->responseNotContains($node4->label(), 'Node title does not appear in the default listing.');
     // Load nodes with only a condition. Nodes 3 and 4 will be loaded.
     $nodes = $this->container->get('entity_type.manager')->getStorage('node')
       ->loadByProperties(['promote' => 0]);
diff --git a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php
index b36b032735..29070f1d68 100644
--- a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php
+++ b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php
@@ -48,12 +48,12 @@ public function testNodeRSSContent() {
 
     // Check that content added in 'rss' view mode appear in RSS feed.
     $rss_only_content = t('Extra data that should appear only in the RSS feed for node @nid.', ['@nid' => $node->id()]);
-    $this->assertText($rss_only_content, 'Node content designated for RSS appear in RSS feed.');
+    $this->assertSession()->responseContains($rss_only_content, 'Node content designated for RSS appear in RSS feed.');
 
     // Check that content added in view modes other than 'rss' doesn't
     // appear in RSS feed.
     $non_rss_content = t('Extra data that should appear everywhere except the RSS feed for node @nid.', ['@nid' => $node->id()]);
-    $this->assertNoText($non_rss_content, 'Node content not designed for RSS does not appear in RSS feed.');
+    $this->assertSession()->responseNotContains($non_rss_content, 'Node content not designed for RSS does not appear in RSS feed.');
 
     // Check that extra RSS elements and namespaces are added to RSS feed.
     $test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>';
@@ -64,7 +64,7 @@ public function testNodeRSSContent() {
     // Check that content added in 'rss' view mode doesn't appear when
     // viewing node.
     $this->drupalGet('node/' . $node->id());
-    $this->assertNoText($rss_only_content, 'Node content designed for RSS does not appear when viewing node.');
+    $this->assertSession()->responseNotContains($rss_only_content, 'Node content designed for RSS does not appear when viewing node.');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php
index 5d0956b50f..a3dedd4226 100644
--- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php
+++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php
@@ -135,13 +135,13 @@ public function testRevisions() {
 
     // Confirm the correct revision text appears on "view revisions" page.
     $this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/view");
-    $this->assertText($node->body->value, 'Correct text displays for version.');
+    $this->assertSession()->responseContains($node->body->value, 'Correct text displays for version.');
 
     // Confirm the correct revision log message appears on the "revisions
     // overview" page.
     $this->drupalGet("node/" . $node->id() . "/revisions");
     foreach ($logs as $revision_log) {
-      $this->assertText($revision_log, 'Revision log message found.');
+      $this->assertSession()->responseContains($revision_log, 'Revision log message found.');
     }
 
     // Confirm that this is the current revision.
@@ -171,8 +171,8 @@ public function testRevisions() {
 
     // Confirm that the node can still be updated.
     $this->drupalPostForm("node/" . $reverted_node->id() . "/edit", ['body[0][value]' => 'We are Drupal.'], t('Save'));
-    $this->assertText(t('Basic page @title has been updated.', ['@title' => $reverted_node->getTitle()]), 'Node was successfully saved after reverting a revision.');
-    $this->assertText('We are Drupal.', 'Node was correctly updated after reverting a revision.');
+    $this->assertSession()->responseContains(t('Basic page @title has been updated.', ['@title' => $reverted_node->getTitle()]), 'Node was successfully saved after reverting a revision.');
+    $this->assertSession()->responseContains('We are Drupal.', 'Node was correctly updated after reverting a revision.');
 
     // Confirm revisions delete properly.
     $this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionId() . "/delete", [], t('Delete'));
@@ -220,12 +220,12 @@ public function testRevisions() {
     $this->assertRaw('page=1');
 
     // Check that the last revision is displayed on the first page.
-    $this->assertText(end($logs));
+    $this->assertSession()->responseContains(end($logs));
 
     // Go to the second page and check that one of the initial three revisions
     // is displayed.
     $this->clickLink(t('Page 2'));
-    $this->assertText($logs[2]);
+    $this->assertSession()->responseContains($logs[2]);
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php
index b1daab2555..4425a6c038 100644
--- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php
+++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php
@@ -154,18 +154,18 @@ public function testRevisions() {
 
     // Confirm the correct revision text appears on "view revisions" page.
     $this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/view");
-    $this->assertText($node->body->value, 'Correct text displays for version.');
+    $this->assertSession()->responseContains($node->body->value, 'Correct text displays for version.');
 
     // Confirm the correct log message appears on "revisions overview" page.
     $this->drupalGet("node/" . $node->id() . "/revisions");
     foreach ($logs as $revision_log) {
-      $this->assertText($revision_log, 'Revision log message found.');
+      $this->assertSession()->responseContains($revision_log, 'Revision log message found.');
     }
     // Original author, and editor names should appear on revisions overview.
     $web_user = $nodes[0]->revision_uid->entity;
-    $this->assertText(t('by @name', ['@name' => $web_user->getAccountName()]));
+    $this->assertSession()->responseContains(t('by @name', ['@name' => $web_user->getAccountName()]));
     $editor = $nodes[2]->revision_uid->entity;
-    $this->assertText(t('by @name', ['@name' => $editor->getAccountName()]));
+    $this->assertSession()->responseContains(t('by @name', ['@name' => $editor->getAccountName()]));
 
     // Confirm that this is the default revision.
     $this->assertTrue($node->isDefaultRevision(), 'Third node revision is the default one.');
@@ -227,11 +227,11 @@ public function testRevisions() {
     $new_node_revision->save();
 
     $this->drupalGet('node/' . $node->id());
-    $this->assertNoText($new_body, 'Revision body text is not present on default version of node.');
+    $this->assertSession()->responseNotContains($new_body, 'Revision body text is not present on default version of node.');
 
     // Verify that the new body text is present on the revision.
     $this->drupalGet("node/" . $node->id() . "/revisions/" . $new_node_revision->getRevisionId() . "/view");
-    $this->assertText($new_body, 'Revision body text is present when loading specific revision.');
+    $this->assertSession()->responseContains($new_body, 'Revision body text is present when loading specific revision.');
 
     // Verify that the non-default revision vid is greater than the default
     // revision vid.
@@ -253,7 +253,7 @@ public function testRevisions() {
     // Verify revisions is accessible since the type has revisions enabled.
     $this->assertSession()->statusCodeEquals(200);
     // Check initial revision is shown on the node revisions overview page.
-    $this->assertText('Simple revision message (EN)');
+    $this->assertSession()->responseContains('Simple revision message (EN)');
 
     // Verify that delete operation is inaccessible for the default revision.
     $this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/delete");
@@ -272,8 +272,8 @@ public function testRevisions() {
 
     // Check both revisions are shown on the node revisions overview page.
     $this->drupalGet("node/" . $node->id() . "/revisions");
-    $this->assertText('Simple revision message (EN)');
-    $this->assertText('New revision message (EN)');
+    $this->assertSession()->responseContains('Simple revision message (EN)');
+    $this->assertSession()->responseContains('New revision message (EN)');
 
     // Create an 'EN' node with a revision log message.
     $node = $this->drupalCreateNode();
@@ -286,7 +286,7 @@ public function testRevisions() {
     // Verify revisions is accessible since the type has revisions enabled.
     $this->assertSession()->statusCodeEquals(200);
     // Check initial revision is shown on the node revisions overview page.
-    $this->assertText('Simple revision message (EN)');
+    $this->assertSession()->responseContains('Simple revision message (EN)');
 
     // Add a translation in 'DE' and create a new revision and new log message.
     $translation = $node->addTranslation('de');
@@ -298,18 +298,18 @@ public function testRevisions() {
 
     // View the revision UI in 'IT', only the original node revision is shown.
     $this->drupalGet("it/node/" . $node->id() . "/revisions");
-    $this->assertText('Simple revision message (EN)');
-    $this->assertNoText('New revision message (DE)');
+    $this->assertSession()->responseContains('Simple revision message (EN)');
+    $this->assertSession()->responseNotContains('New revision message (DE)');
 
     // View the revision UI in 'DE', only the translated node revision is shown.
     $this->drupalGet("de/node/" . $node->id() . "/revisions");
-    $this->assertNoText('Simple revision message (EN)');
-    $this->assertText('New revision message (DE)');
+    $this->assertSession()->responseNotContains('Simple revision message (EN)');
+    $this->assertSession()->responseContains('New revision message (DE)');
 
     // View the revision UI in 'EN', only the original node revision is shown.
     $this->drupalGet("node/" . $node->id() . "/revisions");
-    $this->assertText('Simple revision message (EN)');
-    $this->assertNoText('New revision message (DE)');
+    $this->assertSession()->responseContains('Simple revision message (EN)');
+    $this->assertSession()->responseNotContains('New revision message (DE)');
   }
 
   /**
@@ -334,7 +334,7 @@ public function testNodeRevisionWithoutLogMessage() {
 
     $node->save();
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($new_title, 'New node title appears on the page.');
+    $this->assertSession()->responseContains($new_title, 'New node title appears on the page.');
     $node_storage->resetCache([$node->id()]);
     $node_revision = $node_storage->load($node->id());
     $this->assertEqual($node_revision->revision_log->value, $revision_log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.');
@@ -353,7 +353,7 @@ public function testNodeRevisionWithoutLogMessage() {
 
     $node->save();
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($new_title, 'New node title appears on the page.');
+    $this->assertSession()->responseContains($new_title, 'New node title appears on the page.');
     $node_storage->resetCache([$node->id()]);
     $node_revision = $node_storage->load($node->id());
     $this->assertTrue(empty($node_revision->revision_log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.');
diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index 697be9a6de..8e76d7082d 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -386,7 +386,7 @@ protected function doTestTranslations($path, array $values) {
     $languages = $this->container->get('language_manager')->getLanguages();
     foreach ($this->langcodes as $langcode) {
       $this->drupalGet($path, ['language' => $languages[$langcode]]);
-      $this->assertText($values[$langcode]['title'][0]['value'], new FormattableMarkup('The %langcode node translation is correctly displayed.', ['%langcode' => $langcode]));
+      $this->assertSession()->responseContains($values[$langcode]['title'][0]['value'], new FormattableMarkup('The %langcode node translation is correctly displayed.', ['%langcode' => $langcode]));
     }
   }
 
@@ -503,8 +503,8 @@ public function testRevisionTranslationRendering() {
     $this->assertSession()->statusCodeEquals(200);
 
     // Contents should be in English, of correct revision.
-    $this->assertText('First rev en title');
-    $this->assertNoText('First rev fr title');
+    $this->assertSession()->responseContains('First rev en title');
+    $this->assertSession()->responseNotContains('First rev fr title');
 
     // Get a French view.
     $url_fr = $original_revision->getTranslation('fr')->toUrl('revision')->toString();
@@ -516,8 +516,8 @@ public function testRevisionTranslationRendering() {
     $this->assertSession()->statusCodeEquals(200);
 
     // Contents should be in French, of correct revision.
-    $this->assertText('First rev fr title');
-    $this->assertNoText('First rev en title');
+    $this->assertSession()->responseContains('First rev fr title');
+    $this->assertSession()->responseNotContains('First rev en title');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodeTypeTest.php b/core/modules/node/tests/src/Functional/NodeTypeTest.php
index 3484cef5b1..76fcd0e0f8 100644
--- a/core/modules/node/tests/src/Functional/NodeTypeTest.php
+++ b/core/modules/node/tests/src/Functional/NodeTypeTest.php
@@ -180,7 +180,7 @@ public function testNodeTypeDeletion() {
       t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()]),
       'The content type will not be deleted until all nodes of that type are removed.'
     );
-    $this->assertNoText(t('This action cannot be undone.'), 'The node type deletion confirmation form is not available.');
+    $this->assertSession()->responseNotContains(t('This action cannot be undone.'), 'The node type deletion confirmation form is not available.');
 
     // Delete the node.
     $node->delete();
@@ -190,7 +190,7 @@ public function testNodeTypeDeletion() {
       t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()]),
       'The content type is available for deletion.'
     );
-    $this->assertText(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.');
+    $this->assertSession()->responseContains(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.');
 
     // Test that a locked node type could not be deleted.
     $this->container->get('module_installer')->install(['node_test_config']);
diff --git a/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php b/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php
index f9db9c2f29..84a3901730 100644
--- a/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php
+++ b/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php
@@ -144,7 +144,7 @@ public function testNodeTypeTitleLabelTranslation() {
 
     // Assert that the title label is displayed on the translation form with the right value.
     $this->drupalGet("admin/structure/types/manage/$type/translate/$langcode/add");
-    $this->assertText('Edited title');
+    $this->assertSession()->responseContains('Edited title');
 
     // Translate the title label.
     $this->drupalPostForm(NULL, ["translation[config_names][core.base_field_override.node.$type.title][label]" => 'Translated title'], t('Save translation'));
@@ -154,9 +154,9 @@ public function testNodeTypeTitleLabelTranslation() {
     // use t(). If t() were used then the correct langcodes would need to be
     // provided.
     $this->drupalGet("node/add/$type");
-    $this->assertText('Edited title');
+    $this->assertSession()->responseContains('Edited title');
     $this->drupalGet("$langcode/node/add/$type");
-    $this->assertText('Translated title');
+    $this->assertSession()->responseContains('Translated title');
 
     // Add an e-mail field.
     $this->drupalPostForm("admin/structure/types/manage/$type/fields/add-field", ['new_storage_type' => 'email', 'label' => 'Email', 'field_name' => 'email'], 'Save and continue');
@@ -179,7 +179,7 @@ public function testNodeTypeTitleLabelTranslation() {
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet("es/admin/structure/types/manage/$type/fields/node.$type.field_email/translate");
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText("The configuration objects have different language codes so they cannot be translated");
+    $this->assertSession()->responseContains("The configuration objects have different language codes so they cannot be translated");
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeViewLanguageTest.php b/core/modules/node/tests/src/Functional/NodeViewLanguageTest.php
index 70612d83e5..bc11eef05e 100644
--- a/core/modules/node/tests/src/Functional/NodeViewLanguageTest.php
+++ b/core/modules/node/tests/src/Functional/NodeViewLanguageTest.php
@@ -40,7 +40,7 @@ public function testViewLanguage() {
     $node = $this->drupalCreateNode(['langcode' => 'es']);
 
     $this->drupalGet($node->toUrl());
-    $this->assertText('Spanish', 'The language field is displayed properly.');
+    $this->assertSession()->responseContains('Spanish', 'The language field is displayed properly.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php
index a58943b0a5..0e92f4a461 100644
--- a/core/modules/node/tests/src/Functional/PagePreviewTest.php
+++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php
@@ -201,8 +201,8 @@ public function testPagePreview() {
     $expected_title = $edit[$title_key] . ' | Drupal';
     $this->assertSession()->titleEquals($expected_title);
     $this->assertEscaped($edit[$title_key], 'Title displayed and escaped.');
-    $this->assertText($edit[$body_key], 'Body displayed.');
-    $this->assertText($edit[$term_key], 'Term displayed.');
+    $this->assertSession()->responseContains($edit[$body_key], 'Body displayed.');
+    $this->assertSession()->responseContains($edit[$term_key], 'Term displayed.');
     $this->assertLink(t('Back to content editing'));
 
     // Check that we see the class of the node type on the body element.
@@ -224,7 +224,7 @@ public function testPagePreview() {
     $view_mode_edit = ['view_mode' => 'teaser'];
     $this->drupalPostForm('node/preview/' . $uuid . '/full', $view_mode_edit, t('Switch'));
     $this->assertRaw('view-mode-teaser', 'View mode teaser class found.');
-    $this->assertNoText($edit[$body_key], 'Body not displayed.');
+    $this->assertSession()->responseNotContains($edit[$body_key], 'Body not displayed.');
 
     // Check that the title, body and term fields are displayed with the
     // values after going back to the content edit page.
@@ -241,8 +241,8 @@ public function testPagePreview() {
     $this->drupalPostForm(NULL, [], t('Preview'));
     $this->assertSession()->titleEquals($expected_title);
     $this->assertEscaped($edit[$title_key], 'Title displayed and escaped.');
-    $this->assertText($edit[$body_key], 'Body displayed.');
-    $this->assertText($edit[$term_key], 'Term displayed.');
+    $this->assertSession()->responseContains($edit[$body_key], 'Body displayed.');
+    $this->assertSession()->responseContains($edit[$term_key], 'Term displayed.');
     $this->assertLink(t('Back to content editing'));
 
     // Assert the content is kept when reloading the page.
@@ -258,7 +258,7 @@ public function testPagePreview() {
 
     // Check the term was displayed on the saved node.
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($edit[$term_key], 'Term displayed.');
+    $this->assertSession()->responseContains($edit[$term_key], 'Term displayed.');
 
     // Check the term appears again on the edit form.
     $this->drupalGet('node/' . $node->id() . '/edit');
@@ -289,7 +289,7 @@ public function testPagePreview() {
     $this->assertRaw('>' . $newterm1 . '<', 'First existing term displayed.');
     $this->assertRaw('>' . $newterm2 . '<', 'Second existing term displayed.');
     $this->assertRaw('>' . $newterm3 . '<', 'Third new term displayed.');
-    $this->assertNoText($this->term->getName());
+    $this->assertSession()->responseNotContains($this->term->getName());
     $this->assertLink($newterm1);
     $this->assertLink($newterm2);
     $this->assertNoLink($newterm3);
@@ -300,7 +300,7 @@ public function testPagePreview() {
       $title_key => $this->randomMachineName(8),
     ];
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
-    $this->assertText($edit[$title_key], 'New title displayed.');
+    $this->assertSession()->responseContains($edit[$title_key], 'New title displayed.');
     $this->clickLink(t('Back to content editing'));
     $this->assertFieldByName($title_key, $edit[$title_key], 'New title value displayed.');
     // Navigate away from the node without saving.
@@ -373,7 +373,7 @@ public function testPagePreview() {
     $this->assertRaw('Storage is set');
     $this->assertFieldByName('field_test_multi[0][value]');
     $this->drupalPostForm(NULL, [], t('Save'));
-    $this->assertText('Basic page ' . $title . ' has been created.');
+    $this->assertSession()->responseContains('Basic page ' . $title . ' has been created.');
     $node = $this->drupalGetNodeByTitle($title);
     $this->drupalGet('node/' . $node->id() . '/edit');
     $this->getSession()->getPage()->pressButton('Add another item');
@@ -392,9 +392,9 @@ public function testPagePreview() {
 
     // Now save the node and make sure all values got saved.
     $this->drupalPostForm(NULL, [], t('Save'));
-    $this->assertText($example_text_1);
-    $this->assertText($example_text_2);
-    $this->assertText($example_text_3);
+    $this->assertSession()->responseContains($example_text_1);
+    $this->assertSession()->responseContains($example_text_2);
+    $this->assertSession()->responseContains($example_text_3);
 
     // Edit again, change the menu_ui settings and click on preview.
     $this->drupalGet('node/' . $node->id() . '/edit');
@@ -441,9 +441,9 @@ public function testPagePreviewWithRevisions() {
 
     // Check that the preview is displaying the title, body and term.
     $this->assertTitle(t('@title | Drupal', ['@title' => $edit[$title_key]]), 'Basic page title is preview.');
-    $this->assertText($edit[$title_key], 'Title displayed.');
-    $this->assertText($edit[$body_key], 'Body displayed.');
-    $this->assertText($edit[$term_key], 'Term displayed.');
+    $this->assertSession()->responseContains($edit[$title_key], 'Title displayed.');
+    $this->assertSession()->responseContains($edit[$body_key], 'Body displayed.');
+    $this->assertSession()->responseContains($edit[$term_key], 'Term displayed.');
 
     // Check that the title and body fields are displayed with the correct
     // values after going back to the content edit page.
@@ -482,7 +482,7 @@ public function testSimultaneousPreview() {
 
     $edit = [$title_key => 'New page title'];
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
-    $this->assertText($edit[$title_key]);
+    $this->assertSession()->responseContains($edit[$title_key]);
 
     $user2 = $this->drupalCreateUser(['edit any page content']);
     $this->drupalLogin($user2);
@@ -492,7 +492,7 @@ public function testSimultaneousPreview() {
     $edit2 = [$title_key => 'Another page title'];
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit2, t('Preview'));
     $this->assertUrl(Url::fromRoute('entity.node.preview', ['node_preview' => $node->uuid(), 'view_mode_id' => 'full'], ['absolute' => TRUE])->toString());
-    $this->assertText($edit2[$title_key]);
+    $this->assertSession()->responseContains($edit2[$title_key]);
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php
index 7c24574709..8b8147009c 100644
--- a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php
+++ b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php
@@ -254,15 +254,15 @@ public function testBulkDeletion() {
     $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
 
     $label = $this->loadNode(1)->label();
-    $this->assertText("$label (Original translation) - The following content item translations will be deleted:");
+    $this->assertSession()->responseContains("$label (Original translation) - The following content item translations will be deleted:");
     $label = $this->loadNode(2)->label();
-    $this->assertText("$label (Original translation) - The following content item translations will be deleted:");
+    $this->assertSession()->responseContains("$label (Original translation) - The following content item translations will be deleted:");
     $label = $this->loadNode(3)->getTranslation('en')->label();
-    $this->assertText($label);
-    $this->assertNoText("$label (Original translation) - The following content item translations will be deleted:");
+    $this->assertSession()->responseContains($label);
+    $this->assertSession()->responseNotContains("$label (Original translation) - The following content item translations will be deleted:");
     $label = $this->loadNode(4)->label();
-    $this->assertText($label);
-    $this->assertNoText("$label (Original translation) - The following content item translations will be deleted:");
+    $this->assertSession()->responseContains($label);
+    $this->assertSession()->responseNotContains("$label (Original translation) - The following content item translations will be deleted:");
 
     $this->drupalPostForm(NULL, [], t('Delete'));
 
@@ -278,7 +278,7 @@ public function testBulkDeletion() {
     $node = $this->loadNode(5);
     $this->assertNotEmpty($node, '5: Node has not been deleted');
 
-    $this->assertText('Deleted 8 content items.');
+    $this->assertSession()->responseContains('Deleted 8 content items.');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php b/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php
index ce0c4eb050..253e7be9dd 100644
--- a/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php
+++ b/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php
@@ -84,38 +84,38 @@ public function testFilterNodeAccess() {
     $this->drupalLogin($this->users[0]);
     $this->drupalGet('test_filter_node_access');
     // Test that the private node of the current user is shown.
-    $this->assertText('Private Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseContains('Private Article created by ' . $this->users[0]->getAccountName());
     // Test that the private node of the other use isn't shown.
-    $this->assertNoText('Private Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseNotContains('Private Article created by ' . $this->users[1]->getAccountName());
     // Test that both public nodes are shown.
-    $this->assertText('Public Article created by ' . $this->users[0]->getAccountName());
-    $this->assertText('Public Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseContains('Public Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseContains('Public Article created by ' . $this->users[1]->getAccountName());
 
     // Switch users and test the other private node is shown.
     $this->drupalLogin($this->users[1]);
     $this->drupalGet('test_filter_node_access');
     // Test that the private node of the current user is shown.
-    $this->assertText('Private Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseContains('Private Article created by ' . $this->users[1]->getAccountName());
     // Test that the private node of the other use isn't shown.
-    $this->assertNoText('Private Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseNotContains('Private Article created by ' . $this->users[0]->getAccountName());
 
     // Test that a user with administer nodes permission can't see all nodes.
     $administer_nodes_user = $this->drupalCreateUser(['access content', 'administer nodes']);
     $this->drupalLogin($administer_nodes_user);
     $this->drupalGet('test_filter_node_access');
-    $this->assertNoText('Private Article created by ' . $this->users[0]->getAccountName());
-    $this->assertNoText('Private Article created by ' . $this->users[1]->getAccountName());
-    $this->assertText('Public Article created by ' . $this->users[0]->getAccountName());
-    $this->assertText('Public Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseNotContains('Private Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseNotContains('Private Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseContains('Public Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseContains('Public Article created by ' . $this->users[1]->getAccountName());
 
     // Test that a user with bypass node access can see all nodes.
     $bypass_access_user = $this->drupalCreateUser(['access content', 'bypass node access']);
     $this->drupalLogin($bypass_access_user);
     $this->drupalGet('test_filter_node_access');
-    $this->assertText('Private Article created by ' . $this->users[0]->getAccountName());
-    $this->assertText('Private Article created by ' . $this->users[1]->getAccountName());
-    $this->assertText('Public Article created by ' . $this->users[0]->getAccountName());
-    $this->assertText('Public Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseContains('Private Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseContains('Private Article created by ' . $this->users[1]->getAccountName());
+    $this->assertSession()->responseContains('Public Article created by ' . $this->users[0]->getAccountName());
+    $this->assertSession()->responseContains('Public Article created by ' . $this->users[1]->getAccountName());
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php
index 0ec10e3c62..844c1b569d 100644
--- a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php
+++ b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php
@@ -374,7 +374,7 @@ protected function doTestFrontPageViewCacheTags($do_assert_views_caches) {
     $node->save();
 
     $this->drupalGet(Url::fromRoute('view.frontpage.page_1'));
-    $this->assertText($title);
+    $this->assertSession()->responseContains($title);
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php b/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php
index b5d97c5a73..75d1296e4d 100644
--- a/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php
+++ b/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php
@@ -120,18 +120,18 @@ public function testLanguages() {
     foreach ($this->nodeTitles as $langcode => $list) {
       foreach ($list as $title) {
         if ($langcode == 'en') {
-          $this->assertNoText($title, $title . ' does not appear on ' . $message);
+          $this->assertSession()->responseNotContains($title, $title . ' does not appear on ' . $message);
         }
         else {
-          $this->assertText($title, $title . ' does appear on ' . $message);
+          $this->assertSession()->responseContains($title, $title . ' does appear on ' . $message);
         }
       }
     }
 
     // Test that the language field value is shown.
-    $this->assertNoText('English', 'English language is not shown on ' . $message);
-    $this->assertText('French', 'French language is shown on ' . $message);
-    $this->assertText('Spanish', 'Spanish language is shown on ' . $message);
+    $this->assertSession()->responseNotContains('English', 'English language is not shown on ' . $message);
+    $this->assertSession()->responseContains('French', 'French language is shown on ' . $message);
+    $this->assertSession()->responseContains('Spanish', 'Spanish language is shown on ' . $message);
 
     // Test page sorting, which is by language code, ascending. So the
     // Spanish nodes should appear before the French nodes.
@@ -150,9 +150,9 @@ public function testLanguages() {
     $this->drupalGet('test-language/es');
     // This time, test just the language field.
     $message = 'Spanish argument page';
-    $this->assertNoText('English', 'English language is not shown on ' . $message);
-    $this->assertNoText('French', 'French language is not shown on ' . $message);
-    $this->assertText('Spanish', 'Spanish language is shown on ' . $message);
+    $this->assertSession()->responseNotContains('English', 'English language is not shown on ' . $message);
+    $this->assertSession()->responseNotContains('French', 'French language is not shown on ' . $message);
+    $this->assertSession()->responseContains('Spanish', 'Spanish language is shown on ' . $message);
 
     // Test the front page view filter. Only node titles in the current language
     // should be displayed on the front page by default.
@@ -163,12 +163,12 @@ public function testLanguages() {
       }
       $this->drupalGet(($langcode == 'en' ? '' : "$langcode/") . 'node');
       foreach ($titles as $title) {
-        $this->assertText($title);
+        $this->assertSession()->responseContains($title);
       }
       foreach ($this->nodeTitles as $control_langcode => $control_titles) {
         if ($langcode != $control_langcode) {
           foreach ($control_titles as $title) {
-            $this->assertNoText($title);
+            $this->assertSession()->responseNotContains($title);
           }
         }
       }
@@ -178,19 +178,19 @@ public function testLanguages() {
     $this->drupalGet('admin/content');
     foreach ($this->nodeTitles as $titles) {
       foreach ($titles as $title) {
-        $this->assertText($title);
+        $this->assertSession()->responseContains($title);
       }
     }
     // When filtered, only the specific languages should show.
     foreach ($this->nodeTitles as $langcode => $titles) {
       $this->drupalGet('admin/content', ['query' => ['langcode' => $langcode]]);
       foreach ($titles as $title) {
-        $this->assertText($title);
+        $this->assertSession()->responseContains($title);
       }
       foreach ($this->nodeTitles as $control_langcode => $control_titles) {
         if ($langcode != $control_langcode) {
           foreach ($control_titles as $title) {
-            $this->assertNoText($title);
+            $this->assertSession()->responseNotContains($title);
           }
         }
       }
@@ -210,10 +210,10 @@ public function testLanguages() {
       foreach ($this->nodeTitles as $control_langcode => $control_titles) {
         foreach ($control_titles as $title) {
           if ($control_langcode == 'en') {
-            $this->assertText($title, 'English title is shown when filtering is site default');
+            $this->assertSession()->responseContains($title, 'English title is shown when filtering is site default');
           }
           else {
-            $this->assertNoText($title, 'Non-English title is not shown when filtering is site default');
+            $this->assertSession()->responseNotContains($title, 'Non-English title is not shown when filtering is site default');
           }
         }
       }
@@ -238,10 +238,10 @@ public function testLanguages() {
     foreach ($this->nodeTitles as $control_langcode => $control_titles) {
       foreach ($control_titles as $title) {
         if ($control_langcode == 'es') {
-          $this->assertText($title, 'Spanish title is shown when filtering is fixed UI language');
+          $this->assertSession()->responseContains($title, 'Spanish title is shown when filtering is fixed UI language');
         }
         else {
-          $this->assertNoText($title, 'Non-Spanish title is not shown when filtering is fixed UI language');
+          $this->assertSession()->responseNotContains($title, 'Non-Spanish title is not shown when filtering is fixed UI language');
         }
       }
     }
@@ -284,16 +284,16 @@ public function testNativeLanguageField() {
   protected function assertLanguageNames($native = FALSE) {
     $this->drupalGet('test-language');
     if ($native) {
-      $this->assertText('Français', 'French language shown in native form.');
-      $this->assertText('Español', 'Spanish language shown in native form.');
-      $this->assertNoText('French', 'French language not shown in English.');
-      $this->assertNoText('Spanish', 'Spanish language not shown in English.');
+      $this->assertSession()->responseContains('Français', 'French language shown in native form.');
+      $this->assertSession()->responseContains('Español', 'Spanish language shown in native form.');
+      $this->assertSession()->responseNotContains('French', 'French language not shown in English.');
+      $this->assertSession()->responseNotContains('Spanish', 'Spanish language not shown in English.');
     }
     else {
-      $this->assertNoText('Français', 'French language not shown in native form.');
-      $this->assertNoText('Español', 'Spanish language not shown in native form.');
-      $this->assertText('French', 'French language shown in English.');
-      $this->assertText('Spanish', 'Spanish language shown in English.');
+      $this->assertSession()->responseNotContains('Français', 'French language not shown in native form.');
+      $this->assertSession()->responseNotContains('Español', 'Spanish language not shown in native form.');
+      $this->assertSession()->responseContains('French', 'French language shown in English.');
+      $this->assertSession()->responseContains('Spanish', 'Spanish language shown in English.');
     }
   }
 
diff --git a/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php b/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php
index a876ca3e03..e55241cdb6 100644
--- a/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php
+++ b/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php
@@ -53,43 +53,43 @@ public function testStatusExtra() {
     // The administrator should simply see all nodes.
     $this->drupalLogin($admin_user);
     $this->drupalGet('test_status_extra');
-    $this->assertText($node_published->label());
-    $this->assertText($node_unpublished->label());
-    $this->assertText($node_unpublished2->label());
-    $this->assertText($node_unpublished3->label());
+    $this->assertSession()->responseContains($node_published->label());
+    $this->assertSession()->responseContains($node_unpublished->label());
+    $this->assertSession()->responseContains($node_unpublished2->label());
+    $this->assertSession()->responseContains($node_unpublished3->label());
 
     // The privileged user should simply see all nodes.
     $this->drupalLogin($privileged_user);
     $this->drupalGet('test_status_extra');
-    $this->assertText($node_published->label());
-    $this->assertText($node_unpublished->label());
-    $this->assertText($node_unpublished2->label());
-    $this->assertText($node_unpublished3->label());
+    $this->assertSession()->responseContains($node_published->label());
+    $this->assertSession()->responseContains($node_unpublished->label());
+    $this->assertSession()->responseContains($node_unpublished2->label());
+    $this->assertSession()->responseContains($node_unpublished3->label());
 
     // The node author should see the published node and their own node.
     $this->drupalLogin($node_author);
     $this->drupalGet('test_status_extra');
-    $this->assertText($node_published->label());
-    $this->assertNoText($node_unpublished->label());
-    $this->assertText($node_unpublished2->label());
-    $this->assertNoText($node_unpublished3->label());
+    $this->assertSession()->responseContains($node_published->label());
+    $this->assertSession()->responseNotContains($node_unpublished->label());
+    $this->assertSession()->responseContains($node_unpublished2->label());
+    $this->assertSession()->responseNotContains($node_unpublished3->label());
 
     // The normal user should just see the published node.
     $this->drupalLogin($normal_user);
     $this->drupalGet('test_status_extra');
-    $this->assertText($node_published->label());
-    $this->assertNoText($node_unpublished->label());
-    $this->assertNoText($node_unpublished2->label());
-    $this->assertNoText($node_unpublished3->label());
+    $this->assertSession()->responseContains($node_published->label());
+    $this->assertSession()->responseNotContains($node_unpublished->label());
+    $this->assertSession()->responseNotContains($node_unpublished2->label());
+    $this->assertSession()->responseNotContains($node_unpublished3->label());
 
     // The author without the permission to see their own unpublished node should
     // just see the published node.
     $this->drupalLogin($node_author_not_unpublished);
     $this->drupalGet('test_status_extra');
-    $this->assertText($node_published->label());
-    $this->assertNoText($node_unpublished->label());
-    $this->assertNoText($node_unpublished2->label());
-    $this->assertNoText($node_unpublished3->label());
+    $this->assertSession()->responseContains($node_published->label());
+    $this->assertSession()->responseNotContains($node_unpublished->label());
+    $this->assertSession()->responseNotContains($node_unpublished2->label());
+    $this->assertSession()->responseNotContains($node_unpublished3->label());
   }
 
 }
diff --git a/core/modules/node/tests/src/Kernel/SummaryLengthTest.php b/core/modules/node/tests/src/Kernel/SummaryLengthTest.php
index 97830c656b..174d78ab29 100644
--- a/core/modules/node/tests/src/Kernel/SummaryLengthTest.php
+++ b/core/modules/node/tests/src/Kernel/SummaryLengthTest.php
@@ -111,7 +111,7 @@ public function testSummaryLength() {
     $content = $this->drupalBuildEntityView($node, 'teaser');
     $this->assertTrue(strlen($content['body'][0]['#markup']) < 200, 'Teaser is less than 200 characters long.');
     $this->setRawContent($renderer->renderRoot($content));
-    $this->assertText($node->label());
+    $this->assertSession()->responseContains($node->label());
     $this->assertNoRaw($expected);
   }
 
diff --git a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
index e1cfe8992b..813d2a8fae 100644
--- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
+++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
@@ -312,7 +312,7 @@ public function assertAllowedValuesInput($input_string, $result, $message) {
     $this->assertNoRaw('&amp;lt;', 'The page does not have double escaped HTML tags.');
 
     if (is_string($result)) {
-      $this->assertText($result, $message);
+      $this->assertSession()->responseContains($result, $message);
     }
     else {
       $field_storage = FieldStorageConfig::loadByName('node', $this->fieldName);
@@ -337,7 +337,7 @@ public function testNodeDisplay() {
     ];
 
     $this->drupalPostForm($this->adminPath, $edit, t('Save field settings'));
-    $this->assertText(new FormattableMarkup('Updated field @field_name field settings.', ['@field_name' => $this->fieldName]), "The 'On' and 'Off' form fields work for boolean fields.");
+    $this->assertSession()->responseContains(new FormattableMarkup('Updated field @field_name field settings.', ['@field_name' => $this->fieldName]), "The 'On' and 'Off' form fields work for boolean fields.");
 
     // Select a default value.
     $edit = [
diff --git a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
index a63ba2084e..206eefea3a 100644
--- a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
+++ b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
@@ -242,7 +242,7 @@ public function testCheckBoxes() {
       'card_2[2]' => TRUE,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
+    $this->assertSession()->responseContains('this field cannot hold more than 2 values', 'Validation error was displayed.');
 
     // Submit form: uncheck all options.
     $edit = [
@@ -422,7 +422,7 @@ public function testSelectListMultiple() {
     // Submit form: select the three options while the field accepts only 2.
     $edit = ['card_2[]' => [0 => 0, 1 => 1, 2 => 2]];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
+    $this->assertSession()->responseContains('this field cannot hold more than 2 values', 'Validation error was displayed.');
 
     // Submit form: uncheck all options.
     $edit = ['card_2[]' => []];
diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php
index 7c0ca9985b..9412204313 100644
--- a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php
+++ b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php
@@ -318,7 +318,7 @@ public function testPageCacheAnonymousRolePermissions() {
 
     // 1. anonymous user, without permission.
     $this->drupalGet($content_url);
-    $this->assertText('Permission to pet llamas: no!');
+    $this->assertSession()->responseContains('Permission to pet llamas: no!');
     $this->assertCacheContext('user.permissions');
     $this->assertCacheTag('config:user.role.anonymous');
     $this->drupalGet($route_access_url);
@@ -328,7 +328,7 @@ public function testPageCacheAnonymousRolePermissions() {
     // 2. anonymous user, with permission.
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['pet llamas']);
     $this->drupalGet($content_url);
-    $this->assertText('Permission to pet llamas: yes!');
+    $this->assertSession()->responseContains('Permission to pet llamas: yes!');
     $this->assertCacheContext('user.permissions');
     $this->assertCacheTag('config:user.role.anonymous');
     $this->drupalGet($route_access_url);
@@ -339,7 +339,7 @@ public function testPageCacheAnonymousRolePermissions() {
     $auth_user = $this->drupalCreateUser();
     $this->drupalLogin($auth_user);
     $this->drupalGet($content_url);
-    $this->assertText('Permission to pet llamas: no!');
+    $this->assertSession()->responseContains('Permission to pet llamas: no!');
     $this->assertCacheContext('user.permissions');
     $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:user.role.authenticated');
     $this->drupalGet($route_access_url);
@@ -349,7 +349,7 @@ public function testPageCacheAnonymousRolePermissions() {
     // 4. authenticated user, with permission.
     user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['pet llamas']);
     $this->drupalGet($content_url);
-    $this->assertText('Permission to pet llamas: yes!');
+    $this->assertSession()->responseContains('Permission to pet llamas: yes!');
     $this->assertCacheContext('user.permissions');
     $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:user.role.authenticated');
     $this->drupalGet($route_access_url);
@@ -474,7 +474,7 @@ public function testFormImmutability() {
 
     $this->drupalGet('page_cache_form_test_immutability');
 
-    $this->assertText("Immutable: TRUE", "Form is immutable.");
+    $this->assertSession()->responseContains("Immutable: TRUE", "Form is immutable.");
 
     // The immutable flag is set unconditionally by system_form_alter(), set
     // a flag to tell page_cache_form_test_module_implements_alter() to disable
@@ -485,7 +485,7 @@ public function testFormImmutability() {
 
     $this->drupalGet('page_cache_form_test_immutability');
 
-    $this->assertText("Immutable: FALSE", "Form is not immutable,");
+    $this->assertSession()->responseContains("Immutable: FALSE", "Form is not immutable,");
   }
 
   /**
diff --git a/core/modules/path/tests/src/Functional/PathAliasTest.php b/core/modules/path/tests/src/Functional/PathAliasTest.php
index 99eaa4fee0..b64c822db6 100644
--- a/core/modules/path/tests/src/Functional/PathAliasTest.php
+++ b/core/modules/path/tests/src/Functional/PathAliasTest.php
@@ -82,15 +82,15 @@ public function testAdminAlias() {
 
     // Confirm that the alias works.
     $this->drupalGet($edit['alias[0][value]']);
-    $this->assertText($node1->label(), 'Alias works.');
+    $this->assertSession()->responseContains($node1->label(), 'Alias works.');
     $this->assertSession()->statusCodeEquals(200);
     // Confirm that the alias works in a case-insensitive way.
     $this->assertTrue(ctype_lower(ltrim($edit['alias[0][value]'], '/')));
     $this->drupalGet($edit['alias[0][value]']);
-    $this->assertText($node1->label(), 'Alias works lower case.');
+    $this->assertSession()->responseContains($node1->label(), 'Alias works lower case.');
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet(mb_strtoupper($edit['alias[0][value]']));
-    $this->assertText($node1->label(), 'Alias works upper case.');
+    $this->assertSession()->responseContains($node1->label(), 'Alias works upper case.');
     $this->assertSession()->statusCodeEquals(200);
 
     // Change alias to one containing "exotic" characters.
@@ -117,13 +117,13 @@ public function testAdminAlias() {
 
     // Confirm that the alias works.
     $this->drupalGet(mb_strtoupper($edit['alias[0][value]']));
-    $this->assertText($node1->label(), 'Changed alias works.');
+    $this->assertSession()->responseContains($node1->label(), 'Changed alias works.');
     $this->assertSession()->statusCodeEquals(200);
 
     $this->container->get('path_alias.manager')->cacheClear();
     // Confirm that previous alias no longer works.
     $this->drupalGet($previous);
-    $this->assertNoText($node1->label(), 'Previous alias no longer works.');
+    $this->assertSession()->responseNotContains($node1->label(), 'Previous alias no longer works.');
     $this->assertSession()->statusCodeEquals(404);
 
     // Create second test node.
@@ -153,7 +153,7 @@ public function testAdminAlias() {
 
     // Confirm that the alias no longer works.
     $this->drupalGet($edit['alias[0][value]']);
-    $this->assertNoText($node1->label(), 'Alias was successfully deleted.');
+    $this->assertSession()->responseNotContains($node1->label(), 'Alias was successfully deleted.');
     $this->assertSession()->statusCodeEquals(404);
 
     // Create a really long alias.
@@ -164,9 +164,9 @@ public function testAdminAlias() {
     // The alias is shortened to 50 characters counting the ellipsis.
     $truncated_alias = substr($alias, 0, 47);
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
-    $this->assertNoText($alias, 'The untruncated alias was not found.');
+    $this->assertSession()->responseNotContains($alias, 'The untruncated alias was not found.');
     // The 'truncated' alias will always be found.
-    $this->assertText($truncated_alias, 'The truncated alias was found.');
+    $this->assertSession()->responseContains($truncated_alias, 'The truncated alias was found.');
 
     // Create third test node.
     $node3 = $this->drupalCreateNode();
@@ -189,9 +189,9 @@ public function testAdminAlias() {
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     // Confirm that the alias with trailing slash is not found.
-    $this->assertNoText($edit['alias[0][value]'], 'The absolute alias was not found.');
+    $this->assertSession()->responseNotContains($edit['alias[0][value]'], 'The absolute alias was not found.');
     // The alias without trailing flash is found.
-    $this->assertText(trim($edit['alias[0][value]'], '/'), 'The alias without trailing slash was found.');
+    $this->assertSession()->responseContains(trim($edit['alias[0][value]'], '/'), 'The alias without trailing slash was found.');
 
     // Update an existing alias to point to a different source.
     $pid = $this->getPID($node4_alias);
@@ -199,10 +199,10 @@ public function testAdminAlias() {
     $edit['alias[0][value]'] = $node4_alias;
     $edit['path[0][value]'] = '/node/' . $node2->id();
     $this->drupalPostForm('admin/config/search/path/edit/' . $pid, $edit, t('Save'));
-    $this->assertText('The alias has been saved.');
+    $this->assertSession()->responseContains('The alias has been saved.');
     $this->drupalGet($edit['alias[0][value]']);
-    $this->assertNoText($node4->label(), 'Previous alias no longer works.');
-    $this->assertText($node2->label(), 'Alias works.');
+    $this->assertSession()->responseNotContains($node4->label(), 'Previous alias no longer works.');
+    $this->assertSession()->responseContains($node2->label(), 'Alias works.');
     $this->assertSession()->statusCodeEquals(200);
 
     // Update an existing alias to use a duplicate alias.
@@ -223,8 +223,8 @@ public function testAdminAlias() {
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     $this->assertUrl('admin/config/search/path/add');
-    $this->assertText('The source path has to start with a slash.');
-    $this->assertText('The alias path has to start with a slash.');
+    $this->assertSession()->responseContains('The source path has to start with a slash.');
+    $this->assertSession()->responseContains('The alias path has to start with a slash.');
   }
 
   /**
@@ -241,7 +241,7 @@ public function testNodeAlias() {
 
     // Confirm that the alias works.
     $this->drupalGet($edit['path[0][alias]']);
-    $this->assertText($node1->label(), 'Alias works.');
+    $this->assertSession()->responseContains($node1->label(), 'Alias works.');
     $this->assertSession()->statusCodeEquals(200);
 
     // Confirm the 'canonical' and 'shortlink' URLs.
@@ -272,12 +272,12 @@ public function testNodeAlias() {
 
     // Confirm that the alias works.
     $this->drupalGet(mb_strtoupper($edit['path[0][alias]']));
-    $this->assertText($node1->label(), 'Changed alias works.');
+    $this->assertSession()->responseContains($node1->label(), 'Changed alias works.');
     $this->assertSession()->statusCodeEquals(200);
 
     // Make sure that previous alias no longer works.
     $this->drupalGet($previous);
-    $this->assertNoText($node1->label(), 'Previous alias no longer works.');
+    $this->assertSession()->responseNotContains($node1->label(), 'Previous alias no longer works.');
     $this->assertSession()->statusCodeEquals(404);
 
     // Create second test node.
@@ -295,7 +295,7 @@ public function testNodeAlias() {
 
     // Confirm that the alias no longer works.
     $this->drupalGet($edit['path[0][alias]']);
-    $this->assertNoText($node1->label(), 'Alias was successfully deleted.');
+    $this->assertSession()->responseNotContains($node1->label(), 'Alias was successfully deleted.');
     $this->assertSession()->statusCodeEquals(404);
 
     // Create third test node.
@@ -307,7 +307,7 @@ public function testNodeAlias() {
 
     // Confirm that the alias was converted to a relative path.
     $this->drupalGet(trim($edit['path[0][alias]'], '/'));
-    $this->assertText($node3->label(), 'Alias became relative.');
+    $this->assertSession()->responseContains($node3->label(), 'Alias became relative.');
     $this->assertSession()->statusCodeEquals(200);
 
     // Create fourth test node.
@@ -319,7 +319,7 @@ public function testNodeAlias() {
 
     // Confirm that the alias was converted to a relative path.
     $this->drupalGet(trim($edit['path[0][alias]'], '/'));
-    $this->assertText($node4->label(), 'Alias trimmed trailing slash.');
+    $this->assertSession()->responseContains($node4->label(), 'Alias trimmed trailing slash.');
     $this->assertSession()->statusCodeEquals(200);
 
     // Create fifth test node.
diff --git a/core/modules/path/tests/src/Functional/PathLanguageTest.php b/core/modules/path/tests/src/Functional/PathLanguageTest.php
index 0ca320166d..096f1229fb 100644
--- a/core/modules/path/tests/src/Functional/PathLanguageTest.php
+++ b/core/modules/path/tests/src/Functional/PathLanguageTest.php
@@ -92,7 +92,7 @@ public function testAliasTranslation() {
 
     // Confirm that the alias works.
     $this->drupalGet($english_alias);
-    $this->assertText($english_node->body->value, 'Alias works.');
+    $this->assertSession()->responseContains($english_node->body->value, 'Alias works.');
 
     // Translate the node into French.
     $this->drupalGet('node/' . $english_node->id() . '/translations');
@@ -121,7 +121,7 @@ public function testAliasTranslation() {
 
     // Confirm that the alias works.
     $this->drupalGet('fr' . $edit['path[0][alias]']);
-    $this->assertText($english_node_french_translation->body->value, 'Alias for French translation works.');
+    $this->assertSession()->responseContains($english_node_french_translation->body->value, 'Alias for French translation works.');
 
     // Confirm that the alias is returned for the URL. Languages are cached on
     // many levels, and we need to clear those caches.
@@ -154,11 +154,11 @@ public function testAliasTranslation() {
     // path alias for French matching the english alias. So the alias manager
     // needs to use the URL language to check whether the alias is valid.
     $this->drupalGet($english_alias);
-    $this->assertText($english_node_french_translation->body->value, 'English alias, but French preferred by the user: French translation.');
+    $this->assertSession()->responseContains($english_node_french_translation->body->value, 'English alias, but French preferred by the user: French translation.');
 
     // Check that the French alias works.
     $this->drupalGet("fr/$french_alias");
-    $this->assertText($english_node_french_translation->body->value, 'Alias for French translation works.');
+    $this->assertSession()->responseContains($english_node_french_translation->body->value, 'Alias for French translation works.');
 
     // Disable URL language negotiation.
     $edit = ['language_interface[enabled][language-url]' => FALSE];
@@ -166,7 +166,7 @@ public function testAliasTranslation() {
 
     // Check that the English alias still works.
     $this->drupalGet($english_alias);
-    $this->assertText($english_node_french_translation->body->value, 'English alias, but French preferred by the user: French translation.');
+    $this->assertSession()->responseContains($english_node_french_translation->body->value, 'English alias, but French preferred by the user: French translation.');
 
     // Check that the French alias is not available. We check the unprefixed
     // alias because we disabled URL language negotiation above. In this
@@ -199,7 +199,7 @@ public function testAliasTranslation() {
     // Check that the English alias still works.
     $this->drupalGet($english_alias);
     $this->assertPathAliasExists('/' . $english_alias, 'en', NULL, 'English alias is not deleted when French translation is removed.');
-    $this->assertText($english_node->body->value, 'English alias still works');
+    $this->assertSession()->responseContains($english_node->body->value, 'English alias still works');
   }
 
 }
diff --git a/core/modules/path/tests/src/Functional/PathLanguageUiTest.php b/core/modules/path/tests/src/Functional/PathLanguageUiTest.php
index 19c832791c..f59ba55abd 100644
--- a/core/modules/path/tests/src/Functional/PathLanguageUiTest.php
+++ b/core/modules/path/tests/src/Functional/PathLanguageUiTest.php
@@ -52,7 +52,7 @@ public function testLanguageNeutralUrl() {
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     $this->drupalGet($name);
-    $this->assertText(t('Filter aliases'), 'Language-neutral URL alias works');
+    $this->assertSession()->responseContains(t('Filter aliases'), 'Language-neutral URL alias works');
   }
 
   /**
@@ -67,7 +67,7 @@ public function testDefaultLanguageUrl() {
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     $this->drupalGet($name);
-    $this->assertText(t('Filter aliases'), 'English URL alias works');
+    $this->assertSession()->responseContains(t('Filter aliases'), 'English URL alias works');
   }
 
   /**
@@ -82,7 +82,7 @@ public function testNonDefaultUrl() {
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     $this->drupalGet('fr/' . $name);
-    $this->assertText(t('Filter aliases'), 'Foreign URL alias works');
+    $this->assertSession()->responseContains(t('Filter aliases'), 'Foreign URL alias works');
   }
 
   /**
diff --git a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php
index e1133669f1..0d7c56c869 100644
--- a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php
+++ b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php
@@ -56,7 +56,7 @@ public function testTermAlias() {
 
     // Confirm that the alias works.
     $this->drupalGet($edit['path[0][alias]']);
-    $this->assertText($description, 'Term can be accessed on URL alias.');
+    $this->assertSession()->responseContains($description, 'Term can be accessed on URL alias.');
 
     // Confirm the 'canonical' and 'shortlink' URLs.
     $elements = $this->xpath("//link[contains(@rel, 'canonical') and contains(@href, '" . $edit['path[0][alias]'] . "')]");
@@ -71,11 +71,11 @@ public function testTermAlias() {
 
     // Confirm that the changed alias works.
     $this->drupalGet(trim($edit2['path[0][alias]'], '/'));
-    $this->assertText($description, 'Term can be accessed on changed URL alias.');
+    $this->assertSession()->responseContains($description, 'Term can be accessed on changed URL alias.');
 
     // Confirm that the old alias no longer works.
     $this->drupalGet(trim($edit['path[0][alias]'], '/'));
-    $this->assertNoText($description, 'Old URL alias has been removed after altering.');
+    $this->assertSession()->responseNotContains($description, 'Old URL alias has been removed after altering.');
     $this->assertSession()->statusCodeEquals(404);
 
     // Remove the term's URL alias.
@@ -85,7 +85,7 @@ public function testTermAlias() {
 
     // Confirm that the alias no longer works.
     $this->drupalGet(trim($edit2['path[0][alias]'], '/'));
-    $this->assertNoText($description, 'Old URL alias has been removed after altering.');
+    $this->assertSession()->responseNotContains($description, 'Old URL alias has been removed after altering.');
     $this->assertSession()->statusCodeEquals(404);
   }
 
diff --git a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php
index 9fa1502324..59d2c8aa74 100644
--- a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php
+++ b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php
@@ -59,7 +59,7 @@ public function testUrlAlter() {
     // Test adding an alias via the UI.
     $edit = ['path[0][value]' => "/user/$uid/edit", 'alias[0][value]' => '/alias/test2'];
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
-    $this->assertText(t('The alias has been saved.'));
+    $this->assertSession()->responseContains(t('The alias has been saved.'));
     $this->drupalGet('alias/test2');
     $this->assertSession()->statusCodeEquals(200);
     $this->assertUrlOutboundAlter("/user/$uid/edit", '/alias/test2');
@@ -71,7 +71,7 @@ public function testUrlAlter() {
     // Test that 'forum' is altered to 'community' correctly, both at the root
     // level and for a specific existing forum.
     $this->drupalGet('community');
-    $this->assertText('General discussion', 'The community path gets resolved correctly');
+    $this->assertSession()->responseContains('General discussion', 'The community path gets resolved correctly');
     $this->assertUrlOutboundAlter('/forum', '/community');
     $forum_vid = $this->config('forum.settings')->get('vocabulary');
     $term_name = $this->randomMachineName();
@@ -81,7 +81,7 @@ public function testUrlAlter() {
     ]);
     $term->save();
     $this->drupalGet("community/" . $term->id());
-    $this->assertText($term_name, 'The community/{tid} path gets resolved correctly');
+    $this->assertSession()->responseContains($term_name, 'The community/{tid} path gets resolved correctly');
     $this->assertUrlOutboundAlter("/forum/" . $term->id(), "/community/" . $term->id());
 
     // Test outbound query string altering.
diff --git a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php
index 5a56b0c03b..16a9e1a9d4 100644
--- a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php
+++ b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php
@@ -44,7 +44,7 @@ protected function setUp(): void {
   public function testResponsiveImageAdmin() {
     // We start without any default styles.
     $this->drupalGet('admin/config/media/responsive-image-style');
-    $this->assertText('There are no responsive image styles yet.');
+    $this->assertSession()->responseContains('There are no responsive image styles yet.');
 
     // Add a responsive image style.
     $this->drupalGet('admin/config/media/responsive-image-style/add');
@@ -63,8 +63,8 @@ public function testResponsiveImageAdmin() {
     // Check if the new group is created.
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet('admin/config/media/responsive-image-style');
-    $this->assertNoText('There are no responsive image styles yet.');
-    $this->assertText('Style One');
+    $this->assertSession()->responseNotContains('There are no responsive image styles yet.');
+    $this->assertSession()->responseContains('Style One');
 
     // Edit the group.
     $this->drupalGet('admin/config/media/responsive-image-style/style_one');
@@ -146,7 +146,7 @@ public function testResponsiveImageAdmin() {
     $this->drupalGet('admin/config/media/responsive-image-style/style_one/delete');
     $this->drupalPostForm(NULL, [], t('Delete'));
     $this->drupalGet('admin/config/media/responsive-image-style');
-    $this->assertText('There are no responsive image styles yet.');
+    $this->assertSession()->responseContains('There are no responsive image styles yet.');
   }
 
 }
diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php
index 78a39324f8..e520cc793e 100644
--- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php
+++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php
@@ -485,7 +485,7 @@ public function testUIFieldAlias() {
 
     $edit = ['row_options[field_options][name][alias]' => $alias_map['name'], 'row_options[field_options][nothing][alias]' => $alias_map['nothing']];
     $this->drupalPostForm($row_options, $edit, t('Apply'));
-    $this->assertText(t('The machine-readable name must contain only letters, numbers, dashes and underscores.'));
+    $this->assertSession()->responseContains(t('The machine-readable name must contain only letters, numbers, dashes and underscores.'));
 
     // Change the map alias value to a valid one.
     $alias_map['nothing'] = $this->randomMachineName();
@@ -574,7 +574,7 @@ public function testFieldRawOutput() {
     }
     // Test that the excluded field is not shown in the row options.
     $this->drupalGet('admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options');
-    $this->assertNoText('created');
+    $this->assertSession()->responseNotContains('created');
   }
 
   /**
diff --git a/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php b/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php
index ae49ac74cf..33e0f5182e 100644
--- a/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php
+++ b/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php
@@ -56,23 +56,23 @@ public function testNodeType() {
 
     // Search for the dummy title with a GET query.
     $this->drupalGet('search/node', ['query' => ['keys' => $dummy_title]]);
-    $this->assertNoText($this->node->label(), 'Basic page node is not found with dummy title.');
+    $this->assertSession()->responseNotContains($this->node->label(), 'Basic page node is not found with dummy title.');
 
     // Search for the title of the node with a GET query.
     $this->drupalGet('search/node', ['query' => ['keys' => $this->node->label()]]);
-    $this->assertText($this->node->label(), 'Basic page node is found with GET query.');
+    $this->assertSession()->responseContains($this->node->label(), 'Basic page node is found with GET query.');
 
     // Search for the title of the node with a POST query.
     $edit = ['or' => $this->node->label()];
     $this->drupalPostForm('search/node', $edit, 'edit-submit--2');
-    $this->assertText($this->node->label(), 'Basic page node is found with POST query.');
+    $this->assertSession()->responseContains($this->node->label(), 'Basic page node is found with POST query.');
 
     // Search by node type.
     $this->drupalPostForm('search/node', array_merge($edit, ['type[page]' => 'page']), 'edit-submit--2');
-    $this->assertText($this->node->label(), 'Basic page node is found with POST query and type:page.');
+    $this->assertSession()->responseContains($this->node->label(), 'Basic page node is found with POST query and type:page.');
 
     $this->drupalPostForm('search/node', array_merge($edit, ['type[article]' => 'article']), 'edit-submit--2');
-    $this->assertText('search yielded no results', 'Article node is not found with POST query and type:article.');
+    $this->assertSession()->responseContains('search yielded no results', 'Article node is not found with POST query and type:article.');
   }
 
   /**
@@ -89,9 +89,9 @@ public function testFormRefill() {
     $this->drupalPostForm('search/node', $edit, 'edit-submit--2');
 
     // Test that the encoded query appears in the page title. Only test the
-    // part not including the quote, because assertText() cannot seem to find
+    // part not including the quote, because assertSession()->responseContains() cannot seem to find
     // the quote marks successfully.
-    $this->assertText('Search for cat dog OR gerbil -fish -snake');
+    $this->assertSession()->responseContains('Search for cat dog OR gerbil -fish -snake');
 
     // Verify that all of the form fields are filled out.
     foreach ($edit as $key => $value) {
@@ -110,7 +110,7 @@ public function testFormRefill() {
     // (It shouldn't be filled out unless you submit values in those fields.)
     $edit2 = ['keys' => 'cat dog OR gerbil -fish -snake'];
     $this->drupalPostForm('search/node', $edit2, 'edit-submit--2');
-    $this->assertText('Search for cat dog OR gerbil -fish -snake');
+    $this->assertSession()->responseContains('Search for cat dog OR gerbil -fish -snake');
     foreach ($edit as $key => $value) {
       if ($key != 'type[page]') {
         $elements = $this->xpath('//input[@name=:name]', [':name' => $key]);
diff --git a/core/modules/search/tests/src/Functional/SearchBlockTest.php b/core/modules/search/tests/src/Functional/SearchBlockTest.php
index f20d4f5212..cd296249cb 100644
--- a/core/modules/search/tests/src/Functional/SearchBlockTest.php
+++ b/core/modules/search/tests/src/Functional/SearchBlockTest.php
@@ -59,7 +59,7 @@ public function testSearchFormBlock() {
     $block = $this->drupalPlaceBlock('search_form_block');
 
     $this->drupalGet('');
-    $this->assertText($block->label(), 'Block title was found.');
+    $this->assertSession()->responseContains($block->label(), 'Block title was found.');
 
     // Check that name attribute is not empty.
     $pattern = "//input[@type='submit' and @name='']";
@@ -70,14 +70,14 @@ public function testSearchFormBlock() {
     $terms = ['keys' => 'test'];
     $this->drupalPostForm('', $terms, t('Search'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Your search yielded no results');
+    $this->assertSession()->responseContains('Your search yielded no results');
 
     // Test a search from the block on a 404 page.
     $this->drupalGet('foo');
     $this->assertSession()->statusCodeEquals(404);
     $this->drupalPostForm(NULL, $terms, t('Search'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Your search yielded no results');
+    $this->assertSession()->responseContains('Your search yielded no results');
 
     $visibility = $block->getVisibility();
     $visibility['request_path']['pages'] = 'search';
@@ -85,7 +85,7 @@ public function testSearchFormBlock() {
 
     $this->drupalPostForm('', $terms, t('Search'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Your search yielded no results');
+    $this->assertSession()->responseContains('Your search yielded no results');
 
     // Confirm that the form submits to the default search page.
     /** @var $search_page_repository \Drupal\search\SearchPageRepositoryInterface */
@@ -101,7 +101,7 @@ public function testSearchFormBlock() {
     $terms = ['keys' => ''];
     $this->drupalPostForm('', $terms, t('Search'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Please enter some keywords');
+    $this->assertSession()->responseContains('Please enter some keywords');
 
     // Confirm that the user is redirected to the search page, when form is
     // submitted empty.
@@ -114,16 +114,16 @@ public function testSearchFormBlock() {
     // Test that after entering a too-short keyword in the form, you can then
     // search again with a longer keyword. First test using the block form.
     $this->drupalPostForm('node', ['keys' => $this->randomMachineName(1)], t('Search'));
-    $this->assertText('You must include at least one keyword to match in the content', 'Keyword message is displayed when searching for short word');
-    $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
+    $this->assertSession()->responseContains('You must include at least one keyword to match in the content', 'Keyword message is displayed when searching for short word');
+    $this->assertSession()->responseNotContains(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
     $this->drupalPostForm(NULL, ['keys' => $this->randomMachineName()], t('Search'), [], 'search-block-form');
-    $this->assertNoText('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search');
+    $this->assertSession()->responseNotContains('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search');
 
     // Same test again, using the search page form for the second search this
     // time.
     $this->drupalPostForm('node', ['keys' => $this->randomMachineName(1)], t('Search'));
     $this->drupalPostForm(NULL, ['keys' => $this->randomMachineName()], t('Search'), [], 'search-form');
-    $this->assertNoText('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search');
+    $this->assertSession()->responseNotContains('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search');
 
     // Edit the block configuration so that it searches users instead of nodes,
     // and test.
diff --git a/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php b/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php
index c04c13926d..23a3bf62ce 100644
--- a/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php
+++ b/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php
@@ -89,8 +89,8 @@ public function testSearchCommentCountToggle() {
 
     // Test comment count display for nodes with comment status set to Open
     $this->drupalPostForm(NULL, $edit, t('Search'));
-    $this->assertText(t('0 comments'), 'Empty comment count displays for nodes with comment status set to Open');
-    $this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Open');
+    $this->assertSession()->responseContains(t('0 comments'), 'Empty comment count displays for nodes with comment status set to Open');
+    $this->assertSession()->responseContains(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Open');
 
     // Test comment count display for nodes with comment status set to Closed
     $this->searchableNodes['0 comments']->set('comment', CommentItemInterface::CLOSED);
@@ -99,8 +99,8 @@ public function testSearchCommentCountToggle() {
     $this->searchableNodes['1 comment']->save();
 
     $this->drupalPostForm(NULL, $edit, t('Search'));
-    $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Closed');
-    $this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Closed');
+    $this->assertSession()->responseNotContains(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Closed');
+    $this->assertSession()->responseContains(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Closed');
 
     // Test comment count display for nodes with comment status set to Hidden
     $this->searchableNodes['0 comments']->set('comment', CommentItemInterface::HIDDEN);
@@ -109,8 +109,8 @@ public function testSearchCommentCountToggle() {
     $this->searchableNodes['1 comment']->save();
 
     $this->drupalPostForm(NULL, $edit, t('Search'));
-    $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
-    $this->assertNoText(t('1 comment'), 'Non-empty comment count does not display for nodes with comment status set to Hidden');
+    $this->assertSession()->responseNotContains(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
+    $this->assertSession()->responseNotContains(t('1 comment'), 'Non-empty comment count does not display for nodes with comment status set to Hidden');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php
index e9f12fe583..665defa410 100644
--- a/core/modules/search/tests/src/Functional/SearchCommentTest.php
+++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php
@@ -160,18 +160,18 @@ public function testSearchResultsComment() {
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $node_storage->resetCache([$node->id()]);
     $node2 = $node_storage->load($node->id());
-    $this->assertText($node2->label(), 'Node found in search results.');
-    $this->assertText($edit_comment['subject[0][value]'], 'Comment subject found in search results.');
+    $this->assertSession()->responseContains($node2->label(), 'Node found in search results.');
+    $this->assertSession()->responseContains($edit_comment['subject[0][value]'], 'Comment subject found in search results.');
 
     // Search for the comment body.
     $edit = [
       'keys' => "'" . $comment_body . "'",
     ];
     $this->drupalPostForm(NULL, $edit, t('Search'));
-    $this->assertText($node2->label(), 'Node found in search results.');
+    $this->assertSession()->responseContains($node2->label(), 'Node found in search results.');
 
     // Verify that comment is rendered using proper format.
-    $this->assertText($comment_body, 'Comment body text found in search results.');
+    $this->assertSession()->responseContains($comment_body, 'Comment body text found in search results.');
     $this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
     $this->assertNoEscaped($edit_comment['comment_body[0][value]'], 'HTML in comment body is not escaped.');
 
@@ -219,7 +219,7 @@ public function testSearchResultsComment() {
 
     // Search for $title.
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText(t('Your search yielded no results.'));
+    $this->assertSession()->responseContains(t('Your search yielded no results.'));
   }
 
   /**
@@ -346,7 +346,7 @@ public function testAddNewComment() {
     // Verify that if you view the node on its own page, 'add new comment'
     // is there.
     $this->drupalGet('node/' . $node->id());
-    $this->assertText(t('Add new comment'));
+    $this->assertSession()->responseContains(t('Add new comment'));
 
     // Run cron to index this page.
     $this->drupalLogout();
@@ -355,13 +355,13 @@ public function testAddNewComment() {
     // Search for 'comment'. Should be no results.
     $this->drupalLogin($user);
     $this->drupalPostForm('search/node', ['keys' => 'comment'], t('Search'));
-    $this->assertText(t('Your search yielded no results'));
+    $this->assertSession()->responseContains(t('Your search yielded no results'));
 
     // Search for the node title. Should be found, and 'Add new comment' should
     // not be part of the search snippet.
     $this->drupalPostForm('search/node', ['keys' => 'short'], t('Search'));
-    $this->assertText($node->label(), 'Search for keyword worked');
-    $this->assertNoText(t('Add new comment'));
+    $this->assertSession()->responseContains($node->label(), 'Search for keyword worked');
+    $this->assertSession()->responseNotContains(t('Add new comment'));
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
index 92463e3b15..94b0e93e07 100644
--- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
@@ -79,26 +79,26 @@ public function testSearchSettingsPage() {
 
     // Test that the settings form displays the correct count of items left to index.
     $this->drupalGet('admin/config/search/pages');
-    $this->assertText(t('There are @count items left to index.', ['@count' => 0]));
+    $this->assertSession()->responseContains(t('There are @count items left to index.', ['@count' => 0]));
 
     // Test the re-index button.
     $this->drupalPostForm('admin/config/search/pages', [], t('Re-index site'));
-    $this->assertText(t('Are you sure you want to re-index the site'));
+    $this->assertSession()->responseContains(t('Are you sure you want to re-index the site'));
     $this->drupalPostForm('admin/config/search/pages/reindex', [], t('Re-index site'));
-    $this->assertText(t('All search indexes will be rebuilt'));
+    $this->assertSession()->responseContains(t('All search indexes will be rebuilt'));
     $this->drupalGet('admin/config/search/pages');
-    $this->assertText(t('There is 1 item left to index.'));
+    $this->assertSession()->responseContains(t('There is 1 item left to index.'));
 
     // Test that the form saves with the default values.
     $this->drupalPostForm('admin/config/search/pages', [], t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'), 'Form saves with the default values.');
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'), 'Form saves with the default values.');
 
     // Test that the form does not save with an invalid word length.
     $edit = [
       'minimum_word_size' => $this->randomMachineName(3),
     ];
     $this->drupalPostForm('admin/config/search/pages', $edit, t('Save configuration'));
-    $this->assertNoText(t('The configuration options have been saved.'), 'Form does not save with an invalid word length.');
+    $this->assertSession()->responseNotContains(t('The configuration options have been saved.'), 'Form does not save with an invalid word length.');
 
     // Test logging setting. It should be off by default.
     $text = $this->randomMachineName(5);
@@ -174,14 +174,14 @@ public function testSearchModuleDisabling() {
       $info = $plugin_info[$entity_id];
       $this->drupalGet('search/' . $entity->getPath(), ['query' => ['keys' => $info['keys']]]);
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertNoText('no results', $entity->label() . ' search found results');
-      $this->assertText($info['text'], 'Correct search text found');
+      $this->assertSession()->responseNotContains('no results', $entity->label() . ' search found results');
+      $this->assertSession()->responseContains($info['text'], 'Correct search text found');
 
       // Verify that other plugin search tab labels are not visible.
       foreach ($plugins as $other) {
         if ($other != $entity_id) {
           $label = $entities[$other]->label();
-          $this->assertNoText($label, $label . ' search tab is not shown');
+          $this->assertSession()->responseNotContains($label, $label . ' search tab is not shown');
         }
       }
 
@@ -220,7 +220,7 @@ public function testSearchModuleDisabling() {
       $this->drupalGet($item['path'], $item['options']);
       foreach ($plugins as $entity_id) {
         $label = $entities[$entity_id]->label();
-        $this->assertText($label, new FormattableMarkup('%label search tab is shown', ['%label' => $label]));
+        $this->assertSession()->responseContains($label, new FormattableMarkup('%label search tab is shown', ['%label' => $label]));
       }
     }
   }
@@ -248,7 +248,7 @@ public function testMultipleSearchPages() {
 
     // Ensure that no search pages are configured.
     $this->drupalGet('admin/config/search/pages');
-    $this->assertText(t('No search pages have been configured.'));
+    $this->assertSession()->responseContains(t('No search pages have been configured.'));
 
     // Add a search page.
     $edit = [];
@@ -273,7 +273,7 @@ public function testMultipleSearchPages() {
     $edit['id'] = strtolower($this->randomMachineName(8));
     $edit['path'] = $first['path'];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('The search page path must be unique.'));
+    $this->assertSession()->responseContains(t('The search page path must be unique.'));
 
     // Add a second search page.
     $second = [];
diff --git a/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php b/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php
index 88e31e0ed1..787fb4fdd1 100644
--- a/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php
+++ b/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php
@@ -61,18 +61,18 @@ public function testEmbeddedForm() {
     $this->drupalPostForm('search_embedded_form',
       ['name' => 'John'],
       t('Send away'));
-    $this->assertText(t('Test form was submitted'), 'Form message appears');
+    $this->assertSession()->responseContains(t('Test form was submitted'), 'Form message appears');
     $count = \Drupal::state()->get('search_embedded_form.submit_count');
     $this->assertEqual($this->submitCount + 1, $count, 'Form submission count is correct');
     $this->submitCount = $count;
 
     // Now verify that we can see and submit the form from the search results.
     $this->drupalGet('search/node', ['query' => ['keys' => $this->node->label()]]);
-    $this->assertText(t('Your name'), 'Form is visible');
+    $this->assertSession()->responseContains(t('Your name'), 'Form is visible');
     $this->drupalPostForm(NULL,
       ['name' => 'John'],
       t('Send away'));
-    $this->assertText(t('Test form was submitted'), 'Form message appears');
+    $this->assertSession()->responseContains(t('Test form was submitted'), 'Form message appears');
     $count = \Drupal::state()->get('search_embedded_form.submit_count');
     $this->assertEqual($this->submitCount + 1, $count, 'Form submission count is correct');
     $this->submitCount = $count;
@@ -82,7 +82,7 @@ public function testEmbeddedForm() {
     $this->drupalPostForm('search',
       ['keys' => 'foo'],
       t('Search'));
-    $this->assertNoText(t('Test form was submitted'), 'Form message does not appear');
+    $this->assertSession()->responseNotContains(t('Test form was submitted'), 'Form message does not appear');
     $count = \Drupal::state()->get('search_embedded_form.submit_count');
     $this->assertEqual($this->submitCount, $count, 'Form submission count is correct');
     $this->submitCount = $count;
diff --git a/core/modules/search/tests/src/Functional/SearchExactTest.php b/core/modules/search/tests/src/Functional/SearchExactTest.php
index 1b77e703c2..1dfe8f3e46 100644
--- a/core/modules/search/tests/src/Functional/SearchExactTest.php
+++ b/core/modules/search/tests/src/Functional/SearchExactTest.php
@@ -76,8 +76,8 @@ public function testExactQuery() {
 
     $edit = ['keys' => 'Druplicon'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText($user->getAccountName(), 'Basic page node displays author name when post settings are on.');
-    $this->assertText($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'), 'Basic page node displays post date when post settings are on.');
+    $this->assertSession()->responseContains($user->getAccountName(), 'Basic page node displays author name when post settings are on.');
+    $this->assertSession()->responseContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'), 'Basic page node displays post date when post settings are on.');
 
     // Check that with post settings turned off the user and changed date
     // information is not displayed.
@@ -85,8 +85,8 @@ public function testExactQuery() {
     $node_type_config->save();
     $edit = ['keys' => 'Druplicon'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertNoText($user->getAccountName(), 'Basic page node does not display author name when post settings are off.');
-    $this->assertNoText($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'), 'Basic page node does not display post date when post settings are off.');
+    $this->assertSession()->responseNotContains($user->getAccountName(), 'Basic page node does not display author name when post settings are off.');
+    $this->assertSession()->responseNotContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'), 'Basic page node does not display post date when post settings are off.');
 
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php b/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php
index 5b3daa61ba..e2d6dfbcb2 100644
--- a/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php
+++ b/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php
@@ -53,18 +53,18 @@ protected function setUp(): void {
   public function testSearchKeywordsConditions() {
     // No keys, not conditions - no results.
     $this->drupalGet('search/dummy_path');
-    $this->assertNoText('Dummy search snippet to display');
+    $this->assertSession()->responseNotContains('Dummy search snippet to display');
     // With keys - get results.
     $keys = 'bike shed ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]);
-    $this->assertText("Dummy search snippet to display. Keywords: {$keys}");
+    $this->assertSession()->responseContains("Dummy search snippet to display. Keywords: {$keys}");
     $keys = 'blue drop ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]);
-    $this->assertText("Dummy search snippet to display. Keywords: {$keys}");
+    $this->assertSession()->responseContains("Dummy search snippet to display. Keywords: {$keys}");
     // Add some conditions and keys.
     $keys = 'moving drop ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", ['query' => ['keys' => 'bike', 'search_conditions' => $keys]]);
-    $this->assertText("Dummy search snippet to display.");
+    $this->assertSession()->responseContains("Dummy search snippet to display.");
     $this->assertRaw(Html::escape(print_r(['keys' => 'bike', 'search_conditions' => $keys], TRUE)));
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchLanguageTest.php b/core/modules/search/tests/src/Functional/SearchLanguageTest.php
index c81834a25f..2e66db448a 100644
--- a/core/modules/search/tests/src/Functional/SearchLanguageTest.php
+++ b/core/modules/search/tests/src/Functional/SearchLanguageTest.php
@@ -96,13 +96,13 @@ public function testLanguages() {
     // Add predefined language.
     $edit = ['predefined_langcode' => 'fr'];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
-    $this->assertText('French', 'Language added successfully.');
+    $this->assertSession()->responseContains('French', 'Language added successfully.');
 
     // Now we should have languages displayed.
     $this->drupalGet('search/node');
-    $this->assertText(t('Languages'), 'Languages displayed to choose from.');
-    $this->assertText(t('English'), 'English is a possible choice.');
-    $this->assertText(t('French'), 'French is a possible choice.');
+    $this->assertSession()->responseContains(t('Languages'), 'Languages displayed to choose from.');
+    $this->assertSession()->responseContains(t('English'), 'English is a possible choice.');
+    $this->assertSession()->responseContains(t('French'), 'French is a possible choice.');
 
     // Ensure selecting no language does not make the query different.
     $this->drupalPostForm('search/node', [], 'edit-submit--2');
diff --git a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php
index bff7a40704..a678560913 100644
--- a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php
+++ b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php
@@ -289,17 +289,17 @@ protected function assertIndexCounts($remaining, $total, $message) {
     $indexed = $total - $remaining;
     $percent = ($total > 0) ? floor(100 * $indexed / $total) : 100;
     $this->drupalGet('admin/config/search/pages');
-    $this->assertText($percent . '% of the site has been indexed.', 'Progress percent text at top of Search settings page is correct at: ' . $message);
-    $this->assertText($remaining . ' item', 'Remaining text at top of Search settings page is correct at: ' . $message);
+    $this->assertSession()->responseContains($percent . '% of the site has been indexed.', 'Progress percent text at top of Search settings page is correct at: ' . $message);
+    $this->assertSession()->responseContains($remaining . ' item', 'Remaining text at top of Search settings page is correct at: ' . $message);
 
     // Check text in pages section of Search settings page.
-    $this->assertText($indexed . ' of ' . $total . ' indexed', 'Progress text in pages section of Search settings page is correct at: ' . $message);
+    $this->assertSession()->responseContains($indexed . ' of ' . $total . ' indexed', 'Progress text in pages section of Search settings page is correct at: ' . $message);
 
     // Check text on status report page.
     $this->drupalGet('admin/reports/status');
-    $this->assertText('Search index progress', 'Search status section header is present on status report page');
-    $this->assertText($percent . '%', 'Correct percentage is shown on status report page at: ' . $message);
-    $this->assertText('(' . $remaining . ' remaining)', 'Correct remaining value is shown on status report page at: ' . $message);
+    $this->assertSession()->responseContains('Search index progress', 'Search status section header is present on status report page');
+    $this->assertSession()->responseContains($percent . '%', 'Correct percentage is shown on status report page at: ' . $message);
+    $this->assertSession()->responseContains('(' . $remaining . ' remaining)', 'Correct remaining value is shown on status report page at: ' . $message);
   }
 
   /**
diff --git a/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php b/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php
index fbb83e009f..bdb2be58b5 100644
--- a/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php
+++ b/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php
@@ -55,7 +55,7 @@ public function testPhraseSearchPunctuation() {
     // Submit a phrase wrapped in double quotes to include the punctuation.
     $edit = ['keys' => '"bunny\'s"'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText($node->label());
+    $this->assertSession()->responseContains($node->label());
 
     // Check if the author is linked correctly to the user profile page.
     $username = $node->getOwner()->getAccountName();
@@ -65,12 +65,12 @@ public function testPhraseSearchPunctuation() {
     $edit = ['keys' => '&'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $this->assertNoRaw('<strong>&</strong>amp;');
-    $this->assertText('You must include at least one keyword');
+    $this->assertSession()->responseContains('You must include at least one keyword');
 
     $edit = ['keys' => '&amp;'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $this->assertNoRaw('<strong>&</strong>amp;');
-    $this->assertText('You must include at least one keyword');
+    $this->assertSession()->responseContains('You must include at least one keyword');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php b/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php
index d988f2ada7..ee8061fee1 100644
--- a/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php
+++ b/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php
@@ -60,7 +60,7 @@ public function testSearchIndexUpdateOnNodeChange() {
     // Search the node to verify it appears in search results
     $edit = ['keys' => 'knights'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText($node->label());
+    $this->assertSession()->responseContains($node->label());
 
     // Update the node
     $node->body->value = "We want a shrubbery!";
@@ -72,7 +72,7 @@ public function testSearchIndexUpdateOnNodeChange() {
     // Search again to verify the new text appears in test results.
     $edit = ['keys' => 'shrubbery'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText($node->label());
+    $this->assertSession()->responseContains($node->label());
   }
 
   /**
@@ -93,7 +93,7 @@ public function testSearchIndexUpdateOnNodeDeletion() {
     // Search the node to verify it appears in search results
     $edit = ['keys' => 'dragons'];
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText($node->label());
+    $this->assertSession()->responseContains($node->label());
 
     // Get the node info from the search index tables.
     $connection = Database::getConnection();
@@ -111,7 +111,7 @@ public function testSearchIndexUpdateOnNodeDeletion() {
 
     // Search again to verify the node doesn't appear anymore.
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertNoText($node->label());
+    $this->assertSession()->responseNotContains($node->label());
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php b/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php
index 2764619c8c..5dbbfd07fc 100644
--- a/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php
+++ b/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php
@@ -80,7 +80,7 @@ protected function setUp(): void {
     // Run cron to ensure the content is indexed.
     $this->cronRun();
     $this->drupalGet('admin/reports/dblog');
-    $this->assertText(t('Cron run completed'), 'Log shows cron run completed');
+    $this->assertSession()->responseContains(t('Cron run completed'), 'Log shows cron run completed');
   }
 
   /**
@@ -95,7 +95,7 @@ public function testNumberSearching() {
       $this->drupalPostForm('search/node',
         ['keys' => 'foo'],
         t('Search'));
-      $this->assertNoText($node->label(), new FormattableMarkup('%number: node title not shown in dummy search', ['%number' => $i]));
+      $this->assertSession()->responseNotContains($node->label(), new FormattableMarkup('%number: node title not shown in dummy search', ['%number' => $i]));
 
       // Now verify that we can find node i by searching for any of the
       // numbers.
@@ -108,7 +108,7 @@ public function testNumberSearching() {
         $this->drupalPostForm('search/node',
           ['keys' => $number],
           t('Search'));
-        $this->assertText($node->label(), new FormattableMarkup('%i: node title shown (search found the node) in search for number %number', ['%i' => $i, '%number' => $number]));
+        $this->assertSession()->responseContains($node->label(), new FormattableMarkup('%i: node title shown (search found the node) in search for number %number', ['%i' => $i, '%number' => $number]));
       }
     }
 
diff --git a/core/modules/search/tests/src/Functional/SearchNumbersTest.php b/core/modules/search/tests/src/Functional/SearchNumbersTest.php
index 34c9a675a2..808f6c7d78 100644
--- a/core/modules/search/tests/src/Functional/SearchNumbersTest.php
+++ b/core/modules/search/tests/src/Functional/SearchNumbersTest.php
@@ -87,7 +87,7 @@ protected function setUp(): void {
     // Run cron to ensure the content is indexed.
     $this->cronRun();
     $this->drupalGet('admin/reports/dblog');
-    $this->assertText(t('Cron run completed'), 'Log shows cron run completed');
+    $this->assertSession()->responseContains(t('Cron run completed'), 'Log shows cron run completed');
   }
 
   /**
@@ -108,14 +108,14 @@ public function testNumberSearching() {
       $this->drupalPostForm('search/node',
         ['keys' => 'foo'],
         t('Search'));
-      $this->assertNoText($node->label(), $type . ': node title not shown in dummy search');
+      $this->assertSession()->responseNotContains($node->label(), $type . ': node title not shown in dummy search');
 
       // Verify that the node title does appear as a link on the search page
       // when searching for the number.
       $this->drupalPostForm('search/node',
         ['keys' => $number],
         t('Search'));
-      $this->assertText($node->label(), new FormattableMarkup('%type: node title shown (search found the node) in search for number %number.', ['%type' => $type, '%number' => $number]));
+      $this->assertSession()->responseContains($node->label(), new FormattableMarkup('%type: node title shown (search found the node) in search for number %number.', ['%type' => $type, '%number' => $number]));
     }
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchPageCacheTagsTest.php b/core/modules/search/tests/src/Functional/SearchPageCacheTagsTest.php
index d01026f91c..c8552a2305 100644
--- a/core/modules/search/tests/src/Functional/SearchPageCacheTagsTest.php
+++ b/core/modules/search/tests/src/Functional/SearchPageCacheTagsTest.php
@@ -78,7 +78,7 @@ public function testSearchText() {
     $edit = [];
     $edit['keys'] = 'bike shed';
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText('bike shed shop');
+    $this->assertSession()->responseContains('bike shed shop');
     $this->assertCacheTag('config:search.page.node_search');
     $this->assertCacheTag('search_index');
     $this->assertCacheTag('search_index:node_search');
@@ -92,7 +92,7 @@ public function testSearchText() {
     $this->node->title = 'bike shop';
     $this->node->save();
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText('bike shop');
+    $this->assertSession()->responseContains('bike shop');
     $this->assertCacheTag('config:search.page.node_search');
     $this->assertCacheTag('search_index');
     $this->assertCacheTag('search_index:node_search');
@@ -105,7 +105,7 @@ public function testSearchText() {
     // Deleting a node should invalidate the search plugin's index cache tag.
     $this->node->delete();
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText('Your search yielded no results.');
+    $this->assertSession()->responseContains('Your search yielded no results.');
     $this->assertCacheTag('config:search.page.node_search');
     $this->assertCacheTag('search_index');
     $this->assertCacheTag('search_index:node_search');
@@ -174,7 +174,7 @@ public function testSearchTagsBubbling() {
 
     // Test that the value of the entity reference field is shown.
     $this->drupalGet('node/2');
-    $this->assertText('bike shed shop');
+    $this->assertSession()->responseContains('bike shed shop');
 
     // Refresh the search index.
     $this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex();
@@ -198,8 +198,8 @@ public function testSearchTagsBubbling() {
     $edit = [];
     $edit['keys'] = 'shop';
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText('bike shed shop');
-    $this->assertText('Llama shop');
+    $this->assertSession()->responseContains('bike shed shop');
+    $this->assertSession()->responseContains('Llama shop');
     $expected_cache_tags = Cache::mergeTags($default_search_tags, [
       'node:1',
       'user:2',
@@ -216,7 +216,7 @@ public function testSearchTagsBubbling() {
     $edit = [];
     $edit['keys'] = 'Llama';
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText('Llama shop');
+    $this->assertSession()->responseContains('Llama shop');
     $expected_cache_tags = Cache::mergeTags($default_search_tags, [
       'node:1',
       'node:2',
diff --git a/core/modules/search/tests/src/Functional/SearchPageOverrideTest.php b/core/modules/search/tests/src/Functional/SearchPageOverrideTest.php
index 1875190433..5aaae9c7e4 100644
--- a/core/modules/search/tests/src/Functional/SearchPageOverrideTest.php
+++ b/core/modules/search/tests/src/Functional/SearchPageOverrideTest.php
@@ -42,8 +42,8 @@ protected function setUp(): void {
   public function testSearchPageHook() {
     $keys = 'bike shed ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]);
-    $this->assertText('Dummy search snippet', 'Dummy search snippet is shown');
-    $this->assertText('Test page text is here', 'Page override is working');
+    $this->assertSession()->responseContains('Dummy search snippet', 'Dummy search snippet is shown');
+    $this->assertSession()->responseContains('Test page text is here', 'Page override is working');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchPageTextTest.php b/core/modules/search/tests/src/Functional/SearchPageTextTest.php
index dde3ac9496..5869b4b887 100644
--- a/core/modules/search/tests/src/Functional/SearchPageTextTest.php
+++ b/core/modules/search/tests/src/Functional/SearchPageTextTest.php
@@ -66,25 +66,25 @@ public function testSearchLabelXSS() {
   public function testSearchText() {
     $this->drupalLogin($this->searchingUser);
     $this->drupalGet('search/node');
-    $this->assertText(t('Enter your keywords'));
-    $this->assertText(t('Search'));
+    $this->assertSession()->responseContains(t('Enter your keywords'));
+    $this->assertSession()->responseContains(t('Search'));
     $this->assertTitle(t('Search') . ' | Drupal', 'Search page title is correct');
 
     $edit = [];
     $search_terms = 'bike shed ' . $this->randomMachineName();
     $edit['keys'] = $search_terms;
     $this->drupalPostForm('search/node', $edit, t('Search'));
-    $this->assertText('search yielded no results');
-    $this->assertText(t('Search'));
+    $this->assertSession()->responseContains('search yielded no results');
+    $this->assertSession()->responseContains(t('Search'));
     $title_source = 'Search for @keywords | Drupal';
     $this->assertTitle(t($title_source, ['@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)]), 'Search page title is correct');
-    $this->assertNoText('Node', 'Erroneous tab and breadcrumb text is not present');
-    $this->assertNoText(t('Node'), 'Erroneous translated tab and breadcrumb text is not present');
-    $this->assertText(t('Content'), 'Tab and breadcrumb text is present');
+    $this->assertSession()->responseNotContains('Node', 'Erroneous tab and breadcrumb text is not present');
+    $this->assertSession()->responseNotContains(t('Node'), 'Erroneous translated tab and breadcrumb text is not present');
+    $this->assertSession()->responseContains(t('Content'), 'Tab and breadcrumb text is present');
 
     $this->clickLink('Search help');
-    $this->assertText('Search help', 'Correct title is on search help page');
-    $this->assertText('Use upper-case OR to get more results', 'Correct text is on content search help page');
+    $this->assertSession()->responseContains('Search help', 'Correct title is on search help page');
+    $this->assertSession()->responseContains('Use upper-case OR to get more results', 'Correct text is on content search help page');
 
     // Search for a longer text, and see that it is in the title, truncated.
     $edit = [];
@@ -102,12 +102,12 @@ public function testSearchText() {
 
     $edit['keys'] = $this->searchingUser->getAccountName();
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText(t('Search'));
+    $this->assertSession()->responseContains(t('Search'));
     $this->assertTitle(t($title_source, ['@keywords' => Unicode::truncate($this->searchingUser->getAccountName(), 60, TRUE, TRUE)]));
 
     $this->clickLink('Search help');
-    $this->assertText('Search help', 'Correct title is on search help page');
-    $this->assertText('user names and partial user names', 'Correct text is on user search help page');
+    $this->assertSession()->responseContains('Search help', 'Correct title is on search help page');
+    $this->assertSession()->responseContains('user names and partial user names', 'Correct text is on user search help page');
 
     // Test that search keywords containing slashes are correctly loaded
     // from the GET params and displayed in the search form.
@@ -134,37 +134,37 @@ public function testSearchText() {
     // Test that a search on Node or User with no keywords entered generates
     // the "Please enter some keywords" message.
     $this->drupalPostForm('search/node', [], t('Search'));
-    $this->assertText(t('Please enter some keywords'), 'With no keywords entered, message is displayed on node page');
+    $this->assertSession()->responseContains(t('Please enter some keywords'), 'With no keywords entered, message is displayed on node page');
     $this->drupalPostForm('search/user', [], t('Search'));
-    $this->assertText(t('Please enter some keywords'), 'With no keywords entered, message is displayed on user page');
+    $this->assertSession()->responseContains(t('Please enter some keywords'), 'With no keywords entered, message is displayed on user page');
 
     // Make sure the "Please enter some keywords" message is NOT displayed if
     // you use "or" words or phrases in Advanced Search.
     $this->drupalPostForm('search/node', ['or' => $this->randomMachineName() . ' ' . $this->randomMachineName()], 'edit-submit--2');
-    $this->assertNoText(t('Please enter some keywords'), 'With advanced OR keywords entered, no keywords message is not displayed on node page');
+    $this->assertSession()->responseNotContains(t('Please enter some keywords'), 'With advanced OR keywords entered, no keywords message is not displayed on node page');
     $this->drupalPostForm('search/node', ['phrase' => '"' . $this->randomMachineName() . '" "' . $this->randomMachineName() . '"'], 'edit-submit--2');
-    $this->assertNoText(t('Please enter some keywords'), 'With advanced phrase entered, no keywords message is not displayed on node page');
+    $this->assertSession()->responseNotContains(t('Please enter some keywords'), 'With advanced phrase entered, no keywords message is not displayed on node page');
 
     // Verify that if you search for a too-short keyword, you get the right
     // message, and that if after that you search for a longer keyword, you
     // do not still see the message.
     $this->drupalPostForm('search/node', ['keys' => $this->randomMachineName(1)], t('Search'));
-    $this->assertText('You must include at least one keyword', 'Keyword message is displayed when searching for short word');
-    $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
+    $this->assertSession()->responseContains('You must include at least one keyword', 'Keyword message is displayed when searching for short word');
+    $this->assertSession()->responseNotContains(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
     $this->drupalPostForm(NULL, ['keys' => $this->randomMachineName()], t('Search'));
-    $this->assertNoText('You must include at least one keyword', 'Keyword message is not displayed when searching for long word after short word search');
+    $this->assertSession()->responseNotContains('You must include at least one keyword', 'Keyword message is not displayed when searching for long word after short word search');
 
     // Test that if you search for a URL with .. in it, you still end up at
     // the search page. See issue https://www.drupal.org/node/890058.
     $this->drupalPostForm('search/node', ['keys' => '../../admin'], t('Search'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('no results', 'Searching for ../../admin with non-admin user gives you a no search results page');
+    $this->assertSession()->responseContains('no results', 'Searching for ../../admin with non-admin user gives you a no search results page');
 
     // Test that if you search for a URL starting with "./", you still end up
     // at the search page. See issue https://www.drupal.org/node/1421560.
     $this->drupalPostForm('search/node', ['keys' => '.something'], t('Search'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('no results', 'Searching for .something gives you a no search results page');
+    $this->assertSession()->responseContains('no results', 'Searching for .something gives you a no search results page');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchPreprocessLangcodeTest.php b/core/modules/search/tests/src/Functional/SearchPreprocessLangcodeTest.php
index cebfc2a2ad..b9b6a74dc1 100644
--- a/core/modules/search/tests/src/Functional/SearchPreprocessLangcodeTest.php
+++ b/core/modules/search/tests/src/Functional/SearchPreprocessLangcodeTest.php
@@ -59,7 +59,7 @@ public function testPreprocessLangcode() {
     $this->drupalPostForm('search/node', $edit, 'edit-submit--2');
 
     // Checks if the langcode message has been set by hook_search_preprocess().
-    $this->assertText('Langcode Preprocess Test: en');
+    $this->assertSession()->responseContains('Langcode Preprocess Test: en');
   }
 
   /**
@@ -81,16 +81,16 @@ public function testPreprocessStemming() {
     $this->drupalPostForm('search/node', $edit, 'edit-submit--2');
 
     // Check if the node has been found.
-    $this->assertText('Search results');
-    $this->assertText('we are testing');
+    $this->assertSession()->responseContains('Search results');
+    $this->assertSession()->responseContains('we are testing');
 
     // Search for the same node using a different query.
     $edit = ['or' => 'test'];
     $this->drupalPostForm('search/node', $edit, 'edit-submit--2');
 
     // Check if the node has been found.
-    $this->assertText('Search results');
-    $this->assertText('we are testing');
+    $this->assertSession()->responseContains('Search results');
+    $this->assertSession()->responseContains('we are testing');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php b/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php
index bcfd7e2692..4ff0accd9e 100644
--- a/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php
+++ b/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php
@@ -50,8 +50,8 @@ public function testQueryAlter() {
     // Search for the body keyword 'pizza'.
     $this->drupalPostForm('search/node', ['keys' => 'pizza'], t('Search'));
     // The article should be there but not the page.
-    $this->assertText('article', 'Article is in search results');
-    $this->assertNoText('page', 'Page is not in search results');
+    $this->assertSession()->responseContains('article', 'Article is in search results');
+    $this->assertSession()->responseNotContains('page', 'Page is not in search results');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchRankingTest.php b/core/modules/search/tests/src/Functional/SearchRankingTest.php
index 592c951b2f..0aaf1a99f0 100644
--- a/core/modules/search/tests/src/Functional/SearchRankingTest.php
+++ b/core/modules/search/tests/src/Functional/SearchRankingTest.php
@@ -121,7 +121,7 @@ public function testRankings() {
 
     // Test that the settings form displays the content ranking section.
     $this->drupalGet('admin/config/search/pages/manage/node_search');
-    $this->assertText(t('Content ranking'));
+    $this->assertSession()->responseContains(t('Content ranking'));
 
     // Check that all rankings are visible and set to 0.
     foreach ($node_ranks as $node_rank) {
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php
index 2a30d9be5b..0d5643020f 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php
@@ -81,7 +81,7 @@ public function testShortcutLinkAdd() {
       ];
       $this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $set->id() . '/add-link', $form_data, t('Save'));
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertText(t('Added a shortcut for @title.', ['@title' => $title]));
+      $this->assertSession()->responseContains(t('Added a shortcut for @title.', ['@title' => $title]));
       $saved_set = ShortcutSet::load($set->id());
       $paths = $this->getShortcutInformation($saved_set, 'link');
       $this->assertContains('internal:' . $test_path, $paths, 'Shortcut created: ' . $test_path);
@@ -153,7 +153,7 @@ public function testShortcutQuickLink() {
 
     // Test the "Add to shortcuts" link.
     $this->clickLink('Add to Default shortcuts');
-    $this->assertText('Added a shortcut for Cron.');
+    $this->assertSession()->responseContains('Added a shortcut for Cron.');
     $this->assertLink('Cron', 0, 'Shortcut link found on page');
 
     $this->drupalGet('admin/structure');
@@ -162,7 +162,7 @@ public function testShortcutQuickLink() {
     // Test the "Remove from shortcuts" link.
     $this->clickLink('Cron');
     $this->clickLink('Remove from Default shortcuts');
-    $this->assertText('The shortcut Cron has been deleted.');
+    $this->assertSession()->responseContains('The shortcut Cron has been deleted.');
     $this->assertNoLink('Cron', 'Shortcut link removed from page');
 
     $this->drupalGet('admin/structure');
@@ -172,26 +172,26 @@ public function testShortcutQuickLink() {
 
     // Test the "Add to shortcuts" link for a page generated by views.
     $this->clickLink('Add to Default shortcuts');
-    $this->assertText('Added a shortcut for People.');
+    $this->assertSession()->responseContains('Added a shortcut for People.');
     $this->assertShortcutQuickLink('Remove from Default shortcuts');
 
     // Test the "Remove from  shortcuts" link for a page generated by views.
     $this->clickLink('Remove from Default shortcuts');
-    $this->assertText('The shortcut People has been deleted.');
+    $this->assertSession()->responseContains('The shortcut People has been deleted.');
     $this->assertShortcutQuickLink('Add to Default shortcuts');
 
     // Test two pages which use same route name but different route parameters.
     $this->drupalGet('node/add/page');
     // Add Shortcut for Basic Page.
     $this->clickLink('Add to Default shortcuts');
-    $this->assertText('Added a shortcut for Create Basic page.');
+    $this->assertSession()->responseContains('Added a shortcut for Create Basic page.');
     // Assure that Article does not have its shortcut indicated as set.
     $this->drupalGet('node/add/article');
     $link = $this->xpath('//a[normalize-space()=:label]', [':label' => 'Remove from Default shortcuts']);
     $this->assertTrue(empty($link), 'Link Remove to Default shortcuts not found for Create Article page.');
     // Add Shortcut for Article.
     $this->clickLink('Add to Default shortcuts');
-    $this->assertText('Added a shortcut for Create Article.');
+    $this->assertSession()->responseContains('Added a shortcut for Create Article.');
 
     $this->config('system.theme')->set('default', 'seven')->save();
     $this->drupalGet('node/' . $this->node->id());
@@ -199,12 +199,12 @@ public function testShortcutQuickLink() {
 
     // Test the "Add to shortcuts" link for node view route.
     $this->clickLink('Add to Default shortcuts');
-    $this->assertText(new FormattableMarkup('Added a shortcut for @title.', ['@title' => $title]));
+    $this->assertSession()->responseContains(new FormattableMarkup('Added a shortcut for @title.', ['@title' => $title]));
     $this->assertShortcutQuickLink('Remove from Default shortcuts');
 
     // Test the "Remove from shortcuts" link for node view route.
     $this->clickLink('Remove from Default shortcuts');
-    $this->assertText(new FormattableMarkup('The shortcut @title has been deleted.', ['@title' => $title]));
+    $this->assertSession()->responseContains(new FormattableMarkup('The shortcut @title has been deleted.', ['@title' => $title]));
     $this->assertShortcutQuickLink('Add to Default shortcuts');
 
     \Drupal::service('module_installer')->install(['block_content']);
@@ -241,7 +241,7 @@ public function testShortcutLinkRename() {
     $titles = $this->getShortcutInformation($saved_set, 'title');
     $this->assertContains($new_link_name, $titles, 'Shortcut renamed: ' . $new_link_name);
     $this->assertLink($new_link_name, 0, 'Renamed shortcut link appears on the page.');
-    $this->assertText(t('The shortcut @link has been updated.', ['@link' => $new_link_name]));
+    $this->assertSession()->responseContains(t('The shortcut @link has been updated.', ['@link' => $new_link_name]));
   }
 
   /**
@@ -260,7 +260,7 @@ public function testShortcutLinkChangePath() {
     $paths = $this->getShortcutInformation($saved_set, 'link');
     $this->assertContains('internal:' . $new_link_path, $paths, 'Shortcut path changed: ' . $new_link_path);
     $this->assertLinkByHref($new_link_path, 0, 'Shortcut with new path appears on the page.');
-    $this->assertText(t('The shortcut @link has been updated.', ['@link' => $shortcut->getTitle()]));
+    $this->assertSession()->responseContains(t('The shortcut @link has been updated.', ['@link' => $shortcut->getTitle()]));
   }
 
   /**
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
index 1123075e5a..1c12d6cb74 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
@@ -46,7 +46,7 @@ public function testShortcutSetAdd() {
     $new_set = $this->container->get('entity_type.manager')->getStorage('shortcut_set')->load($edit['id']);
     $this->assertIdentical($new_set->id(), $edit['id'], 'Successfully created a shortcut set.');
     $this->drupalGet('user/' . $this->adminUser->id() . '/shortcuts');
-    $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
+    $this->assertSession()->responseContains($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
   }
 
   /**
@@ -148,7 +148,7 @@ public function testShortcutSetSwitchCreate() {
   public function testShortcutSetSwitchNoSetName() {
     $edit = ['set' => 'new'];
     $this->drupalPostForm('user/' . $this->adminUser->id() . '/shortcuts', $edit, t('Change set'));
-    $this->assertText(t('The new set label is required.'));
+    $this->assertSession()->responseContains(t('The new set label is required.'));
     $current_set = shortcut_current_displayed_set($this->adminUser);
     $this->assertEqual($current_set->id(), $this->set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.');
     $this->assertFieldByXPath("//input[@name='label' and contains(concat(' ', normalize-space(@class), ' '), ' error ')]", NULL, 'The new set label field has the error class');
@@ -210,7 +210,7 @@ public function testShortcutSetCreateWithSetName() {
     $sets = ShortcutSet::loadMultiple();
     $this->assertTrue(isset($sets[$random_name]), 'Successfully created a shortcut set with a defined set name.');
     $this->drupalGet('user/' . $this->adminUser->id() . '/shortcuts');
-    $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
+    $this->assertSession()->responseContains($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
   }
 
 }
diff --git a/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php b/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php
index 33ddb136c9..f8fec6c9b7 100644
--- a/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php
+++ b/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php
@@ -90,21 +90,21 @@ public function testStatisticsSettings() {
     // "1 view" will actually be shown when the node is hit the second time).
     $this->drupalGet('node/' . $this->testNode->id());
     $this->client->post($stats_path, ['form_params' => $post]);
-    $this->assertText('1 view', 'Node is viewed once.');
+    $this->assertSession()->responseContains('1 view', 'Node is viewed once.');
 
     $this->drupalGet('node/' . $this->testNode->id());
     $this->client->post($stats_path, ['form_params' => $post]);
-    $this->assertText('2 views', 'Node is viewed 2 times.');
+    $this->assertSession()->responseContains('2 views', 'Node is viewed 2 times.');
 
     // Increase the max age to test that nodes are no longer immediately
     // updated, visit the node once more to populate the cache.
     $this->config('statistics.settings')->set('display_max_age', 3600)->save();
     $this->drupalGet('node/' . $this->testNode->id());
-    $this->assertText('3 views', 'Node is viewed 3 times.');
+    $this->assertSession()->responseContains('3 views', 'Node is viewed 3 times.');
 
     $this->client->post($stats_path, ['form_params' => $post]);
     $this->drupalGet('node/' . $this->testNode->id());
-    $this->assertText('3 views', 'Views counter was not updated.');
+    $this->assertSession()->responseContains('3 views', 'Views counter was not updated.');
   }
 
   /**
@@ -157,7 +157,7 @@ public function testExpiredLogs() {
     $this->client->post($stats_path, ['form_params' => $post]);
     $this->drupalGet('node/' . $this->testNode->id());
     $this->client->post($stats_path, ['form_params' => $post]);
-    $this->assertText('1 view', 'Node is viewed once.');
+    $this->assertSession()->responseContains('1 view', 'Node is viewed once.');
 
     // statistics_cron() will subtract
     // statistics.settings:accesslog.max_lifetime config from REQUEST_TIME in
@@ -167,7 +167,7 @@ public function testExpiredLogs() {
     $this->cronRun();
 
     $this->drupalGet('admin/reports/pages');
-    $this->assertNoText('node/' . $this->testNode->id(), 'No hit URL found.');
+    $this->assertSession()->responseNotContains('node/' . $this->testNode->id(), 'No hit URL found.');
 
     $result = Database::getConnection()->select('node_counter', 'nc')
       ->fields('nc', ['daycount'])
diff --git a/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php b/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php
index 0b80251d6c..2a3667ca4b 100644
--- a/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php
+++ b/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php
@@ -49,10 +49,10 @@ public function testPopularContentBlock() {
 
     // Get some page and check if the block is displayed.
     $this->drupalGet('user');
-    $this->assertText('Popular content', 'Found the popular content block.');
-    $this->assertText("Today's", "Found today's popular content.");
-    $this->assertText('All time', 'Found the all time popular content.');
-    $this->assertText('Last viewed', 'Found the last viewed popular content.');
+    $this->assertSession()->responseContains('Popular content', 'Found the popular content block.');
+    $this->assertSession()->responseContains("Today's", "Found today's popular content.");
+    $this->assertSession()->responseContains('All time', 'Found the all time popular content.');
+    $this->assertSession()->responseContains('Last viewed', 'Found the last viewed popular content.');
 
     $tags = Cache::mergeTags($node->getCacheTags(), $block->getCacheTags());
     $tags = Cache::mergeTags($tags, $this->blockingUser->getCacheTags());
diff --git a/core/modules/syslog/tests/src/Functional/SyslogTest.php b/core/modules/syslog/tests/src/Functional/SyslogTest.php
index 15aad39bfa..d231ddd3e8 100644
--- a/core/modules/syslog/tests/src/Functional/SyslogTest.php
+++ b/core/modules/syslog/tests/src/Functional/SyslogTest.php
@@ -33,7 +33,7 @@ public function testSettings() {
     // If we're on Windows, there is no configuration form.
     if (defined('LOG_LOCAL6')) {
       $this->drupalPostForm('admin/config/development/logging', ['syslog_facility' => LOG_LOCAL6], t('Save configuration'));
-      $this->assertText(t('The configuration options have been saved.'));
+      $this->assertSession()->responseContains(t('The configuration options have been saved.'));
 
       $this->drupalGet('admin/config/development/logging');
       // Should be one field.
diff --git a/core/modules/system/tests/src/Functional/Batch/PageTest.php b/core/modules/system/tests/src/Functional/Batch/PageTest.php
index d63aa5acb9..fa73de14b5 100644
--- a/core/modules/system/tests/src/Functional/Batch/PageTest.php
+++ b/core/modules/system/tests/src/Functional/Batch/PageTest.php
@@ -58,7 +58,7 @@ public function testBatchProgressPageTitle() {
     // Run initial step only first.
     $this->maximumMetaRefreshCount = 0;
     $this->drupalGet('batch-test/test-title');
-    $this->assertText('Batch Test', 'The test is in the html output.');
+    $this->assertSession()->responseContains('Batch Test', 'The test is in the html output.');
 
     // Leave the batch process running.
     $this->maximumMetaRefreshCount = NULL;
@@ -66,7 +66,7 @@ public function testBatchProgressPageTitle() {
 
     // The stack should contain the title shown on the progress page.
     $this->assertEqual(batch_test_stack(), ['Batch Test'], 'The batch title is shown on the batch page.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php b/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php
index 71fe35e5ac..39ff47520f 100644
--- a/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php
+++ b/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php
@@ -32,7 +32,7 @@ public function testBatchNoForm() {
     $this->drupalGet('batch-test/no-form');
     $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 2 performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
   }
 
   /**
@@ -43,7 +43,7 @@ public function testBatchRedirectFinishedCallback() {
     $this->drupalGet('batch-test/finish-redirect');
     $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 2 performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
-    $this->assertText('Test page text.', 'Custom redirection after batch execution displays the correct page.');
+    $this->assertSession()->responseContains('Test page text.', 'Custom redirection after batch execution displays the correct page.');
     $this->assertUrl(Url::fromRoute('test_page_test.test_page'));
   }
 
@@ -56,7 +56,7 @@ public function testBatchForm() {
     $this->drupalPostForm('batch-test', $edit, 'Submit');
     $this->assertNoEscaped('<', 'No escaped markup is present.');
     $this->assertBatchMessages($this->_resultMessages('batch_0'), 'Batch with no operation performed successfully.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
 
     // Batch 1: several simple operations.
     $edit = ['batch' => 'batch_1'];
@@ -64,7 +64,7 @@ public function testBatchForm() {
     $this->assertNoEscaped('<', 'No escaped markup is present.');
     $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch with simple operations performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
 
     // Batch 2: one multistep operation.
     $edit = ['batch' => 'batch_2'];
@@ -72,7 +72,7 @@ public function testBatchForm() {
     $this->assertNoEscaped('<', 'No escaped markup is present.');
     $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch with multistep operation performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
 
     // Batch 3: simple + multistep combined.
     $edit = ['batch' => 'batch_3'];
@@ -80,7 +80,7 @@ public function testBatchForm() {
     $this->assertNoEscaped('<', 'No escaped markup is present.');
     $this->assertBatchMessages($this->_resultMessages('batch_3'), 'Batch with simple and multistep operations performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
 
     // Batch 4: nested batch.
     $edit = ['batch' => 'batch_4'];
@@ -88,7 +88,7 @@ public function testBatchForm() {
     $this->assertNoEscaped('<', 'No escaped markup is present.');
     $this->assertBatchMessages($this->_resultMessages('batch_4'), 'Nested batch performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
 
     // Submit batches 4 and 7. Batch 4 will trigger batch 2. Batch 7 will
     // trigger batches 6 and 5.
@@ -122,27 +122,27 @@ public function testBatchForm() {
   public function testBatchFormMultistep() {
     $this->drupalGet('batch-test/multistep');
     $this->assertNoEscaped('<', 'No escaped markup is present.');
-    $this->assertText('step 1', 'Form is displayed in step 1.');
+    $this->assertSession()->responseContains('step 1', 'Form is displayed in step 1.');
 
     // First step triggers batch 1.
     $this->drupalPostForm(NULL, [], 'Submit');
     $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 1 performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
-    $this->assertText('step 2', 'Form is displayed in step 2.');
+    $this->assertSession()->responseContains('step 2', 'Form is displayed in step 2.');
     $this->assertNoEscaped('<', 'No escaped markup is present.');
 
     // Second step triggers batch 2.
     $this->drupalPostForm(NULL, [], 'Submit');
     $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch for step 2 performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
     $this->assertNoEscaped('<', 'No escaped markup is present.');
 
     // Extra query arguments will trigger logic that will add them to the
     // redirect URL. Make sure they are persisted.
     $this->drupalGet('batch-test/multistep', ['query' => ['big_tree' => 'small_axe']]);
     $this->drupalPostForm(NULL, [], 'Submit');
-    $this->assertText('step 2', 'Form is displayed in step 2.');
+    $this->assertSession()->responseContains('step 2', 'Form is displayed in step 2.');
     $this->assertStringContainsString('batch-test/multistep?big_tree=small_axe', $this->getUrl(), 'Query argument was persisted and another extra argument was added.');
   }
 
@@ -160,7 +160,7 @@ public function testBatchFormMultipleBatches() {
     // The stack contains execution order of batch callbacks and submit
     // handlers and logging of corresponding $form_state->getValues().
     $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
   }
 
   /**
@@ -178,7 +178,7 @@ public function testBatchFormProgrammatic() {
     // The stack contains execution order of batch callbacks and submit
     // handlers and logging of corresponding $form_state->getValues().
     $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.');
-    $this->assertText('Got out of a programmatic batched form.', 'Page execution continues normally.');
+    $this->assertSession()->responseContains('Got out of a programmatic batched form.', 'Page execution continues normally.');
   }
 
   /**
@@ -202,7 +202,7 @@ public function testBatchLargePercentage() {
     $this->drupalGet('batch-test/large-percentage');
     $this->assertBatchMessages($this->_resultMessages('batch_5'), 'Batch for step 2 performed successfully.');
     $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_5'), 'Execution order was correct.');
-    $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+    $this->assertSession()->responseContains('Redirection successful.', 'Redirection after batch execution is correct.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php b/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php
index be691a78a1..47a3b870db 100644
--- a/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php
+++ b/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php
@@ -31,7 +31,7 @@ public function testDrupalMessengerService() {
     // The page at system_test.messenger_service route sets two messages and
     // then removes the first before it is displayed.
     $this->drupalGet(Url::fromRoute('system_test.messenger_service'));
-    $this->assertNoText('First message (removed).');
+    $this->assertSession()->responseNotContains('First message (removed).');
     $this->assertRaw(t('Second message with <em>markup!</em> (not removed).'));
 
     // Ensure duplicate messages are handled as expected.
diff --git a/core/modules/system/tests/src/Functional/Common/FormatDateTest.php b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
index b2ff7b1a00..14a6c1dddf 100644
--- a/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
+++ b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
@@ -38,7 +38,7 @@ public function testAdminDefinedFormatDate() {
       'date_format_pattern' => 'j M Y',
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('Custom date format added.'));
+    $this->assertSession()->responseContains(t('Custom date format added.'));
 
     /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
     $date_formatter = $this->container->get('date.formatter');
diff --git a/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php b/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
index 1500cd3db6..a8e8c82668 100644
--- a/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
+++ b/core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
@@ -41,9 +41,9 @@ public function testConfigForm() {
     $this->assertField('bundles[page]', 'There is a page bundle selector.');
     $this->drupalPostForm(NULL, ['bundles[page]' => 'page', 'bundles[article]' => 'article'], t('Submit'));
     // @see \Drupal\condition_test\FormController::submitForm()
-    $this->assertText('Bundle: page');
-    $this->assertText('Bundle: article');
-    $this->assertText('Executed successfully.', 'The form configured condition executed properly.');
+    $this->assertSession()->responseContains('Bundle: page');
+    $this->assertSession()->responseContains('Bundle: article');
+    $this->assertSession()->responseContains('Executed successfully.', 'The form configured condition executed properly.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php b/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php
index a57b941e23..a5d9fb3f2c 100644
--- a/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php
+++ b/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php
@@ -42,8 +42,8 @@ public function testBogusAcceptHeader() {
     ];
     foreach ($tests as $case => $header) {
       $this->drupalGet('', [], ['Accept: ' . $header]);
-      $this->assertNoText('Unsupported Media Type', '"Unsupported Media Type" not found for ' . $case);
-      $this->assertText(t('Log in'), '"Log in" found for ' . $case);
+      $this->assertSession()->responseNotContains('Unsupported Media Type', '"Unsupported Media Type" not found for ' . $case);
+      $this->assertSession()->responseContains(t('Log in'), '"Log in" found for ' . $case);
     }
   }
 
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php b/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php
index 1ccb3eddd6..7c513e255a 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityAddUITest.php
@@ -47,7 +47,7 @@ public function testAddPageWithBundleEntities() {
     // No bundles exist, the add bundle message should be present as the user
     // has the necessary permissions.
     $this->drupalGet('/entity_test_with_bundle/add');
-    $this->assertText('There is no test entity bundle yet.');
+    $this->assertSession()->responseContains('There is no test entity bundle yet.');
     $this->assertLink('Add a new test entity bundle.');
 
     // One bundle exists, confirm redirection to the add-form.
@@ -69,8 +69,8 @@ public function testAddPageWithBundleEntities() {
 
     $this->assertLink('Test label');
     $this->assertLink('Test2 label');
-    $this->assertText('My test description');
-    $this->assertText('My test2 description');
+    $this->assertSession()->responseContains('My test description');
+    $this->assertSession()->responseContains('My test2 description');
 
     $this->clickLink('Test2 label');
     $this->drupalGet('/entity_test_with_bundle/add/test2');
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php b/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php
index 90bf02763e..74a5793bdb 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php
@@ -210,12 +210,12 @@ public function testEntityRevisionParamConverter() {
     $revision_url = 'entity_test_mulrev/' . $entity->id() . '/revision/' . $pending_revision->getRevisionId() . '/view';
 
     $this->drupalGet($revision_url);
-    $this->assertText('pending revision - en');
-    $this->assertNoText('pending revision - de');
+    $this->assertSession()->responseContains('pending revision - en');
+    $this->assertSession()->responseNotContains('pending revision - de');
 
     $this->drupalGet('de/' . $revision_url);
-    $this->assertText('pending revision - de');
-    $this->assertNoText('pending revision - en');
+    $this->assertSession()->responseContains('pending revision - de');
+    $this->assertSession()->responseNotContains('pending revision - en');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php b/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php
index 11306c3fa7..adce54bb09 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php
@@ -92,7 +92,7 @@ public function testEntityFormLanguage() {
     $edit['body[0][value]'] = $this->randomMachineName(16);
     $edit['langcode[0][value]'] = $langcode;
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
-    $this->assertText(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Basic page created.');
+    $this->assertSession()->responseContains(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Basic page created.');
 
     // Verify that the creation message contains a link to a node.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'node/']);
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php b/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php
index 79be1dad53..65353665b3 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php
@@ -132,7 +132,7 @@ public function testEntityViewControllerViewBuilder() {
     $entity_test = $this->createTestEntity('entity_test_view_builder');
     $entity_test->save();
     $this->drupalGet('entity_test_view_builder/' . $entity_test->id());
-    $this->assertText($entity_test->label());
+    $this->assertSession()->responseContains($entity_test->label());
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/File/ConfigTest.php b/core/modules/system/tests/src/Functional/File/ConfigTest.php
index 2145cef8e6..de5a5a042e 100644
--- a/core/modules/system/tests/src/Functional/File/ConfigTest.php
+++ b/core/modules/system/tests/src/Functional/File/ConfigTest.php
@@ -36,11 +36,11 @@ public function testFileConfigurationPage() {
     ];
 
     // Check that public and private can be selected as default scheme.
-    $this->assertText('Public local files served by the webserver.');
-    $this->assertText('Private local files served by Drupal.');
+    $this->assertSession()->responseContains('Public local files served by the webserver.');
+    $this->assertSession()->responseContains('Private local files served by Drupal.');
 
     $this->drupalPostForm(NULL, $fields, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
     foreach ($fields as $field => $value) {
       $this->assertFieldByName($field, $value);
     }
@@ -55,8 +55,8 @@ public function testFileConfigurationPage() {
     $this->rebuildContainer();
 
     $this->drupalGet('admin/config/media/file-system');
-    $this->assertText('Public local files served by the webserver.');
-    $this->assertNoText('Private local files served by Drupal.');
+    $this->assertSession()->responseContains('Public local files served by the webserver.');
+    $this->assertSession()->responseNotContains('Private local files served by Drupal.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php b/core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php
index 6d277d1878..fb04ebc6c7 100644
--- a/core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php
@@ -60,7 +60,7 @@ public function testUserRegistrationRebuild() {
       'mail' => 'bar@example.com',
     ];
     $this->drupalPostForm('user/register', $edit, 'Rebuild');
-    $this->assertText('Form rebuilt.');
+    $this->assertSession()->responseContains('Form rebuilt.');
     $this->assertFieldByName('name', 'foo', 'Entered username has been kept.');
     $this->assertFieldByName('mail', 'bar@example.com', 'Entered mail address has been kept.');
   }
@@ -74,7 +74,7 @@ public function testUserRegistrationMultipleField() {
       'mail' => 'bar@example.com',
     ];
     $this->drupalPostForm('user/register', $edit, t('Add another item'));
-    $this->assertText('Test a multiple valued field', 'Form has been rebuilt.');
+    $this->assertSession()->responseContains('Test a multiple valued field', 'Form has been rebuilt.');
     $this->assertFieldByName('name', 'foo', 'Entered username has been kept.');
     $this->assertFieldByName('mail', 'bar@example.com', 'Entered mail address has been kept.');
   }
diff --git a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
index b22be0bf7d..ebcb5558e8 100644
--- a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
@@ -30,7 +30,7 @@ public function testConfirmForm() {
     $this->drupalGet('form-test/confirm-form');
     $site_name = $this->config('system.site')->get('name');
     $this->assertTitle(t('ConfirmFormTestForm::getQuestion(). | @site-name', ['@site-name' => $site_name]), 'The question was found as the page title.');
-    $this->assertText(t('ConfirmFormTestForm::getDescription().'), 'The description was used.');
+    $this->assertSession()->responseContains(t('ConfirmFormTestForm::getDescription().'), 'The description was used.');
     $this->assertFieldByXPath('//input[@id="edit-submit"]', t('ConfirmFormTestForm::getConfirmText().'), 'The confirm text was used.');
 
     // Test cancelling the form.
@@ -39,7 +39,7 @@ public function testConfirmForm() {
 
     // Test submitting the form.
     $this->drupalPostForm('form-test/confirm-form', NULL, t('ConfirmFormTestForm::getConfirmText().'));
-    $this->assertText('The ConfirmFormTestForm::submitForm() method was used for this form.');
+    $this->assertSession()->responseContains('The ConfirmFormTestForm::submitForm() method was used for this form.');
     $this->assertUrl('', [], "The form's redirect was followed.");
 
     // Test submitting the form with a destination.
diff --git a/core/modules/system/tests/src/Functional/Form/ElementTest.php b/core/modules/system/tests/src/Functional/Form/ElementTest.php
index 75b6c8a6f7..1fc5fac0f8 100644
--- a/core/modules/system/tests/src/Functional/Form/ElementTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ElementTest.php
@@ -226,7 +226,7 @@ public function testFormAutocomplete() {
    */
   public function testFormElementErrors() {
     $this->drupalPostForm('form_test/details-form', [], 'Submit');
-    $this->assertText('I am an error on the details element.');
+    $this->assertSession()->responseContains('I am an error on the details element.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php b/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php
index 84ae3f79b1..88b77b7a51 100644
--- a/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php
@@ -28,13 +28,13 @@ class ElementsAccessTest extends BrowserTestBase {
    */
   public function testAccessFalse() {
     $this->drupalPostForm('form_test/vertical-tabs-access', NULL, t('Submit'));
-    $this->assertNoText(t('This checkbox inside a vertical tab does not have its default value.'));
-    $this->assertNoText(t('This textfield inside a vertical tab does not have its default value.'));
-    $this->assertNoText(t('This checkbox inside a fieldset does not have its default value.'));
-    $this->assertNoText(t('This checkbox inside a container does not have its default value.'));
-    $this->assertNoText(t('This checkbox inside a nested container does not have its default value.'));
-    $this->assertNoText(t('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'));
-    $this->assertText(t('The form submitted correctly.'));
+    $this->assertSession()->responseNotContains(t('This checkbox inside a vertical tab does not have its default value.'));
+    $this->assertSession()->responseNotContains(t('This textfield inside a vertical tab does not have its default value.'));
+    $this->assertSession()->responseNotContains(t('This checkbox inside a fieldset does not have its default value.'));
+    $this->assertSession()->responseNotContains(t('This checkbox inside a container does not have its default value.'));
+    $this->assertSession()->responseNotContains(t('This checkbox inside a nested container does not have its default value.'));
+    $this->assertSession()->responseNotContains(t('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'));
+    $this->assertSession()->responseContains(t('The form submitted correctly.'));
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Form/FormObjectTest.php b/core/modules/system/tests/src/Functional/Form/FormObjectTest.php
index 50ffdaddd7..210d76ccca 100644
--- a/core/modules/system/tests/src/Functional/Form/FormObjectTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormObjectTest.php
@@ -32,45 +32,45 @@ public function testObjectFormCallback() {
     $config_factory = $this->container->get('config.factory');
 
     $this->drupalGet('form-test/object-builder');
-    $this->assertText('The FormTestObject::buildForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestObject::buildForm() method was used for this form.');
     $elements = $this->xpath('//form[@id="form-test-form-test-object"]');
     $this->assertTrue(!empty($elements), 'The correct form ID was used.');
     $this->drupalPostForm(NULL, ['bananas' => 'green'], t('Save'));
-    $this->assertText('The FormTestObject::validateForm() method was used for this form.');
-    $this->assertText('The FormTestObject::submitForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestObject::validateForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestObject::submitForm() method was used for this form.');
     $value = $config_factory->get('form_test.object')->get('bananas');
     $this->assertIdentical('green', $value);
 
     $this->drupalGet('form-test/object-arguments-builder/yellow');
-    $this->assertText('The FormTestArgumentsObject::buildForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestArgumentsObject::buildForm() method was used for this form.');
     $elements = $this->xpath('//form[@id="form-test-form-test-arguments-object"]');
     $this->assertTrue(!empty($elements), 'The correct form ID was used.');
     $this->drupalPostForm(NULL, NULL, t('Save'));
-    $this->assertText('The FormTestArgumentsObject::validateForm() method was used for this form.');
-    $this->assertText('The FormTestArgumentsObject::submitForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestArgumentsObject::validateForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestArgumentsObject::submitForm() method was used for this form.');
     $value = $config_factory->get('form_test.object')->get('bananas');
     $this->assertIdentical('yellow', $value);
 
     $this->drupalGet('form-test/object-service-builder');
-    $this->assertText('The FormTestServiceObject::buildForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestServiceObject::buildForm() method was used for this form.');
     $elements = $this->xpath('//form[@id="form-test-form-test-service-object"]');
     $this->assertTrue(!empty($elements), 'The correct form ID was used.');
     $this->drupalPostForm(NULL, ['bananas' => 'brown'], t('Save'));
-    $this->assertText('The FormTestServiceObject::validateForm() method was used for this form.');
-    $this->assertText('The FormTestServiceObject::submitForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestServiceObject::validateForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestServiceObject::submitForm() method was used for this form.');
     $value = $config_factory->get('form_test.object')->get('bananas');
     $this->assertIdentical('brown', $value);
 
     $this->drupalGet('form-test/object-controller-builder');
-    $this->assertText('The FormTestControllerObject::create() method was used for this form.');
-    $this->assertText('The FormTestControllerObject::buildForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestControllerObject::create() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestControllerObject::buildForm() method was used for this form.');
     $elements = $this->xpath('//form[@id="form-test-form-test-controller-object"]');
     $this->assertTrue(!empty($elements), 'The correct form ID was used.');
-    $this->assertText('custom_value', 'Ensure parameters are injected from request attributes.');
-    $this->assertText('request_value', 'Ensure the request object is injected.');
+    $this->assertSession()->responseContains('custom_value', 'Ensure parameters are injected from request attributes.');
+    $this->assertSession()->responseContains('request_value', 'Ensure the request object is injected.');
     $this->drupalPostForm(NULL, ['bananas' => 'black'], t('Save'));
-    $this->assertText('The FormTestControllerObject::validateForm() method was used for this form.');
-    $this->assertText('The FormTestControllerObject::submitForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestControllerObject::validateForm() method was used for this form.');
+    $this->assertSession()->responseContains('The FormTestControllerObject::submitForm() method was used for this form.');
     $value = $config_factory->get('form_test.object')->get('bananas');
     $this->assertIdentical('black', $value);
   }
diff --git a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
index 6c7f9b2ccb..077e6129d7 100644
--- a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
@@ -47,34 +47,34 @@ protected function getFormBuildId() {
   public function testValidateFormStorageOnCachedPage() {
     $this->drupalGet('form-test/form-storage-page-cache');
     $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_initial = $this->getFormBuildId();
 
     // Trigger validation error by submitting an empty title.
     $edit = ['title' => ''];
     $this->drupalPostForm(NULL, $edit, 'Save');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_first_validation = $this->getFormBuildId();
     $this->assertNotEqual($build_id_initial, $build_id_first_validation, 'Build id changes when form validation fails');
 
     // Trigger validation error by again submitting an empty title.
     $edit = ['title' => ''];
     $this->drupalPostForm(NULL, $edit, 'Save');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_second_validation = $this->getFormBuildId();
     $this->assertEqual($build_id_first_validation, $build_id_second_validation, 'Build id remains the same when form validation fails subsequently');
 
     // Repeat the test sequence but this time with a page loaded from the cache.
     $this->drupalGet('form-test/form-storage-page-cache');
     $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_from_cache_initial = $this->getFormBuildId();
     $this->assertEqual($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request');
 
     // Trigger validation error by submitting an empty title.
     $edit = ['title' => ''];
     $this->drupalPostForm(NULL, $edit, 'Save');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_from_cache_first_validation = $this->getFormBuildId();
     $this->assertNotEqual($build_id_initial, $build_id_from_cache_first_validation, 'Build id changes when form validation fails');
     $this->assertNotEqual($build_id_first_validation, $build_id_from_cache_first_validation, 'Build id from first user is not reused');
@@ -82,7 +82,7 @@ public function testValidateFormStorageOnCachedPage() {
     // Trigger validation error by again submitting an empty title.
     $edit = ['title' => ''];
     $this->drupalPostForm(NULL, $edit, 'Save');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_from_cache_second_validation = $this->getFormBuildId();
     $this->assertEqual($build_id_from_cache_first_validation, $build_id_from_cache_second_validation, 'Build id remains the same when form validation fails subsequently');
   }
@@ -93,7 +93,7 @@ public function testValidateFormStorageOnCachedPage() {
   public function testRebuildFormStorageOnCachedPage() {
     $this->drupalGet('form-test/form-storage-page-cache');
     $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
-    $this->assertText('No old build id', 'No old build id on the page');
+    $this->assertSession()->responseContains('No old build id', 'No old build id on the page');
     $build_id_initial = $this->getFormBuildId();
 
     // Trigger rebuild, should regenerate build id. When a submit handler
@@ -103,15 +103,15 @@ public function testRebuildFormStorageOnCachedPage() {
     // that initial build ID.
     $edit = ['title' => 'something'];
     $this->drupalPostForm(NULL, $edit, 'Rebuild');
-    $this->assertNoText('No old build id', 'There is no old build id on the page.');
-    $this->assertNoText($build_id_initial, 'The old build id is not the initial build id.');
+    $this->assertSession()->responseNotContains('No old build id', 'There is no old build id on the page.');
+    $this->assertSession()->responseNotContains($build_id_initial, 'The old build id is not the initial build id.');
     $build_id_first_rebuild = $this->getFormBuildId();
     $this->assertNotEqual($build_id_initial, $build_id_first_rebuild, 'Build id changes on first rebuild.');
 
     // Trigger subsequent rebuild, should regenerate the build id again.
     $edit = ['title' => 'something'];
     $this->drupalPostForm(NULL, $edit, 'Rebuild');
-    $this->assertText($build_id_first_rebuild, 'First build id as old build id on the page');
+    $this->assertSession()->responseContains($build_id_first_rebuild, 'First build id as old build id on the page');
     $build_id_second_rebuild = $this->getFormBuildId();
     $this->assertNotEqual($build_id_first_rebuild, $build_id_second_rebuild, 'Build id changes on second rebuild.');
   }
diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php
index bf5fb27646..f25714bc12 100644
--- a/core/modules/system/tests/src/Functional/Form/FormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormTest.php
@@ -259,7 +259,7 @@ public function testInputWithInvalidToken() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
     $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
-    $this->assertText('The form has become outdated. Copy any unsaved work in the form below');
+    $this->assertSession()->responseContains('The form has become outdated. Copy any unsaved work in the form below');
     // Verify that input elements retained the posted values.
     $this->assertFieldByName('textfield', $edit['textfield']);
     $this->assertNoFieldChecked('edit-checkboxes-foo');
@@ -278,7 +278,7 @@ public function testInputWithInvalidToken() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
     $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
-    $this->assertText('The form has become outdated. Copy any unsaved work in the form below');
+    $this->assertSession()->responseContains('The form has become outdated. Copy any unsaved work in the form below');
     $this->assertFieldByName('textfield', $edit['textfield']);
     $this->assertFieldByName('textarea', $edit['textarea']);
 
@@ -292,7 +292,7 @@ public function testInputWithInvalidToken() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
     $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
-    $this->assertText('The form has become outdated. Copy any unsaved work in the form below');
+    $this->assertSession()->responseContains('The form has become outdated. Copy any unsaved work in the form below');
     $this->assertFieldByName('integer_step', $edit['integer_step']);
 
     // Check a form with a Url field
@@ -305,7 +305,7 @@ public function testInputWithInvalidToken() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Submit');
     $this->assertFieldByXpath('//div[contains(@class, "error")]', NULL, 'Error message is displayed with invalid token even when required fields are filled.');
-    $this->assertText('The form has become outdated. Copy any unsaved work in the form below');
+    $this->assertSession()->responseContains('The form has become outdated. Copy any unsaved work in the form below');
     $this->assertFieldByName('url', $edit['url']);
   }
 
@@ -410,7 +410,7 @@ public function testSelect() {
         'multiple_no_default',
     ];
     foreach ($no_errors as $key) {
-      $this->assertNoText(t('@name field is required.', ['@name' => $form[$key]['#title']]));
+      $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => $form[$key]['#title']]));
     }
 
     $expected_errors = [
@@ -421,7 +421,7 @@ public function testSelect() {
         'multiple_no_default_required',
     ];
     foreach ($expected_errors as $key) {
-      $this->assertText(t('@name field is required.', ['@name' => $form[$key]['#title']]));
+      $this->assertSession()->responseContains(t('@name field is required.', ['@name' => $form[$key]['#title']]));
     }
 
     // Post values for required fields.
@@ -871,7 +871,7 @@ public function testInputForgery() {
     // an input forgery.
     // @see \Drupal\form_test\Form\FormTestInputForgeryForm::postRender
     $this->drupalPostForm(NULL, ['checkboxes[one]' => TRUE, 'checkboxes[two]' => TRUE], t('Submit'));
-    $this->assertText('An illegal choice has been detected.', 'Input forgery was detected.');
+    $this->assertSession()->responseContains('An illegal choice has been detected.', 'Input forgery was detected.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php
index 7a248e3193..34c6abcd24 100644
--- a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php
@@ -49,7 +49,7 @@ public function testModuleListForm() {
     // Ensure that the Database Logging module's machine name is printed. This
     // module is used because its machine name is different than its human
     // readable name.
-    $this->assertText('dblog');
+    $this->assertSession()->responseContains('dblog');
   }
 
   /**
@@ -140,7 +140,7 @@ public function testInstalledIncompatibleModule() {
     $edit = ['modules[changing_module][enable]' => 'changing_module'];
     $this->drupalGet('admin/modules');
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
-    $this->assertText('Module Module that changes has been enabled.');
+    $this->assertSession()->responseContains('Module Module that changes has been enabled.');
 
     $incompatible_updates = [
       [
@@ -154,23 +154,23 @@ public function testInstalledIncompatibleModule() {
       $incompatible_info = $info + $incompatible_update;
       file_put_contents($file_path, Yaml::encode($incompatible_info));
       $this->drupalGet('admin/modules');
-      $this->assertText($incompatible_modules_message);
+      $this->assertSession()->responseContains($incompatible_modules_message);
 
       file_put_contents($file_path, Yaml::encode($compatible_info));
       $this->drupalGet('admin/modules');
-      $this->assertNoText($incompatible_modules_message);
+      $this->assertSession()->responseNotContains($incompatible_modules_message);
     }
     // Uninstall the module and ensure that incompatible modules message is not
     // displayed for modules that are not installed.
     $edit = ['uninstall[changing_module]' => 'changing_module'];
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText('The selected modules have been uninstalled.');
+    $this->assertSession()->responseContains('The selected modules have been uninstalled.');
     foreach ($incompatible_updates as $incompatible_update) {
       $incompatible_info = $info + $incompatible_update;
       file_put_contents($file_path, Yaml::encode($incompatible_info));
       $this->drupalGet('admin/modules');
-      $this->assertNoText($incompatible_modules_message);
+      $this->assertSession()->responseNotContains($incompatible_modules_message);
     }
   }
 
diff --git a/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php b/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php
index 9beba1fc7d..f0e43a2b32 100644
--- a/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php
@@ -31,7 +31,7 @@ public function testSystemConfigForm() {
     $element = $this->xpath('//div[@id = :id]/input[contains(@class, :class)]', [':id' => 'edit-actions', ':class' => 'button--primary']);
     $this->assertNotEmpty($element, 'The primary action submit button was found.');
     $this->drupalPostForm(NULL, [], t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Form/ValidationTest.php b/core/modules/system/tests/src/Functional/Form/ValidationTest.php
index 3ae3ffee1a..ed3ea08f41 100644
--- a/core/modules/system/tests/src/Functional/Form/ValidationTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ValidationTest.php
@@ -37,7 +37,7 @@ public function testValidate() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Save');
     $this->assertFieldByName('name', '#value changed by #element_validate', 'Form element #value was altered.');
-    $this->assertText('Name value: value changed by setValueForElement() in #element_validate', 'Form element value in $form_state was altered.');
+    $this->assertSession()->responseContains('Name value: value changed by setValueForElement() in #element_validate', 'Form element value in $form_state was altered.');
 
     // Verify that #validate handlers can alter the form and submitted
     // form values.
@@ -46,7 +46,7 @@ public function testValidate() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Save');
     $this->assertFieldByName('name', '#value changed by #validate', 'Form element #value was altered.');
-    $this->assertText('Name value: value changed by setValueForElement() in #validate', 'Form element value in $form_state was altered.');
+    $this->assertSession()->responseContains('Name value: value changed by setValueForElement() in #validate', 'Form element value in $form_state was altered.');
 
     // Verify that #element_validate handlers can make form elements
     // inaccessible, but values persist.
@@ -55,12 +55,12 @@ public function testValidate() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Save');
     $this->assertNoFieldByName('name', 'Form element was hidden.');
-    $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.');
+    $this->assertSession()->responseContains('Name value: element_validate_access', 'Value for inaccessible form element exists.');
 
     // Verify that value for inaccessible form element persists.
     $this->drupalPostForm(NULL, [], 'Save');
     $this->assertNoFieldByName('name', 'Form element was hidden.');
-    $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.');
+    $this->assertSession()->responseContains('Name value: element_validate_access', 'Value for inaccessible form element exists.');
 
     // Verify that #validate handlers don't run if the CSRF token is invalid.
     $this->drupalLogin($this->drupalCreateUser());
@@ -73,8 +73,8 @@ public function testValidate() {
       ->setValue('invalid_token');
     $this->drupalPostForm(NULL, ['name' => 'validate'], 'Save');
     $this->assertNoFieldByName('name', '#value changed by #validate', 'Form element #value was not altered.');
-    $this->assertNoText('Name value: value changed by setValueForElement() in #validate', 'Form element value in $form_state was not altered.');
-    $this->assertText('The form has become outdated. Copy any unsaved work in the form below');
+    $this->assertSession()->responseNotContains('Name value: value changed by setValueForElement() in #validate', 'Form element value in $form_state was not altered.');
+    $this->assertSession()->responseContains('The form has become outdated. Copy any unsaved work in the form below');
   }
 
   /**
@@ -82,7 +82,7 @@ public function testValidate() {
    */
   public function testDisabledToken() {
     $this->drupalPostForm('form-test/validate-no-token', [], 'Save');
-    $this->assertText('The form_test_validate_no_token form has been submitted successfully.');
+    $this->assertSession()->responseContains('The form_test_validate_no_token form has been submitted successfully.');
   }
 
   /**
@@ -120,30 +120,30 @@ public function testValidateLimitErrors() {
     // validated, but the #element_validate handler for the 'test' field
     // is triggered.
     $this->drupalPostForm($path, $edit, t('Partial validate'));
-    $this->assertNoText(t('@name field is required.', ['@name' => 'Title']));
-    $this->assertText('Test element is invalid');
+    $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => 'Title']));
+    $this->assertSession()->responseContains('Test element is invalid');
 
     // Edge case of #limit_validation_errors containing numeric indexes: same
     // thing with the 'Partial validate (numeric index)' button and the
     // 'test_numeric_index' field.
     $this->drupalPostForm($path, $edit, t('Partial validate (numeric index)'));
-    $this->assertNoText(t('@name field is required.', ['@name' => 'Title']));
-    $this->assertText('Test (numeric index) element is invalid');
+    $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => 'Title']));
+    $this->assertSession()->responseContains('Test (numeric index) element is invalid');
 
     // Ensure something like 'foobar' isn't considered "inside" 'foo'.
     $this->drupalPostForm($path, $edit, t('Partial validate (substring)'));
-    $this->assertNoText(t('@name field is required.', ['@name' => 'Title']));
-    $this->assertText('Test (substring) foo element is invalid');
+    $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => 'Title']));
+    $this->assertSession()->responseContains('Test (substring) foo element is invalid');
 
     // Ensure not validated values are not available to submit handlers.
     $this->drupalPostForm($path, ['title' => '', 'test' => 'valid'], t('Partial validate'));
-    $this->assertText('Only validated values appear in the form values.');
+    $this->assertSession()->responseContains('Only validated values appear in the form values.');
 
     // Now test full form validation and ensure that the #element_validate
     // handler is still triggered.
     $this->drupalPostForm($path, $edit, t('Full validate'));
-    $this->assertText(t('@name field is required.', ['@name' => 'Title']));
-    $this->assertText('Test element is invalid');
+    $this->assertSession()->responseContains(t('@name field is required.', ['@name' => 'Title']));
+    $this->assertSession()->responseContains('Test element is invalid');
   }
 
   /**
@@ -219,15 +219,15 @@ public function testCustomRequiredError() {
 
     foreach (Element::children($form) as $key) {
       if (isset($form[$key]['#required_error'])) {
-        $this->assertNoText(t('@name field is required.', ['@name' => $form[$key]['#title']]));
-        $this->assertText($form[$key]['#required_error']);
+        $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => $form[$key]['#title']]));
+        $this->assertSession()->responseContains($form[$key]['#required_error']);
       }
       elseif (isset($form[$key]['#form_test_required_error'])) {
-        $this->assertNoText(t('@name field is required.', ['@name' => $form[$key]['#title']]));
-        $this->assertText($form[$key]['#form_test_required_error']);
+        $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => $form[$key]['#title']]));
+        $this->assertSession()->responseContains($form[$key]['#form_test_required_error']);
       }
     }
-    $this->assertNoText(t('An illegal choice has been detected. Please contact the site administrator.'));
+    $this->assertSession()->responseNotContains(t('An illegal choice has been detected. Please contact the site administrator.'));
 
     // Verify that no custom validation error appears with valid values.
     $edit = [
@@ -239,15 +239,15 @@ public function testCustomRequiredError() {
 
     foreach (Element::children($form) as $key) {
       if (isset($form[$key]['#required_error'])) {
-        $this->assertNoText(t('@name field is required.', ['@name' => $form[$key]['#title']]));
-        $this->assertNoText($form[$key]['#required_error']);
+        $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => $form[$key]['#title']]));
+        $this->assertSession()->responseNotContains($form[$key]['#required_error']);
       }
       elseif (isset($form[$key]['#form_test_required_error'])) {
-        $this->assertNoText(t('@name field is required.', ['@name' => $form[$key]['#title']]));
-        $this->assertNoText($form[$key]['#form_test_required_error']);
+        $this->assertSession()->responseNotContains(t('@name field is required.', ['@name' => $form[$key]['#title']]));
+        $this->assertSession()->responseNotContains($form[$key]['#form_test_required_error']);
       }
     }
-    $this->assertNoText(t('An illegal choice has been detected. Please contact the site administrator.'));
+    $this->assertSession()->responseNotContains(t('An illegal choice has been detected. Please contact the site administrator.'));
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Lock/LockFunctionalTest.php b/core/modules/system/tests/src/Functional/Lock/LockFunctionalTest.php
index 8dcb88ce03..7c1ab70cab 100644
--- a/core/modules/system/tests/src/Functional/Lock/LockFunctionalTest.php
+++ b/core/modules/system/tests/src/Functional/Lock/LockFunctionalTest.php
@@ -36,12 +36,12 @@ public function testLockAcquire() {
 
     // Cause another request to acquire the lock.
     $this->drupalGet('system-test/lock-acquire');
-    $this->assertText($lock_acquired, 'Lock acquired by the other request.', 'Lock');
+    $this->assertSession()->responseContains($lock_acquired, 'Lock acquired by the other request.', 'Lock');
     // The other request has finished, thus it should have released its lock.
     $this->assertTrue($lock->acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock');
     // This request holds the lock, so the other request cannot acquire it.
     $this->drupalGet('system-test/lock-acquire');
-    $this->assertText($lock_not_acquired, 'Lock not acquired by the other request.', 'Lock');
+    $this->assertSession()->responseContains($lock_not_acquired, 'Lock not acquired by the other request.', 'Lock');
     $lock->release('system_test_lock_acquire');
 
     // Try a very short timeout and lock breaking.
@@ -49,14 +49,14 @@ public function testLockAcquire() {
     sleep(1);
     // The other request should break our lock.
     $this->drupalGet('system-test/lock-acquire');
-    $this->assertText($lock_acquired, 'Lock acquired by the other request, breaking our lock.', 'Lock');
+    $this->assertSession()->responseContains($lock_acquired, 'Lock acquired by the other request, breaking our lock.', 'Lock');
     // We cannot renew it, since the other thread took it.
     $this->assertFalse($lock->acquire('system_test_lock_acquire'), 'Lock cannot be extended by this request.', 'Lock');
 
     // Check the shut-down function.
     $lock_acquired_exit = 'TRUE: Lock successfully acquired in \Drupal\system_test\Controller\SystemTestController::lockExit()';
     $this->drupalGet('system-test/lock-exit');
-    $this->assertText($lock_acquired_exit, 'Lock acquired by the other request before exit.', 'Lock');
+    $this->assertSession()->responseContains($lock_acquired_exit, 'Lock acquired by the other request before exit.', 'Lock');
     $this->assertTrue($lock->acquire('system_test_lock_exit'), 'Lock acquired by this request after the other request exits.', 'Lock');
   }
 
@@ -67,21 +67,21 @@ public function testPersistentLock() {
     $persistent_lock = $this->container->get('lock.persistent');
     // Get a persistent lock.
     $this->drupalGet('system-test/lock-persist/lock1');
-    $this->assertText('TRUE: Lock successfully acquired in SystemTestController::lockPersist()');
+    $this->assertSession()->responseContains('TRUE: Lock successfully acquired in SystemTestController::lockPersist()');
     // Ensure that a shutdown function has not released the lock.
     $this->assertFalse($persistent_lock->lockMayBeAvailable('lock1'));
     $this->drupalGet('system-test/lock-persist/lock1');
-    $this->assertText('FALSE: Lock not acquired in SystemTestController::lockPersist()');
+    $this->assertSession()->responseContains('FALSE: Lock not acquired in SystemTestController::lockPersist()');
 
     // Get another persistent lock.
     $this->drupalGet('system-test/lock-persist/lock2');
-    $this->assertText('TRUE: Lock successfully acquired in SystemTestController::lockPersist()');
+    $this->assertSession()->responseContains('TRUE: Lock successfully acquired in SystemTestController::lockPersist()');
     $this->assertFalse($persistent_lock->lockMayBeAvailable('lock2'));
 
     // Release the first lock and try getting it again.
     $persistent_lock->release('lock1');
     $this->drupalGet('system-test/lock-persist/lock1');
-    $this->assertText('TRUE: Lock successfully acquired in SystemTestController::lockPersist()');
+    $this->assertSession()->responseContains('TRUE: Lock successfully acquired in SystemTestController::lockPersist()');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php
index 47077f1d7e..9d5fda8141 100644
--- a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php
+++ b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php
@@ -63,7 +63,7 @@ protected function doTestHookMenuIntegration() {
     $base_path = 'foo/' . $machine_name;
     $this->drupalGet($base_path);
     // Confirm correct controller activated.
-    $this->assertText('test1');
+    $this->assertSession()->responseContains('test1');
     // Confirm local task links are displayed.
     $this->assertLink('Local task A');
     $this->assertLink('Local task B');
@@ -79,8 +79,8 @@ protected function doTestHookMenuIntegration() {
    */
   protected function doTestTitleCallbackFalse() {
     $this->drupalGet('test-page');
-    $this->assertText('A title with @placeholder', 'Raw text found on the page');
-    $this->assertNoText(t('A title with @placeholder', ['@placeholder' => 'some other text']), 'Text with placeholder substitutions not found.');
+    $this->assertSession()->responseContains('A title with @placeholder', 'Raw text found on the page');
+    $this->assertSession()->responseNotContains(t('A title with @placeholder', ['@placeholder' => 'some other text']), 'Text with placeholder substitutions not found.');
   }
 
   /**
@@ -89,10 +89,10 @@ protected function doTestTitleCallbackFalse() {
   protected function doTestTitleMenuCallback() {
     // Verify that the menu router item title is not visible.
     $this->drupalGet('');
-    $this->assertNoText(t('Menu Callback Title'));
+    $this->assertSession()->responseNotContains(t('Menu Callback Title'));
     // Verify that the menu router item title is output as page title.
     $this->drupalGet('menu_callback_title');
-    $this->assertText(t('Menu Callback Title'));
+    $this->assertSession()->responseContains(t('Menu Callback Title'));
   }
 
   /**
@@ -101,7 +101,7 @@ protected function doTestTitleMenuCallback() {
   protected function doTestDescriptionMenuItems() {
     // Verify that the menu router item title is output as page title.
     $this->drupalGet('menu_callback_description');
-    $this->assertText(t('Menu item description text'));
+    $this->assertSession()->responseContains(t('Menu item description text'));
   }
 
   /**
@@ -166,11 +166,11 @@ protected function doTestMenuHierarchy() {
   protected function doTestMenuOptionalPlaceholders() {
     $this->drupalGet('menu-test/optional');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Sometimes there is no placeholder.');
+    $this->assertSession()->responseContains('Sometimes there is no placeholder.');
 
     $this->drupalGet('menu-test/optional/foobar');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText("Sometimes there is a placeholder: 'foobar'.");
+    $this->assertSession()->responseContains("Sometimes there is a placeholder: 'foobar'.");
   }
 
   /**
@@ -201,7 +201,7 @@ protected function doTestExoticPath() {
       "éøïвβ中國書۞";
     $this->drupalGet($path);
     $this->assertRaw('This is the menuTestCallback content.');
-    $this->assertNoText(t('The website encountered an unexpected error. Please try again later.'));
+    $this->assertSession()->responseNotContains(t('The website encountered an unexpected error. Please try again later.'));
   }
 
   /**
@@ -214,9 +214,9 @@ public function testMaintenanceModeLoginPaths() {
 
     $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', ['@site' => $this->config('system.site')->get('name')]);
     $this->drupalGet('test-page');
-    $this->assertText($offline_message);
+    $this->assertSession()->responseContains($offline_message);
     $this->drupalGet('menu_login_callback');
-    $this->assertText('This is TestControllers::testLogin.', 'Maintenance mode can be bypassed using an event subscriber.');
+    $this->assertSession()->responseContains('This is TestControllers::testLogin.', 'Maintenance mode can be bypassed using an event subscriber.');
 
     $this->container->get('state')->set('system.maintenance_mode', FALSE);
   }
@@ -269,7 +269,7 @@ public function testThemeIntegration() {
    */
   protected function doTestThemeCallbackAdministrative() {
     $this->drupalGet('menu-test/theme-callback/use-admin-theme');
-    $this->assertText('Active theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme negotiation.');
+    $this->assertSession()->responseContains('Active theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme negotiation.');
     $this->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page.");
   }
 
@@ -288,7 +288,7 @@ protected function doTestThemeCallbackMaintenanceMode() {
     $admin_user = $this->drupalCreateUser(['access site in maintenance mode']);
     $this->drupalLogin($admin_user);
     $this->drupalGet('menu-test/theme-callback/use-admin-theme');
-    $this->assertText('Active theme: seven. Actual theme: seven.', 'The theme negotiation system is correctly triggered for an administrator when the site is in maintenance mode.');
+    $this->assertSession()->responseContains('Active theme: seven. Actual theme: seven.', 'The theme negotiation system is correctly triggered for an administrator when the site is in maintenance mode.');
     $this->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page.");
 
     $this->container->get('state')->set('system.maintenance_mode', FALSE);
@@ -300,7 +300,7 @@ protected function doTestThemeCallbackMaintenanceMode() {
   protected function doTestThemeCallbackOptionalTheme() {
     // Request a theme that is not installed.
     $this->drupalGet('menu-test/theme-callback/use-test-theme');
-    $this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that is not installed is requested.');
+    $this->assertSession()->responseContains('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that is not installed is requested.');
     $this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
 
     // Now install the theme and request it again.
@@ -309,7 +309,7 @@ protected function doTestThemeCallbackOptionalTheme() {
     $theme_installer->install(['test_theme']);
 
     $this->drupalGet('menu-test/theme-callback/use-test-theme');
-    $this->assertText('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.');
+    $this->assertSession()->responseContains('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.');
     $this->assertRaw('test_theme/kitten.css', "The optional theme's CSS appears on the page.");
 
     $theme_installer->uninstall(['test_theme']);
@@ -320,7 +320,7 @@ protected function doTestThemeCallbackOptionalTheme() {
    */
   protected function doTestThemeCallbackFakeTheme() {
     $this->drupalGet('menu-test/theme-callback/use-fake-theme');
-    $this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that does not exist is requested.');
+    $this->assertSession()->responseContains('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that does not exist is requested.');
     $this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
   }
 
@@ -329,7 +329,7 @@ protected function doTestThemeCallbackFakeTheme() {
    */
   protected function doTestThemeCallbackNoThemeRequested() {
     $this->drupalGet('menu-test/theme-callback/no-theme-requested');
-    $this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when no theme is requested.');
+    $this->assertSession()->responseContains('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when no theme is requested.');
     $this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
   }
 
diff --git a/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php b/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php
index cb855e34a9..93779c7611 100644
--- a/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php
+++ b/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php
@@ -41,7 +41,7 @@ public function testClassLoading() {
     for ($i = 0; $i < 2; $i++) {
       $this->drupalGet('module-test/class-loading');
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertText($this->expected, 'Autoloader loads classes from an enabled module.');
+      $this->assertSession()->responseContains($this->expected, 'Autoloader loads classes from an enabled module.');
     }
   }
 
@@ -58,7 +58,7 @@ public function testClassLoadingNotInstalledModules() {
     for ($i = 0; $i < 2; $i++) {
       $this->drupalGet('module-test/class-loading');
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
+      $this->assertSession()->responseNotContains($this->expected, 'Autoloader does not load classes from a disabled module.');
     }
   }
 
@@ -78,7 +78,7 @@ public function testClassLoadingDisabledModules() {
     for ($i = 0; $i < 2; $i++) {
       $this->drupalGet('module-test/class-loading');
       $this->assertSession()->statusCodeEquals(200);
-      $this->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
+      $this->assertSession()->responseNotContains($this->expected, 'Autoloader does not load classes from a disabled module.');
     }
   }
 
diff --git a/core/modules/system/tests/src/Functional/Module/DependencyTest.php b/core/modules/system/tests/src/Functional/Module/DependencyTest.php
index b8022c8b88..04bb76da99 100644
--- a/core/modules/system/tests/src/Functional/Module/DependencyTest.php
+++ b/core/modules/system/tests/src/Functional/Module/DependencyTest.php
@@ -40,7 +40,7 @@ public function testEnableWithoutDependency() {
     $edit = [];
     $edit['modules[content_translation][enable]'] = 'content_translation';
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
-    $this->assertText(t('Some required modules must be enabled'), 'Dependency required.');
+    $this->assertSession()->responseContains(t('Some required modules must be enabled'), 'Dependency required.');
 
     $this->assertModules(['content_translation', 'language'], FALSE);
 
@@ -48,7 +48,7 @@ public function testEnableWithoutDependency() {
     $this->assertTableCount('language', FALSE);
 
     $this->drupalPostForm(NULL, NULL, t('Continue'));
-    $this->assertText(t('2 modules have been enabled: Content Translation, Language.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('2 modules have been enabled: Content Translation, Language.'), 'Modules status has been updated.');
     $this->assertModules(['content_translation', 'language'], TRUE);
 
     // Assert that the language YAML files were created.
@@ -145,7 +145,7 @@ public function testEnableRequirementsFailureDependency() {
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
 
     // Makes sure the modules were NOT installed.
-    $this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
     $this->assertModules(['requirements1_test'], FALSE);
     $this->assertModules(['requirements2_test'], FALSE);
 
@@ -177,7 +177,7 @@ public function testModuleEnableOrder() {
     $this->assertModules(['color'], FALSE);
     // Note that dependencies are sorted alphabetically in the confirmation
     // message.
-    $this->assertText(t('You must enable the Configuration Manager, Help modules to install Color.'));
+    $this->assertSession()->responseContains(t('You must enable the Configuration Manager, Help modules to install Color.'));
 
     $edit['modules[config][enable]'] = 'config';
     $edit['modules[help][enable]'] = 'help';
@@ -218,13 +218,13 @@ public function testUninstallDependents() {
     $edit = ['uninstall[forum]' => 'forum'];
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
 
     // Uninstall comment module.
     $edit = ['uninstall[comment]' => 'comment'];
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php b/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php
index da8e0b4416..a9f0abbca7 100644
--- a/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php
+++ b/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php
@@ -43,8 +43,8 @@ public function testExperimentalConfirmForm() {
     $edit = [];
     $edit["modules[test_page_test][enable]"] = TRUE;
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
-    $this->assertText('Module Test page has been enabled.');
-    $this->assertNoText('Experimental modules are provided for testing purposes only.');
+    $this->assertSession()->responseContains('Module Test page has been enabled.');
+    $this->assertSession()->responseNotContains('Experimental modules are provided for testing purposes only.');
 
     // Uninstall the module.
     \Drupal::service('module_installer')->uninstall(['test_page_test']);
@@ -58,16 +58,16 @@ public function testExperimentalConfirmForm() {
 
     // The module should not be enabled and there should be a warning and a
     // list of the experimental modules with only this one.
-    $this->assertNoText('Experimental Test has been enabled.');
-    $this->assertText('Experimental modules are provided for testing purposes only.');
-    $this->assertText('The following modules are experimental: Experimental Test');
+    $this->assertSession()->responseNotContains('Experimental Test has been enabled.');
+    $this->assertSession()->responseContains('Experimental modules are provided for testing purposes only.');
+    $this->assertSession()->responseContains('The following modules are experimental: Experimental Test');
 
     // There should be no message about enabling dependencies.
-    $this->assertNoText('You must enable');
+    $this->assertSession()->responseNotContains('You must enable');
 
     // Enable the module and confirm that it worked.
     $this->drupalPostForm(NULL, [], 'Continue');
-    $this->assertText('Experimental Test has been enabled.');
+    $this->assertSession()->responseContains('Experimental Test has been enabled.');
 
     // Uninstall the module.
     \Drupal::service('module_installer')->uninstall(['experimental_module_test']);
@@ -80,21 +80,21 @@ public function testExperimentalConfirmForm() {
 
     // The module should not be enabled and there should be a warning and a
     // list of the experimental modules with only this one.
-    $this->assertNoText('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
-    $this->assertText('Experimental modules are provided for testing purposes only.');
+    $this->assertSession()->responseNotContains('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
+    $this->assertSession()->responseContains('Experimental modules are provided for testing purposes only.');
 
-    $this->assertText('The following modules are experimental: Experimental Test');
+    $this->assertSession()->responseContains('The following modules are experimental: Experimental Test');
 
     // Ensure the non-experimental module is not listed as experimental.
-    $this->assertNoText('The following modules are experimental: Experimental Test, Experimental Dependency Test');
-    $this->assertNoText('The following modules are experimental: Experimental Dependency Test');
+    $this->assertSession()->responseNotContains('The following modules are experimental: Experimental Test, Experimental Dependency Test');
+    $this->assertSession()->responseNotContains('The following modules are experimental: Experimental Dependency Test');
 
     // There should be a message about enabling dependencies.
-    $this->assertText('You must enable the Experimental Test module to install Experimental Dependency Test');
+    $this->assertSession()->responseContains('You must enable the Experimental Test module to install Experimental Dependency Test');
 
     // Enable the module and confirm that it worked.
     $this->drupalPostForm(NULL, [], 'Continue');
-    $this->assertText('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
+    $this->assertSession()->responseContains('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
 
     // Uninstall the modules.
     \Drupal::service('module_installer')->uninstall(['experimental_module_test', 'experimental_module_dependency_test']);
@@ -109,21 +109,21 @@ public function testExperimentalConfirmForm() {
 
     // The module should not be enabled and there should be a warning and a
     // list of the experimental modules with only this one.
-    $this->assertNoText('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
-    $this->assertText('Experimental modules are provided for testing purposes only.');
+    $this->assertSession()->responseNotContains('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
+    $this->assertSession()->responseContains('Experimental modules are provided for testing purposes only.');
 
-    $this->assertText('The following modules are experimental: Experimental Test');
+    $this->assertSession()->responseContains('The following modules are experimental: Experimental Test');
 
     // Ensure the non-experimental module is not listed as experimental.
-    $this->assertNoText('The following modules are experimental: Experimental Dependency Test, Experimental Test');
-    $this->assertNoText('The following modules are experimental: Experimental Dependency Test');
+    $this->assertSession()->responseNotContains('The following modules are experimental: Experimental Dependency Test, Experimental Test');
+    $this->assertSession()->responseNotContains('The following modules are experimental: Experimental Dependency Test');
 
     // There should be no message about enabling dependencies.
-    $this->assertNoText('You must enable');
+    $this->assertSession()->responseNotContains('You must enable');
 
     // Enable the module and confirm that it worked.
     $this->drupalPostForm(NULL, [], 'Continue');
-    $this->assertText('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
+    $this->assertSession()->responseContains('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
 
     // Try to enable an experimental module that can not be due to
     // hook_requirements().
@@ -132,7 +132,7 @@ public function testExperimentalConfirmForm() {
     $edit["modules[experimental_module_requirements_test][enable]"] = TRUE;
     $this->drupalPostForm('admin/modules', $edit, 'Install');
     $this->assertUrl('admin/modules', [], 'If the module can not be installed we are not taken to the confirm form.');
-    $this->assertText('The Experimental Test Requirements module can not be installed.');
+    $this->assertSession()->responseContains('The Experimental Test Requirements module can not be installed.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php b/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php
index 317634b4d2..4a6f34d635 100644
--- a/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php
+++ b/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php
@@ -26,7 +26,7 @@ public function testHookRequirementsFailure() {
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
 
     // Makes sure the module was NOT installed.
-    $this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
     $this->assertModules(['requirements1_test'], FALSE);
   }
 
diff --git a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
index f2279f26aa..5ba79887f2 100644
--- a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
@@ -74,8 +74,8 @@ public function testInstallUninstall() {
     $edit = [];
     $edit["modules[help][enable]"] = TRUE;
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
-    $this->assertText('has been enabled', 'Modules status has been updated.');
-    $this->assertText(t('hook_modules_installed fired for help'));
+    $this->assertSession()->responseContains('has been enabled', 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('hook_modules_installed fired for help'));
     $this->assertModuleSuccessfullyInstalled('help');
 
     // Test help for the required modules.
@@ -110,12 +110,12 @@ public function testInstallUninstall() {
 
       // Handle experimental modules, which require a confirmation screen.
       if ($package == 'Core (Experimental)') {
-        $this->assertText('Are you sure you wish to enable experimental modules?');
+        $this->assertSession()->responseContains('Are you sure you wish to enable experimental modules?');
         if (count($modules_to_install) > 1) {
           // When there are experimental modules, needed dependencies do not
           // result in the same page title, but there will be expected text
           // indicating they need to be enabled.
-          $this->assertText('You must enable');
+          $this->assertSession()->responseContains('You must enable');
         }
         $this->drupalPostForm(NULL, [], t('Continue'));
       }
@@ -124,8 +124,8 @@ public function testInstallUninstall() {
       elseif (count($modules_to_install) > 1) {
         // Verify that we are on the correct form and that the expected text
         // about enabling dependencies appears.
-        $this->assertText('Some required modules must be enabled');
-        $this->assertText('You must enable');
+        $this->assertSession()->responseContains('Some required modules must be enabled');
+        $this->assertSession()->responseContains('You must enable');
         $this->drupalPostForm(NULL, [], t('Continue'));
       }
 
@@ -138,13 +138,13 @@ public function testInstallUninstall() {
         '@name' => $module_names[0],
         '@names' => implode(', ', $module_names),
       ]);
-      $this->assertText($expected_text, 'Modules status has been updated.');
+      $this->assertSession()->responseContains($expected_text, 'Modules status has been updated.');
 
       // Check that hook_modules_installed() was invoked with the expected list
       // of modules, that each module's database tables now exist, and that
       // appropriate messages appear in the logs.
       foreach ($modules_to_install as $module_to_install) {
-        $this->assertText(t('hook_modules_installed fired for @module', ['@module' => $module_to_install]));
+        $this->assertSession()->responseContains(t('hook_modules_installed fired for @module', ['@module' => $module_to_install]));
         $this->assertLogMessage('system', "%module module installed.", ['%module' => $module_to_install], RfcLogLevel::INFO);
         $this->assertInstallModuleUpdates($module_to_install);
         $this->assertModuleSuccessfullyInstalled($module_to_install);
@@ -219,13 +219,13 @@ public function testInstallUninstall() {
 
     // If there are experimental modules, click the confirm form.
     if ($experimental) {
-      $this->assertText('Are you sure you wish to enable experimental modules?');
+      $this->assertSession()->responseContains('Are you sure you wish to enable experimental modules?');
       $this->drupalPostForm(NULL, [], t('Continue'));
     }
     // The string tested here is translatable but we are only using a part of it
     // so using a translated string is wrong. Doing so would create a new string
     // to translate.
-    $this->assertText(new FormattableMarkup('@count modules have been enabled: ', ['@count' => count($all_modules)]), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(new FormattableMarkup('@count modules have been enabled: ', ['@count' => count($all_modules)]), 'Modules status has been updated.');
   }
 
   /**
@@ -265,14 +265,14 @@ protected function assertSuccessfulUninstall($module, $package = 'Core') {
     $edit['uninstall[' . $module . ']'] = TRUE;
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
     $this->assertModules([$module], FALSE);
 
     // Check that the appropriate hook was fired and the appropriate log
     // message appears. (But don't check for the log message if the dblog
     // module was just uninstalled, since the {watchdog} table won't be there
     // anymore.)
-    $this->assertText(t('hook_modules_uninstalled fired for @module', ['@module' => $module]));
+    $this->assertSession()->responseContains(t('hook_modules_uninstalled fired for @module', ['@module' => $module]));
     $this->assertLogMessage('system', "%module module uninstalled.", ['%module' => $module], RfcLogLevel::INFO);
 
     // Check that the module's database tables no longer exist.
@@ -355,7 +355,7 @@ protected function assertUninstallModuleUpdates($module) {
   protected function assertHelp($module, $name) {
     $this->drupalGet('admin/help/' . $module);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($name . ' module', "'$name module' is on the help page for $module");
+    $this->assertSession()->responseContains($name . ' module', "'$name module' is on the help page for $module");
     $this->assertLink('online documentation for the ' . $name . ' module', 0, "Correct online documentation link is in the help page for $module");
   }
 
diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
index 19fa712c05..e64beba563 100644
--- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
@@ -72,84 +72,84 @@ public function setUp(): void {
   public function testUninstall() {
     // Check that Taxonomy cannot be uninstalled yet.
     $this->drupalGet('admin/modules/uninstall');
-    $this->assertText('Remove content items');
+    $this->assertSession()->responseContains('Remove content items');
     $this->assertLinkByHref('admin/modules/uninstall/entity/taxonomy_term');
 
     // Delete Taxonomy term data.
     $this->drupalGet('admin/modules/uninstall/entity/taxonomy_term');
     $term_count = count($this->terms);
     for ($i = 1; $i < 11; $i++) {
-      $this->assertText($this->terms[$term_count - $i]->label());
+      $this->assertSession()->responseContains($this->terms[$term_count - $i]->label());
     }
     $term_count = $term_count - 10;
-    $this->assertText("And $term_count more taxonomy terms.");
-    $this->assertText('This action cannot be undone.');
-    $this->assertText('Make a backup of your database if you want to be able to restore these items.');
+    $this->assertSession()->responseContains("And $term_count more taxonomy terms.");
+    $this->assertSession()->responseContains('This action cannot be undone.');
+    $this->assertSession()->responseContains('Make a backup of your database if you want to be able to restore these items.');
     $this->drupalPostForm(NULL, [], t('Delete all taxonomy terms'));
 
     // Check that we are redirected to the uninstall page and data has been
     // removed.
     $this->assertUrl('admin/modules/uninstall', []);
-    $this->assertText('All taxonomy terms have been deleted.');
+    $this->assertSession()->responseContains('All taxonomy terms have been deleted.');
 
     // Check that there is no more data to be deleted, Taxonomy is ready to be
     // uninstalled.
-    $this->assertText('Enables the categorization of content.');
+    $this->assertSession()->responseContains('Enables the categorization of content.');
     $this->assertNoLinkByHref('admin/modules/uninstall/entity/taxonomy_term');
 
     // Uninstall the Taxonomy module.
     $this->drupalPostForm('admin/modules/uninstall', ['uninstall[taxonomy]' => TRUE], t('Uninstall'));
     $this->drupalPostForm(NULL, [], t('Uninstall'));
-    $this->assertText('The selected modules have been uninstalled.');
-    $this->assertNoText('Enables the categorization of content.');
+    $this->assertSession()->responseContains('The selected modules have been uninstalled.');
+    $this->assertSession()->responseNotContains('Enables the categorization of content.');
 
     // Check Node cannot be uninstalled yet, there is content to be removed.
     $this->drupalGet('admin/modules/uninstall');
-    $this->assertText('Remove content items');
+    $this->assertSession()->responseContains('Remove content items');
     $this->assertLinkByHref('admin/modules/uninstall/entity/node');
 
     // Delete Node data.
     $this->drupalGet('admin/modules/uninstall/entity/node');
     // All 10 nodes should be listed.
     foreach ($this->nodes as $node) {
-      $this->assertText($node->label());
+      $this->assertSession()->responseContains($node->label());
     }
 
     // Ensures there is no more count when not necessary.
-    $this->assertNoText('And 0 more content');
-    $this->assertText('This action cannot be undone.');
-    $this->assertText('Make a backup of your database if you want to be able to restore these items.');
+    $this->assertSession()->responseNotContains('And 0 more content');
+    $this->assertSession()->responseContains('This action cannot be undone.');
+    $this->assertSession()->responseContains('Make a backup of your database if you want to be able to restore these items.');
 
     // Create another node so we have 11.
     $this->nodes[] = $this->drupalCreateNode(['type' => 'page']);
     $this->drupalGet('admin/modules/uninstall/entity/node');
     // Ensures singular case is used when a single entity is left after listing
     // the first 10's labels.
-    $this->assertText('And 1 more content item.');
+    $this->assertSession()->responseContains('And 1 more content item.');
 
     // Create another node so we have 12.
     $this->nodes[] = $this->drupalCreateNode(['type' => 'article']);
     $this->drupalGet('admin/modules/uninstall/entity/node');
     // Ensures singular case is used when a single entity is left after listing
     // the first 10's labels.
-    $this->assertText('And 2 more content items.');
+    $this->assertSession()->responseContains('And 2 more content items.');
 
     $this->drupalPostForm(NULL, [], t('Delete all content items'));
 
     // Check we are redirected to the uninstall page and data has been removed.
     $this->assertUrl('admin/modules/uninstall', []);
-    $this->assertText('All content items have been deleted.');
+    $this->assertSession()->responseContains('All content items have been deleted.');
 
     // Check there is no more data to be deleted, Node is ready to be
     // uninstalled.
-    $this->assertText('Allows content to be submitted to the site and displayed on pages.');
+    $this->assertSession()->responseContains('Allows content to be submitted to the site and displayed on pages.');
     $this->assertNoLinkByHref('admin/modules/uninstall/entity/node');
 
     // Uninstall Node module.
     $this->drupalPostForm('admin/modules/uninstall', ['uninstall[node]' => TRUE], t('Uninstall'));
     $this->drupalPostForm(NULL, [], t('Uninstall'));
-    $this->assertText('The selected modules have been uninstalled.');
-    $this->assertNoText('Allows content to be submitted to the site and displayed on pages.');
+    $this->assertSession()->responseContains('The selected modules have been uninstalled.');
+    $this->assertSession()->responseNotContains('Allows content to be submitted to the site and displayed on pages.');
 
     // Ensure a 404 is returned when accessing a non-existent entity type.
     $this->drupalGet('admin/modules/uninstall/entity/node');
@@ -157,7 +157,7 @@ public function testUninstall() {
 
     // Test an entity type which does not have any existing entities.
     $this->drupalGet('admin/modules/uninstall/entity/entity_test_no_label');
-    $this->assertText('There are 0 entity test without label entities to delete.');
+    $this->assertSession()->responseContains('There are 0 entity test without label entities to delete.');
     $button_xpath = '//input[@type="submit"][@value="Delete all entity test without label entities"]';
     $this->assertNoFieldByXPath($button_xpath, NULL, 'Button with value "Delete all entity test without label entities" not found');
 
@@ -170,14 +170,14 @@ public function testUninstall() {
       'name' => $this->randomMachineName(),
     ])->save();
     $this->drupalGet('admin/modules/uninstall/entity/entity_test_no_label');
-    $this->assertText('This will delete 1 entity test without label.');
+    $this->assertSession()->responseContains('This will delete 1 entity test without label.');
     $this->assertFieldByXPath($button_xpath, NULL, 'Button with value "Delete all entity test without label entities" found');
     $storage->create([
       'id' => mb_strtolower($this->randomMachineName()),
       'name' => $this->randomMachineName(),
     ])->save();
     $this->drupalGet('admin/modules/uninstall/entity/entity_test_no_label');
-    $this->assertText('This will delete 2 entity test without label entities.');
+    $this->assertSession()->responseContains('This will delete 2 entity test without label entities.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/core/modules/system/tests/src/Functional/Module/UninstallTest.php
index f789c56ddf..89d93c78e5 100644
--- a/core/modules/system/tests/src/Functional/Module/UninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/UninstallTest.php
@@ -77,8 +77,8 @@ public function testUninstallPage() {
     // @see regression https://www.drupal.org/node/2512106
     $this->assertRaw('<label for="edit-uninstall-node" class="module-name table-filter-text-source">Node</label>');
 
-    $this->assertText(\Drupal::translation()->translate('The following reason prevents Node from being uninstalled:'));
-    $this->assertText(\Drupal::translation()->translate('There is content for the entity type: Content'));
+    $this->assertSession()->responseContains(\Drupal::translation()->translate('The following reason prevents Node from being uninstalled:'));
+    $this->assertSession()->responseContains(\Drupal::translation()->translate('There is content for the entity type: Content'));
     // Delete the node to allow node to be uninstalled.
     $node->delete();
 
@@ -86,11 +86,11 @@ public function testUninstallPage() {
     $edit = [];
     $edit['uninstall[module_test]'] = TRUE;
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
-    $this->assertNoText(\Drupal::translation()->translate('Configuration deletions'), 'No configuration deletions listed on the module install confirmation page.');
-    $this->assertText(\Drupal::translation()->translate('Configuration updates'), 'Configuration updates listed on the module install confirmation page.');
-    $this->assertText($node_type->label());
+    $this->assertSession()->responseNotContains(\Drupal::translation()->translate('Configuration deletions'), 'No configuration deletions listed on the module install confirmation page.');
+    $this->assertSession()->responseContains(\Drupal::translation()->translate('Configuration updates'), 'Configuration updates listed on the module install confirmation page.');
+    $this->assertSession()->responseContains($node_type->label());
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
 
     // Uninstall node testing that the configuration that will be deleted is
     // listed.
@@ -98,13 +98,13 @@ public function testUninstallPage() {
     $edit = [];
     $edit['uninstall[node]'] = TRUE;
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
-    $this->assertText(\Drupal::translation()->translate('Configuration deletions'), 'Configuration deletions listed on the module install confirmation page.');
-    $this->assertNoText(\Drupal::translation()->translate('Configuration updates'), 'No configuration updates listed on the module install confirmation page.');
+    $this->assertSession()->responseContains(\Drupal::translation()->translate('Configuration deletions'), 'Configuration deletions listed on the module install confirmation page.');
+    $this->assertSession()->responseNotContains(\Drupal::translation()->translate('Configuration updates'), 'No configuration updates listed on the module install confirmation page.');
 
     $entity_types = [];
     foreach ($node_dependencies as $entity) {
       $label = $entity->label() ?: $entity->id();
-      $this->assertText($label);
+      $this->assertSession()->responseContains($label);
       $entity_types[] = $entity->getEntityTypeId();
     }
     $entity_types = array_unique($entity_types);
@@ -122,7 +122,7 @@ public function testUninstallPage() {
     $this->assertEqual($cached->data, 'test_uninstall_page', new FormattableMarkup('Cache entry found: @bin', ['@bin' => $cached->data]));
 
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
     $this->assertNoRaw('&lt;label', 'The page does not have double escaped HTML tags.');
 
     // Make sure our unique cache entry is gone.
@@ -131,7 +131,7 @@ public function testUninstallPage() {
     // Make sure we get an error message when we try to confirm uninstallation
     // of an empty list of modules.
     $this->drupalGet('admin/modules/uninstall/confirm');
-    $this->assertText(t('The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.'), 'Module uninstall confirmation form displays error message');
+    $this->assertSession()->responseContains(t('The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.'), 'Module uninstall confirmation form displays error message');
 
     // Make sure confirmation page is accessible only during uninstall process.
     $this->drupalGet('admin/modules/uninstall/confirm');
@@ -141,7 +141,7 @@ public function testUninstallPage() {
     // Make sure the correct error is shown when no modules are selected.
     $edit = [];
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
-    $this->assertText(t('No modules selected.'), 'No module is selected to uninstall');
+    $this->assertSession()->responseContains(t('No modules selected.'), 'No module is selected to uninstall');
   }
 
   /**
@@ -163,12 +163,12 @@ public function testFailedInstallStatus() {
     // Even though the module failed to install properly, its configuration
     // status is "enabled" and should still be available to uninstall.
     $this->drupalGet('admin/modules/uninstall');
-    $this->assertText('Module installer config test');
+    $this->assertSession()->responseContains('Module installer config test');
     $edit['uninstall[module_installer_config_test]'] = TRUE;
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'));
-    $this->assertNoText('Module installer config test');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'));
+    $this->assertSession()->responseNotContains('Module installer config test');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Pager/PagerTest.php b/core/modules/system/tests/src/Functional/Pager/PagerTest.php
index 4a6d7d448c..c7c0f5bb01 100644
--- a/core/modules/system/tests/src/Functional/Pager/PagerTest.php
+++ b/core/modules/system/tests/src/Functional/Pager/PagerTest.php
@@ -84,15 +84,15 @@ public function testActiveClass() {
   public function testPagerQueryParametersAndCacheContext() {
     // First page.
     $this->drupalGet('pager-test/query-parameters');
-    $this->assertText(t('Pager calls: 0'), 'Initial call to pager shows 0 calls.');
-    $this->assertText('[url.query_args.pagers:0]=0.0');
+    $this->assertSession()->responseContains(t('Pager calls: 0'), 'Initial call to pager shows 0 calls.');
+    $this->assertSession()->responseContains('[url.query_args.pagers:0]=0.0');
     $this->assertCacheContext('url.query_args');
 
     // Go to last page, the count of pager calls need to go to 1.
     $elements = $this->xpath('//li[contains(@class, :class)]/a', [':class' => 'pager__item--last']);
     $elements[0]->click();
-    $this->assertText(t('Pager calls: 1'), 'First link call to pager shows 1 calls.');
-    $this->assertText('[url.query_args.pagers:0]=0.60');
+    $this->assertSession()->responseContains(t('Pager calls: 1'), 'First link call to pager shows 1 calls.');
+    $this->assertSession()->responseContains('[url.query_args.pagers:0]=0.60');
     $this->assertCacheContext('url.query_args');
 
     // Reset counter to 0.
@@ -102,8 +102,8 @@ public function testPagerQueryParametersAndCacheContext() {
     $elements[0]->click();
     $elements = $this->xpath('//li[contains(@class, :class)]/a', [':class' => 'pager__item--first']);
     $elements[0]->click();
-    $this->assertText(t('Pager calls: 2'), 'Second link call to pager shows 2 calls.');
-    $this->assertText('[url.query_args.pagers:0]=0.0');
+    $this->assertSession()->responseContains(t('Pager calls: 2'), 'Second link call to pager shows 2 calls.');
+    $this->assertSession()->responseContains('[url.query_args.pagers:0]=0.0');
     $this->assertCacheContext('url.query_args');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php b/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php
index fe7c1d50c6..28813d674a 100644
--- a/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php
+++ b/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php
@@ -79,7 +79,7 @@ public function testRenderCachedBlock() {
     // Get the front page, which should now have our visible block.
     $this->drupalGet('');
     // Make sure our block is visible.
-    $this->assertText('Markup from attached_rendering_block.');
+    $this->assertSession()->responseContains('Markup from attached_rendering_block.');
     // Test that all our attached items are present.
     $this->assertFeed();
     $this->assertHead();
@@ -89,7 +89,7 @@ public function testRenderCachedBlock() {
     // Reload the page, to test caching.
     $this->drupalGet('');
     // Make sure our block is visible.
-    $this->assertText('Markup from attached_rendering_block.');
+    $this->assertSession()->responseContains('Markup from attached_rendering_block.');
     // The header should be present again.
     $this->assertSession()->responseHeaderEquals('X-Test-Teapot', 'Teapot Mode Active');
   }
diff --git a/core/modules/system/tests/src/Functional/Routing/RouterTest.php b/core/modules/system/tests/src/Functional/Routing/RouterTest.php
index b97ab7787f..7b427def29 100644
--- a/core/modules/system/tests/src/Functional/Routing/RouterTest.php
+++ b/core/modules/system/tests/src/Functional/Routing/RouterTest.php
@@ -237,12 +237,12 @@ public function testUrlGeneratorFront() {
   public function testRouterMatching() {
     $this->drupalGet('router_test/test14/1');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('User route "entity.user.canonical" was matched.');
+    $this->assertSession()->responseContains('User route "entity.user.canonical" was matched.');
 
     // Try to match a route for a non-existent user.
     $this->drupalGet('router_test/test14/2');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Route not matched.');
+    $this->assertSession()->responseContains('Route not matched.');
 
     // Check that very long paths don't cause an error.
     $path = 'router_test/test1';
@@ -260,7 +260,7 @@ public function testRouterMatching() {
   public function testRouterResponsePsr7() {
     $this->drupalGet('/router_test/test23');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('test23');
+    $this->assertSession()->responseContains('test23');
   }
 
   /**
@@ -273,11 +273,11 @@ public function testUserAccount() {
     $second_account = $this->drupalCreateUser();
 
     $this->drupalGet('router_test/test12/' . $second_account->id());
-    $this->assertText($account->getAccountName() . ':' . $second_account->getAccountName());
+    $this->assertSession()->responseContains($account->getAccountName() . ':' . $second_account->getAccountName());
     $this->assertEqual($account->id(), $this->loggedInUser->id(), 'Ensure that the user was not changed.');
 
     $this->drupalGet('router_test/test13/' . $second_account->id());
-    $this->assertText($account->getAccountName() . ':' . $second_account->getAccountName());
+    $this->assertSession()->responseContains($account->getAccountName() . ':' . $second_account->getAccountName());
     $this->assertEqual($account->id(), $this->loggedInUser->id(), 'Ensure that the user was not changed.');
   }
 
diff --git a/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php b/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php
index 305beb5923..1133a95dd5 100644
--- a/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php
+++ b/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php
@@ -36,7 +36,7 @@ public function testServiceProviderRegistrationIntegration() {
     // saying it has fired. This will fire on every page request so it should
     // show up on the front page.
     $this->drupalGet('');
-    $this->assertText(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired');
+    $this->assertSession()->responseContains(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
index c235e4ca43..3675064b64 100644
--- a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
+++ b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php
@@ -87,12 +87,12 @@ public function testHttpsSession() {
 
     // Verify that user is logged in on secure URL.
     $this->drupalGet($this->httpsUrl('admin/config'));
-    $this->assertText(t('Configuration'));
+    $this->assertSession()->responseContains(t('Configuration'));
     $this->assertSession()->statusCodeEquals(200);
 
     // Verify that user is not logged in on non-secure URL.
     $this->drupalGet($this->httpUrl('admin/config'));
-    $this->assertNoText(t('Configuration'));
+    $this->assertSession()->responseNotContains(t('Configuration'));
     $this->assertSession()->statusCodeEquals(403);
 
     // Verify that empty SID cannot be used on the non-secure site.
diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php
index 8388ad5a91..2e7618634f 100644
--- a/core/modules/system/tests/src/Functional/Session/SessionTest.php
+++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php
@@ -71,7 +71,7 @@ public function testSessionSaveRegenerate() {
     ];
     $this->drupalPostForm('user/login', $edit, t('Log in'));
     $this->drupalGet('user');
-    $pass = $this->assertText($user->getAccountName(), new FormattableMarkup('Found name: %name', ['%name' => $user->getAccountName()]), 'User login');
+    $pass = $this->assertSession()->responseContains($user->getAccountName(), new FormattableMarkup('Found name: %name', ['%name' => $user->getAccountName()]), 'User login');
     $this->_logged_in = $pass;
 
     $this->drupalGet('session-test/id');
@@ -93,18 +93,18 @@ public function testDataPersistence() {
 
     $value_1 = $this->randomMachineName();
     $this->drupalGet('session-test/set/' . $value_1);
-    $this->assertText($value_1, 'The session value was stored.', 'Session');
+    $this->assertSession()->responseContains($value_1, 'The session value was stored.', 'Session');
     $this->drupalGet('session-test/get');
-    $this->assertText($value_1, 'Session correctly returned the stored data for an authenticated user.', 'Session');
+    $this->assertSession()->responseContains($value_1, 'Session correctly returned the stored data for an authenticated user.', 'Session');
 
     // Attempt to write over val_1. If drupal_save_session(FALSE) is working.
     // properly, val_1 will still be set.
     $value_2 = $this->randomMachineName();
     $this->drupalGet('session-test/no-set/' . $value_2);
     $session = $this->getSession();
-    $this->assertText($value_2, 'The session value was correctly passed to session-test/no-set.', 'Session');
+    $this->assertSession()->responseContains($value_2, 'The session value was correctly passed to session-test/no-set.', 'Session');
     $this->drupalGet('session-test/get');
-    $this->assertText($value_1, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
+    $this->assertSession()->responseContains($value_1, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
 
     // Switch browser cookie to anonymous user, then back to user 1.
     $session_cookie_name = $this->getSessionName();
@@ -115,34 +115,34 @@ public function testDataPersistence() {
     // add the old session cookie again.
     $session->setCookie($session_cookie_name, $session_cookie_value);
     $this->drupalGet('session-test/get');
-    $this->assertText($value_1, 'Session data persists through browser close.', 'Session');
+    $this->assertSession()->responseContains($value_1, 'Session data persists through browser close.', 'Session');
     $this->mink->setDefaultSessionName('default');
 
     // Logout the user and make sure the stored value no longer persists.
     $this->drupalLogout();
     $this->sessionReset();
     $this->drupalGet('session-test/get');
-    $this->assertNoText($value_1, "After logout, previous user's session data is not available.", 'Session');
+    $this->assertSession()->responseNotContains($value_1, "After logout, previous user's session data is not available.", 'Session');
 
     // Now try to store some data as an anonymous user.
     $value_3 = $this->randomMachineName();
     $this->drupalGet('session-test/set/' . $value_3);
-    $this->assertText($value_3, 'Session data stored for anonymous user.', 'Session');
+    $this->assertSession()->responseContains($value_3, 'Session data stored for anonymous user.', 'Session');
     $this->drupalGet('session-test/get');
-    $this->assertText($value_3, 'Session correctly returned the stored data for an anonymous user.', 'Session');
+    $this->assertSession()->responseContains($value_3, 'Session correctly returned the stored data for an anonymous user.', 'Session');
 
     // Try to store data when drupal_save_session(FALSE).
     $value_4 = $this->randomMachineName();
     $this->drupalGet('session-test/no-set/' . $value_4);
-    $this->assertText($value_4, 'The session value was correctly passed to session-test/no-set.', 'Session');
+    $this->assertSession()->responseContains($value_4, 'The session value was correctly passed to session-test/no-set.', 'Session');
     $this->drupalGet('session-test/get');
-    $this->assertText($value_3, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
+    $this->assertSession()->responseContains($value_3, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
 
     // Login, the data should persist.
     $this->drupalLogin($user);
     $this->sessionReset($user->id());
     $this->drupalGet('session-test/get');
-    $this->assertNoText($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
+    $this->assertSession()->responseNotContains($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
 
     // Change session and create another user.
     $user2 = $this->drupalCreateUser([]);
@@ -159,7 +159,7 @@ public function testSessionPersistenceOnLogin() {
     $this->drupalLogin($user);
     // Test property added to session object form hook_user_login().
     $this->drupalGet('session-test/get-from-session-object');
-    $this->assertText('foobar', 'Session data is saved in Session() object.', 'Session');
+    $this->assertSession()->responseContains('foobar', 'Session data is saved in Session() object.', 'Session');
   }
 
   /**
@@ -200,7 +200,7 @@ public function testEmptyAnonymousSession() {
     $this->assertSessionCookie(FALSE);
     $this->assertSessionEmpty(FALSE);
     $this->assertNull($this->drupalGetHeader('X-Drupal-Cache'), 'Caching was bypassed.');
-    $this->assertText(t('This is a dummy message.'), 'Message was displayed.');
+    $this->assertSession()->responseContains(t('This is a dummy message.'), 'Message was displayed.');
     $this->assertRegExp('/SESS\w+=deleted/', $this->drupalGetHeader('Set-Cookie'), 'Session cookie was deleted.');
 
     // Verify that session was destroyed.
@@ -208,7 +208,7 @@ public function testEmptyAnonymousSession() {
     $this->assertSessionCookie(FALSE);
     // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages.
     // $this->assertSessionEmpty(TRUE);
-    $this->assertNoText(t('This is a dummy message.'), 'Message was not cached.');
+    $this->assertSession()->responseNotContains(t('This is a dummy message.'), 'Message was not cached.');
     $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
     $this->assertNull($this->drupalGetHeader('Set-Cookie'), 'New session was not started.');
 
@@ -222,7 +222,7 @@ public function testEmptyAnonymousSession() {
     $this->assertSessionCookie(FALSE);
     // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages.
     // $this->assertSessionEmpty(TRUE);
-    $this->assertNoText(t('This is a dummy message.'), 'The message was not saved.');
+    $this->assertSession()->responseNotContains(t('This is a dummy message.'), 'The message was not saved.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php b/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php
index 79146584be..f68127329d 100644
--- a/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php
+++ b/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php
@@ -46,7 +46,7 @@ protected function setUp(): void {
 
   public function testAccessDenied() {
     $this->drupalGet('admin');
-    $this->assertText(t('Access denied'), 'Found the default 403 page');
+    $this->assertSession()->responseContains(t('Access denied'), 'Found the default 403 page');
     $this->assertSession()->statusCodeEquals(403);
 
     // Ensure that users without permission are denied access and have the
@@ -80,8 +80,8 @@ public function testAccessDenied() {
     // Log out and check that the user login block is shown on custom 403 pages.
     $this->drupalLogout();
     $this->drupalGet('admin');
-    $this->assertText($this->adminUser->getAccountName(), 'Found the custom 403 page');
-    $this->assertText(t('Username'), 'Blocks are shown on the custom 403 page');
+    $this->assertSession()->responseContains($this->adminUser->getAccountName(), 'Found the custom 403 page');
+    $this->assertSession()->responseContains(t('Username'), 'Blocks are shown on the custom 403 page');
 
     // Log back in and remove the custom 403 page.
     $this->drupalLogin($this->adminUser);
@@ -93,9 +93,9 @@ public function testAccessDenied() {
     // Logout and check that the user login block is shown on default 403 pages.
     $this->drupalLogout();
     $this->drupalGet('admin');
-    $this->assertText(t('Access denied'), 'Found the default 403 page');
+    $this->assertSession()->responseContains(t('Access denied'), 'Found the default 403 page');
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertText(t('Username'), 'Blocks are shown on the default 403 page');
+    $this->assertSession()->responseContains(t('Username'), 'Blocks are shown on the default 403 page');
 
     // Log back in, set the custom 403 page to /user/login and remove the block
     $this->drupalLogin($this->adminUser);
@@ -111,7 +111,7 @@ public function testAccessDenied() {
     $this->drupalPostForm('admin/config/system/site-information', $edit, t('Log in'));
 
     // Check that we're still on the same page.
-    $this->assertText(t('Basic site settings'));
+    $this->assertSession()->responseContains(t('Basic site settings'));
   }
 
   /**
@@ -122,15 +122,15 @@ public function testAccessDeniedCustomPageWithAccessDenied() {
     $this->config('system.site')->set('page.403', '/system-test/custom-4xx')->save();
 
     $this->drupalGet('/system-test/always-denied');
-    $this->assertNoText('Admin-only 4xx response');
-    $this->assertText('You are not authorized to access this page.');
+    $this->assertSession()->responseNotContains('Admin-only 4xx response');
+    $this->assertSession()->responseContains('You are not authorized to access this page.');
     $this->assertSession()->statusCodeEquals(403);
     // Verify the access cacheability metadata for custom 403 is bubbled.
     $this->assertCacheContext('user.roles');
 
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('/system-test/always-denied');
-    $this->assertText('Admin-only 4xx response');
+    $this->assertSession()->responseContains('Admin-only 4xx response');
     $this->assertSession()->statusCodeEquals(403);
     // Verify the access cacheability metadata for custom 403 is bubbled.
     $this->assertCacheContext('user.roles');
diff --git a/core/modules/system/tests/src/Functional/System/AdminTest.php b/core/modules/system/tests/src/Functional/System/AdminTest.php
index c79fc26d05..9dbe7a219d 100644
--- a/core/modules/system/tests/src/Functional/System/AdminTest.php
+++ b/core/modules/system/tests/src/Functional/System/AdminTest.php
@@ -66,7 +66,7 @@ public function testAdminPages() {
       $this->assertLink($item->getTitle());
       $this->assertLinkByHref($item->getUrlObject()->toString());
       // The description should appear below the link.
-      $this->assertText($item->getDescription());
+      $this->assertSession()->responseContains($item->getDescription());
     }
 
     // For each administrative listing page on which the Locale module appears,
diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php
index c291b0fe84..1468421df0 100644
--- a/core/modules/system/tests/src/Functional/System/CronRunTest.php
+++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php
@@ -82,7 +82,7 @@ public function testAutomatedCron() {
 
     // Disable cron through the interface by setting the interval to zero.
     $this->drupalPostForm('admin/config/system/cron', ['interval' => 0], t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
     $this->drupalLogout();
 
     // Test if cron does not run when the cron interval is set to zero.
@@ -115,13 +115,13 @@ public function testCronUI() {
     // Don't use REQUEST to calculate the exact time, because that will
     // fail randomly. Look for the word 'years', because without a timestamp,
     // the time will start at 1 January 1970.
-    $this->assertNoText('years');
+    $this->assertSession()->responseNotContains('years');
 
     $cron_last = time() - 200;
     \Drupal::state()->set('system.cron_last', $cron_last);
 
     $this->drupalPostForm(NULL, [], 'Save configuration');
-    $this->assertText('The configuration options have been saved.');
+    $this->assertSession()->responseContains('The configuration options have been saved.');
     $this->assertUrl('admin/config/system/cron');
 
     // Check that cron does not run when saving the configuration form.
@@ -145,7 +145,7 @@ public function testManualCron() {
     $this->drupalGet('admin/reports/status');
     $this->clickLink(t('Run cron'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('Cron ran successfully.'));
+    $this->assertSession()->responseContains(t('Cron ran successfully.'));
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php b/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php
index 69fb3c28f3..24e98bae73 100644
--- a/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php
+++ b/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php
@@ -28,8 +28,8 @@ public function testDateLocking() {
     $this->drupalGet('admin/config/regional/date-time');
     $this->assertLinkByHref('admin/config/regional/date-time/formats/manage/short');
     $this->assertNoLinkByHref('admin/config/regional/date-time/formats/manage/html_date');
-    $this->assertText('Fallback date format');
-    $this->assertNoText('short (locked)');
+    $this->assertSession()->responseContains('Fallback date format');
+    $this->assertSession()->responseNotContains('short (locked)');
 
     // Locked date formats are not editable.
     $this->drupalGet('admin/config/regional/date-time/formats/manage/short');
diff --git a/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php b/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php
index c23c728a20..c0dd0badbc 100644
--- a/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php
+++ b/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php
@@ -38,7 +38,7 @@ public function testDateFormatsMachineNameAllowedValues() {
       'date_format_pattern' => 'Y-m-d',
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'), 'It is not possible to create a date format with the machine name that has any character other than lowercase letters, digits or underscore.');
+    $this->assertSession()->responseContains(t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'), 'It is not possible to create a date format with the machine name that has any character other than lowercase letters, digits or underscore.');
 
     // Try to create a date format with the reserved machine name "custom".
     $edit = [
@@ -47,7 +47,7 @@ public function testDateFormatsMachineNameAllowedValues() {
       'date_format_pattern' => 'Y-m-d',
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'), 'It is not possible to create a date format with the machine name "custom".');
+    $this->assertSession()->responseContains(t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'), 'It is not possible to create a date format with the machine name "custom".');
 
     // Try to create a date format with a machine name, "fallback", that
     // already exists.
@@ -57,7 +57,7 @@ public function testDateFormatsMachineNameAllowedValues() {
       'date_format_pattern' => 'j/m/Y',
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a date format with the machine name "fallback". It is a built-in format that already exists.');
+    $this->assertSession()->responseContains(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a date format with the machine name "fallback". It is a built-in format that already exists.');
 
     // Create a date format with a machine name distinct from the previous two.
     $id = mb_strtolower($this->randomMachineName(16));
@@ -67,7 +67,7 @@ public function testDateFormatsMachineNameAllowedValues() {
       'date_format_pattern' => 'd/m/Y',
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('Custom date format added.'), 'It is possible to create a date format with a new machine name.');
+    $this->assertSession()->responseContains(t('Custom date format added.'), 'It is possible to create a date format with a new machine name.');
 
     // Try to create a date format with same machine name as the previous one.
     $edit = [
@@ -76,7 +76,7 @@ public function testDateFormatsMachineNameAllowedValues() {
       'date_format_pattern' => 'd-m-Y',
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertText(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a new date format with an existing machine name.');
+    $this->assertSession()->responseContains(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a new date format with an existing machine name.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/System/DateTimeTest.php b/core/modules/system/tests/src/Functional/System/DateTimeTest.php
index 73df393429..cb754aea4f 100644
--- a/core/modules/system/tests/src/Functional/System/DateTimeTest.php
+++ b/core/modules/system/tests/src/Functional/System/DateTimeTest.php
@@ -71,9 +71,9 @@ public function testTimeZoneHandling() {
 
     // Confirm date format and time zone.
     $this->drupalGet('node/' . $node1->id());
-    $this->assertText('2007-01-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
+    $this->assertSession()->responseContains('2007-01-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
     $this->drupalGet('node/' . $node2->id());
-    $this->assertText('2007-07-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
+    $this->assertSession()->responseContains('2007-07-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
 
     // Set time zone to Los Angeles time.
     $config->set('timezone.default', 'America/Los_Angeles')->save();
@@ -81,9 +81,9 @@ public function testTimeZoneHandling() {
 
     // Confirm date format and time zone.
     $this->drupalGet('node/' . $node1->id());
-    $this->assertText('2007-01-31 23:00:00 -0800', 'Date should be two hours ahead, with GMT offset of -8 hours.');
+    $this->assertSession()->responseContains('2007-01-31 23:00:00 -0800', 'Date should be two hours ahead, with GMT offset of -8 hours.');
     $this->drupalGet('node/' . $node2->id());
-    $this->assertText('2007-08-01 00:00:00 -0700', 'Date should be three hours ahead, with GMT offset of -7 hours.');
+    $this->assertSession()->responseContains('2007-08-01 00:00:00 -0700', 'Date should be three hours ahead, with GMT offset of -7 hours.');
   }
 
   /**
@@ -105,16 +105,16 @@ public function testDateFormatConfiguration() {
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
     $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
-    $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
-    $this->assertText($name, 'Custom date format appears in the date format list.');
-    $this->assertText(t('Delete'), 'Delete link for custom date format appears.');
+    $this->assertSession()->responseContains(t('Custom date format added.'), 'Date format added confirmation message appears.');
+    $this->assertSession()->responseContains($name, 'Custom date format appears in the date format list.');
+    $this->assertSession()->responseContains(t('Delete'), 'Delete link for custom date format appears.');
 
     // Edit the custom date format and re-save without editing the format.
     $this->drupalGet('admin/config/regional/date-time');
     $this->clickLink(t('Edit'));
     $this->drupalPostForm(NULL, NULL, t('Save format'));
     $this->assertUrl('admin/config/regional/date-time', ['absolute' => TRUE], 'Correct page redirection.');
-    $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
+    $this->assertSession()->responseContains(t('Custom date format updated.'), 'Custom date format successfully updated.');
 
     // Edit custom date format.
     $this->drupalGet('admin/config/regional/date-time');
@@ -124,7 +124,7 @@ public function testDateFormatConfiguration() {
     ];
     $this->drupalPostForm($this->getUrl(), $edit, t('Save format'));
     $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
-    $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
+    $this->assertSession()->responseContains(t('Custom date format updated.'), 'Custom date format successfully updated.');
 
     // Delete custom date format.
     $this->clickLink(t('Delete'));
@@ -147,9 +147,9 @@ public function testDateFormatConfiguration() {
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
     $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
-    $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
-    $this->assertText($name, 'Custom date format appears in the date format list.');
-    $this->assertText(t('Delete'), 'Delete link for custom date format appears.');
+    $this->assertSession()->responseContains(t('Custom date format added.'), 'Date format added confirmation message appears.');
+    $this->assertSession()->responseContains($name, 'Custom date format appears in the date format list.');
+    $this->assertSession()->responseContains(t('Delete'), 'Delete link for custom date format appears.');
 
     $date_format = DateFormat::create([
       'id' => 'xss_short',
@@ -172,8 +172,8 @@ public function testDateFormatConfiguration() {
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
     $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
-    $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
-    $this->assertText($name, 'Custom date format appears in the date format list.');
+    $this->assertSession()->responseContains(t('Custom date format added.'), 'Date format added confirmation message appears.');
+    $this->assertSession()->responseContains($name, 'Custom date format appears in the date format list.');
     $this->assertEscaped('<em>' . date("Y") . '</em>');
   }
 
@@ -194,7 +194,7 @@ public function testEnteringDateTimeViaSelectors() {
       'field_name' => 'dt',
     ];
     $this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/add-field', $edit, t('Save and continue'));
-    $this->assertText(t('These settings apply to the'), 'New datetime field created, now configuring');
+    $this->assertSession()->responseContains(t('These settings apply to the'), 'New datetime field created, now configuring');
 
     $this->drupalGet('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage');
     $edit = [
@@ -205,7 +205,7 @@ public function testEnteringDateTimeViaSelectors() {
     $this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage', $edit, t('Save field settings'));
 
     $this->drupalGet('admin/structure/types/manage/page_with_date/fields');
-    $this->assertText('field_dt', 'New field is in place');
+    $this->assertSession()->responseContains('field_dt', 'New field is in place');
 
     $this->drupalGet('admin/structure/types/manage/page_with_date/form-display');
     $edit = [
@@ -228,14 +228,14 @@ public function testEnteringDateTimeViaSelectors() {
       'field_dt[0][value][minute]' => '30',
     ];
     $this->drupalPostForm('node/add/page_with_date', $edit, t('Save'));
-    $this->assertText(t('Selected combination of day and month is not valid.'), 'Inorrect date failed validation');
+    $this->assertSession()->responseContains(t('Selected combination of day and month is not valid.'), 'Inorrect date failed validation');
 
     $edit['field_dt[0][value][day]'] = '29';
     $this->drupalPostForm('node/add/page_with_date', $edit, t('Save'));
-    $this->assertNoText(t('Selected combination of day and month is not valid.'), 'Correct date passed validation.');
+    $this->assertSession()->responseNotContains(t('Selected combination of day and month is not valid.'), 'Correct date passed validation.');
 
     $this->drupalGet('node/1');
-    $this->assertText(t('Mon, 02/29/2016 - 01:30'), 'Node successfully created with valid date.');
+    $this->assertSession()->responseContains(t('Mon, 02/29/2016 - 01:30'), 'Node successfully created with valid date.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php
index a5b9496ad1..86dcaafe25 100644
--- a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php
+++ b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php
@@ -126,8 +126,8 @@ public function testExceptionHandler() {
     $this->assertSession()->statusCodeEquals(500);
     // We cannot use assertErrorMessage() since the exact error reported
     // varies from database to database. Check that the SQL string is displayed.
-    $this->assertText($error_pdo_exception['%type'], new FormattableMarkup('Found %type in error page.', $error_pdo_exception));
-    $this->assertText($error_pdo_exception['@message'], new FormattableMarkup('Found @message in error page.', $error_pdo_exception));
+    $this->assertSession()->responseContains($error_pdo_exception['%type'], new FormattableMarkup('Found %type in error page.', $error_pdo_exception));
+    $this->assertSession()->responseContains($error_pdo_exception['@message'], new FormattableMarkup('Found @message in error page.', $error_pdo_exception));
     $error_details = new FormattableMarkup('in %function (line ', $error_pdo_exception);
     $this->assertRaw($error_details, new FormattableMarkup("Found '@message' in error page.", ['@message' => $error_details]));
 
diff --git a/core/modules/system/tests/src/Functional/System/FrontPageTest.php b/core/modules/system/tests/src/Functional/System/FrontPageTest.php
index 6dbef38ffb..edecc63a70 100644
--- a/core/modules/system/tests/src/Functional/System/FrontPageTest.php
+++ b/core/modules/system/tests/src/Functional/System/FrontPageTest.php
@@ -61,16 +61,16 @@ public function testDrupalFrontPage() {
     $this->drupalGet('');
     $this->assertTitle('Home | Drupal');
 
-    $this->assertText(t('On front page.'), 'Path is the front page.');
+    $this->assertSession()->responseContains(t('On front page.'), 'Path is the front page.');
     $this->drupalGet('node');
-    $this->assertText(t('On front page.'), 'Path is the front page.');
+    $this->assertSession()->responseContains(t('On front page.'), 'Path is the front page.');
     $this->drupalGet($this->nodePath);
-    $this->assertNoText(t('On front page.'), 'Path is not the front page.');
+    $this->assertSession()->responseNotContains(t('On front page.'), 'Path is not the front page.');
 
     // Change the front page to an invalid path.
     $edit = ['site_frontpage' => '/kittens'];
     $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
-    $this->assertText(t("Either the path '@path' is invalid or you do not have access to it.", ['@path' => $edit['site_frontpage']]));
+    $this->assertSession()->responseContains(t("Either the path '@path' is invalid or you do not have access to it.", ['@path' => $edit['site_frontpage']]));
 
     // Change the front page to a path without a starting slash.
     $edit = ['site_frontpage' => $this->nodePath];
@@ -80,14 +80,14 @@ public function testDrupalFrontPage() {
     // Change the front page to a valid path.
     $edit['site_frontpage'] = '/' . $this->nodePath;
     $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'), 'The front page path has been saved.');
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'), 'The front page path has been saved.');
 
     $this->drupalGet('');
-    $this->assertText(t('On front page.'), 'Path is the front page.');
+    $this->assertSession()->responseContains(t('On front page.'), 'Path is the front page.');
     $this->drupalGet('node');
-    $this->assertNoText(t('On front page.'), 'Path is not the front page.');
+    $this->assertSession()->responseNotContains(t('On front page.'), 'Path is not the front page.');
     $this->drupalGet($this->nodePath);
-    $this->assertText(t('On front page.'), 'Path is the front page.');
+    $this->assertSession()->responseContains(t('On front page.'), 'Path is the front page.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/System/HtaccessTest.php b/core/modules/system/tests/src/Functional/System/HtaccessTest.php
index f57e82c97f..bea50fa652 100644
--- a/core/modules/system/tests/src/Functional/System/HtaccessTest.php
+++ b/core/modules/system/tests/src/Functional/System/HtaccessTest.php
@@ -122,14 +122,14 @@ public function testFileAccess() {
     $node->save();
     $this->drupalGet('test.php');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('This is a node');
+    $this->assertSession()->responseContains('This is a node');
 
     // Update node's alias to test.php/test.
     $node->path = '/test.php/test';
     $node->save();
     $this->drupalGet('test.php/test');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('This is a node');
+    $this->assertSession()->responseContains('This is a node');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php b/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php
index c35a10005d..80184afcb6 100644
--- a/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php
+++ b/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php
@@ -50,7 +50,7 @@ public function testMainContentFallback() {
     $edit['uninstall[block]'] = 'block';
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
-    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
     $this->rebuildContainer();
     $this->assertFalse(\Drupal::moduleHandler()->moduleExists('block'), 'Block module uninstall.');
 
@@ -60,7 +60,7 @@ public function testMainContentFallback() {
     $this->drupalGet('admin/config/system/site-information');
     $this->assertField('site_name', 'Fallback to SimplePageVariant works for admin theme.');
     $this->drupalGet('system-test/main-content-fallback');
-    $this->assertText(t('Content to test main content fallback'), 'Fallback to SimplePageVariant works for front-end theme.');
+    $this->assertSession()->responseContains(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');
@@ -71,7 +71,7 @@ public function testMainContentFallback() {
     $edit = [];
     $edit['modules[block][enable]'] = 'block';
     $this->drupalPostForm('admin/modules', $edit, t('Install'));
-    $this->assertText(t('Module Block has been enabled.'), 'Modules status has been updated.');
+    $this->assertSession()->responseContains(t('Module Block has been enabled.'), 'Modules status has been updated.');
     $this->rebuildContainer();
     $this->assertTrue(\Drupal::moduleHandler()->moduleExists('block'), 'Block module re-enabled.');
   }
diff --git a/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php b/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php
index 87a0c1ec23..10cc439b06 100644
--- a/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php
+++ b/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php
@@ -45,7 +45,7 @@ protected function setUp(): void {
   public function testPageNotFound() {
     $this->drupalLogin($this->adminUser);
     $this->drupalGet($this->randomMachineName(10));
-    $this->assertText(t('Page not found'), 'Found the default 404 page');
+    $this->assertSession()->responseContains(t('Page not found'), 'Found the default 404 page');
 
     // Set a custom 404 page without a starting slash.
     $edit = [
@@ -61,7 +61,7 @@ public function testPageNotFound() {
     $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
 
     $this->drupalGet($this->randomMachineName(10));
-    $this->assertText($this->adminUser->getAccountName(), 'Found the custom 404 page');
+    $this->assertSession()->responseContains($this->adminUser->getAccountName(), 'Found the custom 404 page');
   }
 
   /**
@@ -72,16 +72,16 @@ public function testPageNotFoundCustomPageWithAccessDenied() {
     $this->config('system.site')->set('page.404', '/system-test/custom-4xx')->save();
 
     $this->drupalGet('/this-path-does-not-exist');
-    $this->assertNoText('Admin-only 4xx response');
-    $this->assertText('The requested page could not be found.');
+    $this->assertSession()->responseNotContains('Admin-only 4xx response');
+    $this->assertSession()->responseContains('The requested page could not be found.');
     $this->assertSession()->statusCodeEquals(404);
     // Verify the access cacheability metadata for custom 404 is bubbled.
     $this->assertCacheContext('user.roles');
 
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('/this-path-does-not-exist');
-    $this->assertText('Admin-only 4xx response');
-    $this->assertNoText('The requested page could not be found.');
+    $this->assertSession()->responseContains('Admin-only 4xx response');
+    $this->assertSession()->responseNotContains('The requested page could not be found.');
     $this->assertSession()->statusCodeEquals(404);
     // Verify the access cacheability metadata for custom 404 is bubbled.
     $this->assertCacheContext('user.roles');
diff --git a/core/modules/system/tests/src/Functional/System/PageTitleTest.php b/core/modules/system/tests/src/Functional/System/PageTitleTest.php
index 5b280512db..7485560ae6 100644
--- a/core/modules/system/tests/src/Functional/System/PageTitleTest.php
+++ b/core/modules/system/tests/src/Functional/System/PageTitleTest.php
@@ -58,9 +58,9 @@ public function testTitleTags() {
 
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->assertNotNull($node, 'Node created and found in database');
-    $this->assertText(Html::escape($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.');
+    $this->assertSession()->responseContains(Html::escape($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.');
     $this->drupalGet("node/" . $node->id());
-    $this->assertText(Html::escape($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.');
+    $this->assertSession()->responseContains(Html::escape($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php
index 0da67f459f..242a00d69d 100644
--- a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php
+++ b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php
@@ -82,19 +82,19 @@ public function testSiteMaintenance() {
     $this->drupalLogout();
     $this->drupalGet('');
     $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]->getText());
-    $this->assertText($offline_message);
+    $this->assertSession()->responseContains($offline_message);
     $this->drupalGet('node');
     $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]->getText());
-    $this->assertText($offline_message);
+    $this->assertSession()->responseContains($offline_message);
     $this->drupalGet('user/register');
     $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]->getText());
-    $this->assertText($offline_message);
+    $this->assertSession()->responseContains($offline_message);
 
     // Verify that user is able to log in.
     $this->drupalGet('user');
-    $this->assertNoText($offline_message);
+    $this->assertSession()->responseNotContains($offline_message);
     $this->drupalGet('user/login');
-    $this->assertNoText($offline_message);
+    $this->assertSession()->responseNotContains($offline_message);
 
     // Log in user and verify that maintenance mode message is displayed
     // directly after login.
@@ -103,7 +103,7 @@ public function testSiteMaintenance() {
       'pass' => $this->user->pass_raw,
     ];
     $this->drupalPostForm(NULL, $edit, t('Log in'));
-    $this->assertText($user_message);
+    $this->assertSession()->responseContains($user_message);
 
     // Log in administrative user and configure a custom site offline message.
     $this->drupalLogout();
@@ -125,7 +125,7 @@ public function testSiteMaintenance() {
 
     // Verify that custom site offline message is not displayed on user/password.
     $this->drupalGet('user/password');
-    $this->assertText(t('Username or email address'), 'Anonymous users can access user/password');
+    $this->assertSession()->responseContains(t('Username or email address'), 'Anonymous users can access user/password');
 
     // Submit password reset form.
     $edit = [
@@ -138,7 +138,7 @@ public function testSiteMaintenance() {
 
     // Log in with temporary login link.
     $this->drupalPostForm($path, [], t('Log in'));
-    $this->assertText($user_message);
+    $this->assertSession()->responseContains($user_message);
 
     // Regression test to check if title displays in Bartik on maintenance page.
     \Drupal::service('theme_installer')->install(['bartik']);
diff --git a/core/modules/system/tests/src/Functional/System/StatusTest.php b/core/modules/system/tests/src/Functional/System/StatusTest.php
index 09f27a5ba0..1eaaec83e2 100644
--- a/core/modules/system/tests/src/Functional/System/StatusTest.php
+++ b/core/modules/system/tests/src/Functional/System/StatusTest.php
@@ -51,7 +51,7 @@ public function testStatusPage() {
     $this->assertSession()->statusCodeEquals(200);
 
     $phpversion = phpversion();
-    $this->assertText($phpversion, 'Php version is shown on the page.');
+    $this->assertSession()->responseContains($phpversion, 'Php version is shown on the page.');
 
     if (function_exists('phpinfo')) {
       $this->assertLinkByHref(Url::fromRoute('system.php')->toString());
@@ -61,7 +61,7 @@ public function testStatusPage() {
     }
 
     // If a module is fully installed no pending updates exists.
-    $this->assertNoText(t('Out of date'));
+    $this->assertSession()->responseNotContains(t('Out of date'));
 
     // The setting config_sync_directory is not properly formed.
     $this->assertRaw(t("Your %file file must define the %setting setting", ['%file' => $this->siteDirectory . '/settings.php', '%setting' => "\$settings['config_sync_directory']"]));
@@ -70,7 +70,7 @@ public function testStatusPage() {
     // update_test_postupdate_update_8001() needs to be executed.
     drupal_set_installed_schema_version('update_test_postupdate', 8000);
     $this->drupalGet('admin/reports/status');
-    $this->assertText(t('Out of date'));
+    $this->assertSession()->responseContains(t('Out of date'));
 
     // Now cleanup the executed post update functions.
     drupal_set_installed_schema_version('update_test_postupdate', 8001);
@@ -78,7 +78,7 @@ public function testStatusPage() {
     $post_update_registry = \Drupal::service('update.post_update_registry');
     $post_update_registry->filterOutInvokedUpdatesByModule('update_test_postupdate');
     $this->drupalGet('admin/reports/status');
-    $this->assertText(t('Out of date'));
+    $this->assertSession()->responseContains(t('Out of date'));
 
     $this->drupalGet('admin/reports/status/php');
     $this->assertSession()->statusCodeEquals(200);
diff --git a/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php b/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php
index 8f0ba2dca7..3cd75dad3a 100644
--- a/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php
+++ b/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php
@@ -52,12 +52,12 @@ public function testFileTransferHooks() {
     $page_title = $this->randomMachineName(16);
     $this->drupalGetAuthorizePHP($page_title);
     $this->assertTitle(strtr('@title | Drupal', ['@title' => $page_title]), 'authorize.php page title is correct.');
-    $this->assertNoText('It appears you have reached this page in error.');
-    $this->assertText('To continue, provide your server connection details');
+    $this->assertSession()->responseNotContains('It appears you have reached this page in error.');
+    $this->assertSession()->responseContains('To continue, provide your server connection details');
     // Make sure we see the new connection method added by system_test.
     $this->assertRaw('System Test FileTransfer');
     // Make sure the settings form callback works.
-    $this->assertText('System Test Username');
+    $this->assertSession()->responseContains('System Test Username');
     // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets as
     // expected to the first page of the authorize.php script.
     $this->assertRaw('core/misc/states.js');
diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php
index cb2d799311..7d22d39b29 100644
--- a/core/modules/system/tests/src/Functional/System/ThemeTest.php
+++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php
@@ -102,7 +102,7 @@ public function testThemeSettings() {
         'logo_path' => $input,
       ];
       $this->drupalPostForm('admin/appearance/settings', $edit, t('Save configuration'));
-      $this->assertNoText('The custom logo path is invalid.');
+      $this->assertSession()->responseNotContains('The custom logo path is invalid.');
       $this->assertFieldByName('logo_path', $expected['form']);
 
       // Verify logo path examples.
@@ -174,7 +174,7 @@ public function testThemeSettings() {
         'logo_path' => $path,
       ];
       $this->drupalPostForm(NULL, $edit, t('Save configuration'));
-      $this->assertText('The custom logo path is invalid.');
+      $this->assertSession()->responseContains('The custom logo path is invalid.');
     }
 
     // Upload a file to use for the logo.
@@ -224,8 +224,8 @@ public function testThemeSettings() {
       'favicon_path' => 'public://whatever.ico',
     ];
     $this->drupalPostForm('admin/appearance/settings', $edit, 'Save configuration');
-    $this->assertNoText('The custom logo path is invalid.');
-    $this->assertNoText('The custom favicon path is invalid.');
+    $this->assertSession()->responseNotContains('The custom logo path is invalid.');
+    $this->assertSession()->responseNotContains('The custom favicon path is invalid.');
   }
 
   /**
@@ -247,8 +247,8 @@ public function testThemeSettingsLogo() {
     // module is not enabled.
     \Drupal::service('module_installer')->uninstall(['file']);
     $this->drupalGet('admin/appearance/settings');
-    $this->assertNoText('Logo image settings');
-    $this->assertNoText('Shortcut icon settings');
+    $this->assertSession()->responseNotContains('Logo image settings');
+    $this->assertSession()->responseNotContains('Shortcut icon settings');
   }
 
   /**
@@ -351,13 +351,13 @@ public function testSwitchDefaultTheme() {
 
     // Test the default theme on the secondary links (blocks admin page).
     $this->drupalGet('admin/structure/block');
-    $this->assertText('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page is the default theme.');
+    $this->assertSession()->responseContains('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page is the default theme.');
     // Switch back to Stark and test again to test that the menu cache is cleared.
     $this->drupalGet('admin/appearance');
     // Stark is the first 'Set as default' link.
     $this->clickLink(t('Set as default'));
     $this->drupalGet('admin/structure/block');
-    $this->assertText('Stark(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
+    $this->assertSession()->responseContains('Stark(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
   }
 
   /**
@@ -372,15 +372,15 @@ public function testInvalidTheme() {
     // Clear the system_list() and theme listing cache to pick up the change.
     $this->container->get('theme_handler')->reset();
     $this->drupalGet('admin/appearance');
-    $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => 'not_real_test_basetheme']));
-    $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => 'test_invalid_basetheme']));
-    $this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', ['@theme_engine' => 'not_real_engine']));
+    $this->assertSession()->responseContains(t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => 'not_real_test_basetheme']));
+    $this->assertSession()->responseContains(t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => 'test_invalid_basetheme']));
+    $this->assertSession()->responseContains(t('This theme requires the theme engine @theme_engine to operate correctly.', ['@theme_engine' => 'not_real_engine']));
     // Check for the error text of a theme with the wrong core version
     // using 7.x and ^7.
     $incompatible_core_message = 'This theme is not compatible with Drupal ' . \Drupal::VERSION . ". Check that the .info.yml file contains a compatible 'core' or 'core_version_requirement' value.";
     $this->assertThemeIncompatibleText('Theme test with invalid semver core version', $incompatible_core_message);
     // Check for the error text of a theme without a content region.
-    $this->assertText("This theme is missing a 'content' region.");
+    $this->assertSession()->responseContains("This theme is missing a 'content' region.");
   }
 
   /**
@@ -455,12 +455,12 @@ public function testInstallAndSetAsDefault() {
       $this->drupalGet('admin/appearance');
       $this->getSession()->getPage()->findLink("Install $theme_name as default theme")->click();
       // Test the confirmation message.
-      $this->assertText("$theme_name is now the default theme.");
+      $this->assertSession()->responseContains("$theme_name is now the default theme.");
       // Make sure the theme is now set as the default theme in config.
       $this->assertEqual($this->config('system.theme')->get('default'), $theme_machine_name);
 
       // This checks for a regression. See https://www.drupal.org/node/2498691.
-      $this->assertNoText("The $theme_machine_name theme was not found.");
+      $this->assertSession()->responseNotContains("The $theme_machine_name theme was not found.");
 
       $themes = \Drupal::service('theme_handler')->rebuildThemeData();
       $version = $themes[$theme_machine_name]->info['version'];
@@ -482,7 +482,7 @@ public function testThemeSettingsNoLogoNoFavicon() {
     $this->drupalGet('admin/appearance/settings/test_theme_settings_features');
     $edit = [];
     $this->drupalPostForm('admin/appearance/settings/test_theme_settings_features', $edit, t('Save configuration'));
-    $this->assertText('The configuration options have been saved.');
+    $this->assertSession()->responseContains('The configuration options have been saved.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/TokenReplaceWebTest.php b/core/modules/system/tests/src/Functional/System/TokenReplaceWebTest.php
index bf5ec9b68f..ddf1d71e56 100644
--- a/core/modules/system/tests/src/Functional/System/TokenReplaceWebTest.php
+++ b/core/modules/system/tests/src/Functional/System/TokenReplaceWebTest.php
@@ -34,12 +34,12 @@ public function testTokens() {
     $this->drupalLogin($account);
 
     $this->drupalGet('token-test/' . $node->id());
-    $this->assertText("Tokens: {$node->id()} {$account->id()}");
+    $this->assertSession()->responseContains("Tokens: {$node->id()} {$account->id()}");
     $this->assertCacheTags(['node:1', 'rendered', 'user:2']);
     $this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user']);
 
     $this->drupalGet('token-test-without-bubleable-metadata/' . $node->id());
-    $this->assertText("Tokens: {$node->id()} {$account->id()}");
+    $this->assertSession()->responseContains("Tokens: {$node->id()} {$account->id()}");
     $this->assertCacheTags(['node:1', 'rendered', 'user:2']);
     $this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user']);
   }
diff --git a/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php b/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php
index bdf65203dd..f24a135f02 100644
--- a/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php
+++ b/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php
@@ -76,7 +76,7 @@ public function testFakeRequests() {
     $this->writeSettings($settings);
 
     $this->drupalGet('trusted-hosts-test/fake-request');
-    $this->assertText('Host: ' . $host);
+    $this->assertSession()->responseContains('Host: ' . $host);
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Theme/EngineNyanCatTest.php b/core/modules/system/tests/src/Functional/Theme/EngineNyanCatTest.php
index 86613a79ae..1a63443518 100644
--- a/core/modules/system/tests/src/Functional/Theme/EngineNyanCatTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/EngineNyanCatTest.php
@@ -36,7 +36,7 @@ public function testTemplateOverride() {
       ->set('default', 'test_theme_nyan_cat_engine')
       ->save();
     $this->drupalGet('theme-test/template-test');
-    $this->assertText('Success: Template overridden with Nyan Cat theme. All of them', 'Template overridden by Nyan Cat file.');
+    $this->assertSession()->responseContains('Success: Template overridden with Nyan Cat theme. All of them', 'Template overridden by Nyan Cat file.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
index 42e119ef88..30a84abbaf 100644
--- a/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
@@ -38,41 +38,41 @@ protected function setUp(): void {
   public function testExperimentalConfirmForm() {
     // Only experimental themes should be marked as such with a parenthetical.
     $this->drupalGet('admin/appearance');
-    $this->assertText(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
-    $this->assertText(sprintf('Experimental dependency test %s', \Drupal::VERSION));
+    $this->assertSession()->responseContains(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
+    $this->assertSession()->responseContains(sprintf('Experimental dependency test %s', \Drupal::VERSION));
 
     // First, test installing a non-experimental theme with no dependencies.
     // There should be no confirmation form and no experimental theme warning.
     $this->drupalGet('admin/appearance');
     $this->cssSelect('a[title="Install <strong>Test theme</strong> theme"]')[0]->click();
-    $this->assertText('The &lt;strong&gt;Test theme&lt;/strong&gt; theme has been installed.');
-    $this->assertNoText('Experimental modules are provided for testing purposes only.');
+    $this->assertSession()->responseContains('The &lt;strong&gt;Test theme&lt;/strong&gt; theme has been installed.');
+    $this->assertSession()->responseNotContains('Experimental modules are provided for testing purposes only.');
 
     // Next, test installing an experimental theme with no dependencies.
     // There should be a confirmation form with an experimental warning, but no
     // list of dependencies.
     $this->drupalGet('admin/appearance');
     $this->cssSelect('a[title="Install Experimental test theme"]')[0]->click();
-    $this->assertText('Experimental themes are provided for testing purposes only. Use at your own risk.');
+    $this->assertSession()->responseContains('Experimental themes are provided for testing purposes only. Use at your own risk.');
 
     // The module should not be enabled and there should be a warning and a
     // list of the experimental modules with only this one.
-    $this->assertNoText('The Experimental Test theme has been installed.');
-    $this->assertText('Experimental themes are provided for testing purposes only.');
+    $this->assertSession()->responseNotContains('The Experimental Test theme has been installed.');
+    $this->assertSession()->responseContains('Experimental themes are provided for testing purposes only.');
 
     // There should be no message about enabling dependencies.
-    $this->assertNoText('You must enable');
+    $this->assertSession()->responseNotContains('You must enable');
 
     // Enable the theme and confirm that it worked.
     $this->drupalPostForm(NULL, [], 'Continue');
-    $this->assertText('The Experimental test theme has been installed.');
+    $this->assertSession()->responseContains('The Experimental test theme has been installed.');
 
     // Setting it as the default should not ask for another confirmation.
     $this->cssSelect('a[title="Set Experimental test as default theme"]')[0]->click();
-    $this->assertNoText('Experimental themes are provided for testing purposes only. Use at your own risk.');
-    $this->assertText('Experimental test is now the default theme.');
-    $this->assertNoText(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
-    $this->assertText(sprintf('Experimental test %s                (default theme, administration theme, experimental theme)', \Drupal::VERSION));
+    $this->assertSession()->responseNotContains('Experimental themes are provided for testing purposes only. Use at your own risk.');
+    $this->assertSession()->responseContains('Experimental test is now the default theme.');
+    $this->assertSession()->responseNotContains(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
+    $this->assertSession()->responseContains(sprintf('Experimental test %s                (default theme, administration theme, experimental theme)', \Drupal::VERSION));
 
     // Uninstall the theme.
     $this->config('system.theme')->set('default', 'test_theme')->save();
@@ -84,7 +84,7 @@ public function testExperimentalConfirmForm() {
     // experimental warning.
     $this->drupalGet('admin/appearance');
     $this->cssSelect('a[title="Install Experimental test as default theme"]')[0]->click();
-    $this->assertText('Experimental themes are provided for testing purposes only. Use at your own risk.');
+    $this->assertSession()->responseContains('Experimental themes are provided for testing purposes only. Use at your own risk.');
 
     // Test enabling a theme that is not itself experimental, but that depends
     // on an experimental module.
@@ -93,29 +93,29 @@ public function testExperimentalConfirmForm() {
 
     // The theme should not be enabled and there should be a warning and a
     // list of the experimental modules with only this one.
-    $this->assertNoText('The Experimental dependency test theme has been installed.');
-    $this->assertText('Experimental themes are provided for testing purposes only. Use at your own risk.');
-    $this->assertText('The following themes are experimental: Experimental test');
+    $this->assertSession()->responseNotContains('The Experimental dependency test theme has been installed.');
+    $this->assertSession()->responseContains('Experimental themes are provided for testing purposes only. Use at your own risk.');
+    $this->assertSession()->responseContains('The following themes are experimental: Experimental test');
 
     // Ensure the non-experimental theme is not listed as experimental.
-    $this->assertNoText('The following themes are experimental: Experimental test, Experimental dependency test');
-    $this->assertNoText('The following themes are experimental: Experimental dependency test');
+    $this->assertSession()->responseNotContains('The following themes are experimental: Experimental test, Experimental dependency test');
+    $this->assertSession()->responseNotContains('The following themes are experimental: Experimental dependency test');
 
     // There should be a message about enabling dependencies.
-    $this->assertText('You must enable the Experimental test theme to install Experimental dependency test');
+    $this->assertSession()->responseContains('You must enable the Experimental test theme to install Experimental dependency test');
 
     // Enable the theme and confirm that it worked.
     $this->drupalPostForm(NULL, [], 'Continue');
-    $this->assertText('The Experimental dependency test theme has been installed.');
-    $this->assertText(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
-    $this->assertText(sprintf('Experimental dependency test %s', \Drupal::VERSION));
+    $this->assertSession()->responseContains('The Experimental dependency test theme has been installed.');
+    $this->assertSession()->responseContains(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
+    $this->assertSession()->responseContains(sprintf('Experimental dependency test %s', \Drupal::VERSION));
 
     // Setting it as the default should not ask for another confirmation.
     $this->cssSelect('a[title="Set Experimental dependency test as default theme"]')[0]->click();
-    $this->assertNoText('Experimental themes are provided for testing purposes only. Use at your own risk.');
-    $this->assertText('Experimental dependency test is now the default theme.');
-    $this->assertText(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
-    $this->assertText(sprintf('Experimental dependency test %s                (default theme, administration theme)', \Drupal::VERSION));
+    $this->assertSession()->responseNotContains('Experimental themes are provided for testing purposes only. Use at your own risk.');
+    $this->assertSession()->responseContains('Experimental dependency test is now the default theme.');
+    $this->assertSession()->responseContains(sprintf('Experimental test %s                (experimental theme)', \Drupal::VERSION));
+    $this->assertSession()->responseContains(sprintf('Experimental dependency test %s                (default theme, administration theme)', \Drupal::VERSION));
 
     // Uninstall the theme.
     $this->config('system.theme')->set('default', 'test_theme')->save();
@@ -127,7 +127,7 @@ public function testExperimentalConfirmForm() {
     // experimental warning for its dependency.
     $this->drupalGet('admin/appearance');
     $this->cssSelect('a[title="Install Experimental dependency test as default theme"]')[0]->click();
-    $this->assertText('Experimental themes are provided for testing purposes only. Use at your own risk.');
+    $this->assertSession()->responseContains('Experimental themes are provided for testing purposes only. Use at your own risk.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Theme/FastTest.php b/core/modules/system/tests/src/Functional/Theme/FastTest.php
index 762acaca34..e6e2dd7d56 100644
--- a/core/modules/system/tests/src/Functional/Theme/FastTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/FastTest.php
@@ -35,7 +35,7 @@ public function testUserAutocomplete() {
     $this->drupalLogin($this->account);
     $this->drupalGet('user/autocomplete', ['query' => ['q' => $this->account->getAccountName()]]);
     $this->assertRaw($this->account->getAccountName());
-    $this->assertNoText('registry initialized', 'The registry was not initialized');
+    $this->assertSession()->responseNotContains('registry initialized', 'The registry was not initialized');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeLegacyTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeLegacyTest.php
index 7de359c95b..c640bbf8f7 100644
--- a/core/modules/system/tests/src/Functional/Theme/ThemeLegacyTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ThemeLegacyTest.php
@@ -36,7 +36,7 @@ protected function setUp(): void {
    */
   public function testFunctionOverride() {
     $this->drupalGet('theme-test/function-template-overridden');
-    $this->assertText('Success: Template overrides theme function.', 'Theme function overridden by test_theme template.');
+    $this->assertSession()->responseContains('Success: Template overrides theme function.', 'Theme function overridden by test_theme template.');
   }
 
   /**
@@ -44,21 +44,21 @@ public function testFunctionOverride() {
    */
   public function testThemeFunctionSuggestionsAlter() {
     $this->drupalGet('theme-test/function-suggestion-alter');
-    $this->assertText('Original theme function.');
+    $this->assertSession()->responseContains('Original theme function.');
 
     // Install test_theme and test that themes can alter theme suggestions.
     $this->config('system.theme')
       ->set('default', 'test_legacy_theme')
       ->save();
     $this->drupalGet('theme-test/function-suggestion-alter');
-    $this->assertText('Theme function overridden based on new theme suggestion provided by the test_legacy_theme theme.');
+    $this->assertSession()->responseContains('Theme function overridden based on new theme suggestion provided by the test_legacy_theme theme.');
 
     // Enable the theme_suggestions_test module to test modules implementing
     // suggestions alter hooks.
     \Drupal::service('module_installer')->install(['theme_legacy_suggestions_test']);
     $this->resetAll();
     $this->drupalGet('theme-test/function-suggestion-alter');
-    $this->assertText('Theme function overridden based on new theme suggestion provided by a module.');
+    $this->assertSession()->responseContains('Theme function overridden based on new theme suggestion provided by a module.');
   }
 
   /**
@@ -67,7 +67,7 @@ public function testThemeFunctionSuggestionsAlter() {
   public function testSuggestionsAlterInclude() {
     // Check the original theme output.
     $this->drupalGet('theme-test/suggestion-alter-include');
-    $this->assertText('Original function before altering theme suggestions.');
+    $this->assertSession()->responseContains('Original function before altering theme suggestions.');
 
     // Enable theme_suggestions_test module and make two requests to make sure
     // the include file is always loaded. The file will always be included for
@@ -75,9 +75,9 @@ public function testSuggestionsAlterInclude() {
     \Drupal::service('module_installer')->install(['theme_legacy_suggestions_test']);
     $this->resetAll();
     $this->drupalGet('theme-test/suggestion-alter-include');
-    $this->assertText('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for initial request.');
+    $this->assertSession()->responseContains('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for initial request.');
     $this->drupalGet('theme-test/suggestion-alter-include');
-    $this->assertText('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for second request.');
+    $this->assertSession()->responseContains('Function suggested via suggestion alter hook found in include file.', 'Include file loaded for second request.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeSuggestionsAlterTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeSuggestionsAlterTest.php
index c1398cc9ce..699dbea23d 100644
--- a/core/modules/system/tests/src/Functional/Theme/ThemeSuggestionsAlterTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ThemeSuggestionsAlterTest.php
@@ -34,7 +34,7 @@ protected function setUp(): void {
    */
   public function testTemplateSuggestions() {
     $this->drupalGet('theme-test/suggestion-provided');
-    $this->assertText('Template for testing suggestions provided by the module declaring the theme hook.');
+    $this->assertSession()->responseContains('Template for testing suggestions provided by the module declaring the theme hook.');
 
     // Install test_theme, it contains a template suggested by theme_test.module
     // in theme_test_theme_suggestions_theme_test_suggestion_provided().
@@ -43,7 +43,7 @@ public function testTemplateSuggestions() {
       ->save();
 
     $this->drupalGet('theme-test/suggestion-provided');
-    $this->assertText('Template overridden based on suggestion provided by the module declaring the theme hook.');
+    $this->assertSession()->responseContains('Template overridden based on suggestion provided by the module declaring the theme hook.');
   }
 
   /**
@@ -51,21 +51,21 @@ public function testTemplateSuggestions() {
    */
   public function testGeneralSuggestionsAlter() {
     $this->drupalGet('theme-test/general-suggestion-alter');
-    $this->assertText('Original template for testing hook_theme_suggestions_alter().');
+    $this->assertSession()->responseContains('Original template for testing hook_theme_suggestions_alter().');
 
     // Install test_theme and test that themes can alter template suggestions.
     $this->config('system.theme')
       ->set('default', 'test_theme')
       ->save();
     $this->drupalGet('theme-test/general-suggestion-alter');
-    $this->assertText('Template overridden based on new theme suggestion provided by the test_theme theme via hook_theme_suggestions_alter().');
+    $this->assertSession()->responseContains('Template overridden based on new theme suggestion provided by the test_theme theme via hook_theme_suggestions_alter().');
 
     // Enable the theme_suggestions_test module to test modules implementing
     // suggestions alter hooks.
     \Drupal::service('module_installer')->install(['theme_suggestions_test']);
     $this->resetAll();
     $this->drupalGet('theme-test/general-suggestion-alter');
-    $this->assertText('Template overridden based on new theme suggestion provided by a module via hook_theme_suggestions_alter().');
+    $this->assertSession()->responseContains('Template overridden based on new theme suggestion provided by a module via hook_theme_suggestions_alter().');
   }
 
   /**
@@ -73,21 +73,21 @@ public function testGeneralSuggestionsAlter() {
    */
   public function testTemplateSuggestionsAlter() {
     $this->drupalGet('theme-test/suggestion-alter');
-    $this->assertText('Original template for testing hook_theme_suggestions_HOOK_alter().');
+    $this->assertSession()->responseContains('Original template for testing hook_theme_suggestions_HOOK_alter().');
 
     // Install test_theme and test that themes can alter template suggestions.
     $this->config('system.theme')
       ->set('default', 'test_theme')
       ->save();
     $this->drupalGet('theme-test/suggestion-alter');
-    $this->assertText('Template overridden based on new theme suggestion provided by the test_theme theme via hook_theme_suggestions_HOOK_alter().');
+    $this->assertSession()->responseContains('Template overridden based on new theme suggestion provided by the test_theme theme via hook_theme_suggestions_HOOK_alter().');
 
     // Enable the theme_suggestions_test module to test modules implementing
     // suggestions alter hooks.
     \Drupal::service('module_installer')->install(['theme_suggestions_test']);
     $this->resetAll();
     $this->drupalGet('theme-test/suggestion-alter');
-    $this->assertText('Template overridden based on new theme suggestion provided by a module via hook_theme_suggestions_HOOK_alter().');
+    $this->assertSession()->responseContains('Template overridden based on new theme suggestion provided by a module via hook_theme_suggestions_HOOK_alter().');
   }
 
   /**
@@ -96,7 +96,7 @@ public function testTemplateSuggestionsAlter() {
   public function testSpecificSuggestionsAlter() {
     // Test that the default template is rendered.
     $this->drupalGet('theme-test/specific-suggestion-alter');
-    $this->assertText('Template for testing specific theme calls.');
+    $this->assertSession()->responseContains('Template for testing specific theme calls.');
 
     $this->config('system.theme')
       ->set('default', 'test_theme')
@@ -104,14 +104,14 @@ public function testSpecificSuggestionsAlter() {
 
     // Test a specific theme call similar to '#theme' => 'node__article'.
     $this->drupalGet('theme-test/specific-suggestion-alter');
-    $this->assertText('Template matching the specific theme call.');
-    $this->assertText('theme_test_specific_suggestions__variant', 'Specific theme call is added to the suggestions array.');
+    $this->assertSession()->responseContains('Template matching the specific theme call.');
+    $this->assertSession()->responseContains('theme_test_specific_suggestions__variant', 'Specific theme call is added to the suggestions array.');
 
     // Ensure that the base hook is used to determine the suggestion alter hook.
     \Drupal::service('module_installer')->install(['theme_suggestions_test']);
     $this->resetAll();
     $this->drupalGet('theme-test/specific-suggestion-alter');
-    $this->assertText('Template overridden based on suggestion alter hook determined by the base hook.');
+    $this->assertSession()->responseContains('Template overridden based on suggestion alter hook determined by the base hook.');
     $raw_content = $this->getSession()->getPage()->getContent();
     $this->assertTrue(strpos($raw_content, 'theme_test_specific_suggestions__variant') < strpos($raw_content, 'theme_test_specific_suggestions__variant__foo'), 'Specific theme call is added to the suggestions array before the suggestions alter hook.');
   }
diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeTest.php
index 1c65277f27..1fd1827626 100644
--- a/core/modules/system/tests/src/Functional/Theme/ThemeTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ThemeTest.php
@@ -45,7 +45,7 @@ public function testPreprocessForSuggestions() {
     drupal_theme_rebuild();
     for ($i = 0; $i < 2; $i++) {
       $this->drupalGet('theme-test/suggestion');
-      $this->assertText('Theme hook implementor=theme-test--suggestion.html.twig. Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
+      $this->assertSession()->responseContains('Theme hook implementor=theme-test--suggestion.html.twig. Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
     }
   }
 
@@ -56,7 +56,7 @@ public function testNegotiatorPriorities() {
     $this->drupalGet('theme-test/priority');
 
     // Ensure that the custom theme negotiator was not able to set the theme.
-    $this->assertNoText('Theme hook implementor=theme-test--suggestion.html.twig. Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
+    $this->assertSession()->responseNotContains('Theme hook implementor=theme-test--suggestion.html.twig. Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
   }
 
   /**
@@ -96,7 +96,7 @@ public function testClassLoading() {
     $this->resetAll();
     // Visit page controller and confirm that the theme class is loaded.
     $this->drupalGet('/theme-test/test-theme-class');
-    $this->assertText('Loading ThemeClass was successful.');
+    $this->assertSession()->responseContains('Loading ThemeClass was successful.');
   }
 
   /**
@@ -138,7 +138,7 @@ public function testTemplateOverride() {
       ->set('default', 'test_theme')
       ->save();
     $this->drupalGet('theme-test/template-test');
-    $this->assertText('Success: Template overridden.', 'Template overridden by defined \'template\' filename.');
+    $this->assertSession()->responseContains('Success: Template overridden.', 'Template overridden by defined \'template\' filename.');
   }
 
   /**
@@ -151,7 +151,7 @@ public function testPreprocessHtml() {
     $this->drupalGet('');
     $attributes = $this->xpath('/body[@theme_test_page_variable="Page variable is an array."]');
     $this->assertCount(1, $attributes, 'In template_preprocess_html(), the page variable is still an array (not rendered yet).');
-    $this->assertText('theme test page bottom markup', 'Modules are able to set the page bottom region.');
+    $this->assertSession()->responseContains('theme test page bottom markup', 'Modules are able to set the page bottom region.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php
index 3968f69c2f..ec4d683812 100644
--- a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php
@@ -340,7 +340,7 @@ public function testInstalledIncompatibleTheme() {
 
     file_put_contents($file_path, Yaml::encode($compatible_info));
     $this->drupalGet('admin/appearance');
-    $this->assertNoText($incompatible_themes_message);
+    $this->assertSession()->responseNotContains($incompatible_themes_message);
     $page->clickLink("Install $theme_name theme");
     $assert_session->addressEquals('admin/appearance');
     $assert_session->pageTextContains("The $theme_name theme has been installed");
@@ -357,11 +357,11 @@ public function testInstalledIncompatibleTheme() {
       $incompatible_info = $info + $incompatible_update;
       file_put_contents($file_path, Yaml::encode($incompatible_info));
       $this->drupalGet('admin/appearance');
-      $this->assertText($incompatible_themes_message);
+      $this->assertSession()->responseContains($incompatible_themes_message);
 
       file_put_contents($file_path, Yaml::encode($compatible_info));
       $this->drupalGet('admin/appearance');
-      $this->assertNoText($incompatible_themes_message);
+      $this->assertSession()->responseNotContains($incompatible_themes_message);
     }
     // Uninstall the theme and ensure that incompatible themes message is not
     // displayed for themes that are not installed.
@@ -370,7 +370,7 @@ public function testInstalledIncompatibleTheme() {
       $incompatible_info = $info + $incompatible_update;
       file_put_contents($file_path, Yaml::encode($incompatible_info));
       $this->drupalGet('admin/appearance');
-      $this->assertNoText($incompatible_themes_message);
+      $this->assertSession()->responseNotContains($incompatible_themes_message);
     }
   }
 
diff --git a/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php b/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php
index 5a8659b16e..55737eebe6 100644
--- a/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php
@@ -47,7 +47,7 @@ public function testTwigExtensionFilter() {
       ->save();
 
     $this->drupalGet('twig-extension-test/filter');
-    $this->assertText('Every plant is not a mineral.', 'Success: String filtered.');
+    $this->assertSession()->responseContains('Every plant is not a mineral.', 'Success: String filtered.');
     // Test safe_join filter.
     $this->assertRaw('&lt;em&gt;will be escaped&lt;/em&gt;<br/><em>will be markup</em><br/><strong>will be rendered</strong>');
   }
@@ -61,9 +61,9 @@ public function testTwigExtensionFunction() {
       ->save();
 
     $this->drupalGet('twig-extension-test/function');
-    $this->assertText('THE QUICK BROWN BOX JUMPS OVER THE LAZY DOG 123.', 'Success: Text converted to uppercase.');
-    $this->assertText('the quick brown box jumps over the lazy dog 123.', 'Success: Text converted to lowercase.');
-    $this->assertNoText('The Quick Brown Fox Jumps Over The Lazy Dog 123.', 'Success: No text left behind.');
+    $this->assertSession()->responseContains('THE QUICK BROWN BOX JUMPS OVER THE LAZY DOG 123.', 'Success: Text converted to uppercase.');
+    $this->assertSession()->responseContains('the quick brown box jumps over the lazy dog 123.', 'Success: Text converted to lowercase.');
+    $this->assertSession()->responseNotContains('The Quick Brown Fox Jumps Over The Lazy Dog 123.', 'Success: No text left behind.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php b/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php
index 1ce4160073..4822f2cdd9 100644
--- a/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php
@@ -55,8 +55,8 @@ public function testTemplateDiscovery() {
   public function testTwigNamespaces() {
     // Test the module-provided extend and insert templates.
     $this->drupalGet('twig-theme-test/registry-loader');
-    $this->assertText('This line is from twig_theme_test/templates/twig-registry-loader-test-extend.html.twig');
-    $this->assertText('This line is from twig_theme_test/templates/twig-registry-loader-test-include.html.twig');
+    $this->assertSession()->responseContains('This line is from twig_theme_test/templates/twig-registry-loader-test-extend.html.twig');
+    $this->assertSession()->responseContains('This line is from twig_theme_test/templates/twig-registry-loader-test-include.html.twig');
 
     // Enable a theme that overrides the extend and insert templates to ensure
     // they are picked up by the registry loader.
@@ -64,8 +64,8 @@ public function testTwigNamespaces() {
       ->set('default', 'test_theme_twig_registry_loader')
       ->save();
     $this->drupalGet('twig-theme-test/registry-loader');
-    $this->assertText('This line is from test_theme_twig_registry_loader/templates/twig-registry-loader-test-extend.html.twig');
-    $this->assertText('This line is from test_theme_twig_registry_loader/templates/twig-registry-loader-test-include.html.twig');
+    $this->assertSession()->responseContains('This line is from test_theme_twig_registry_loader/templates/twig-registry-loader-test-extend.html.twig');
+    $this->assertSession()->responseContains('This line is from test_theme_twig_registry_loader/templates/twig-registry-loader-test-include.html.twig');
 
     // Enable overriding theme that overrides the extend and insert templates
     // from the base theme.
@@ -73,8 +73,8 @@ public function testTwigNamespaces() {
       ->set('default', 'test_theme_twig_registry_loader_theme')
       ->save();
     $this->drupalGet('twig-theme-test/registry-loader');
-    $this->assertText('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-extend.html.twig');
-    $this->assertText('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-include.html.twig');
+    $this->assertSession()->responseContains('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-extend.html.twig');
+    $this->assertSession()->responseContains('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-include.html.twig');
 
     // Enable a subtheme for the theme that doesn't have any overrides to make
     // sure that templates are being loaded from the first parent which has the
@@ -83,8 +83,8 @@ public function testTwigNamespaces() {
       ->set('default', 'test_theme_twig_registry_loader_subtheme')
       ->save();
     $this->drupalGet('twig-theme-test/registry-loader');
-    $this->assertText('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-extend.html.twig');
-    $this->assertText('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-include.html.twig');
+    $this->assertSession()->responseContains('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-extend.html.twig');
+    $this->assertSession()->responseContains('This line is from test_theme_twig_registry_loader_theme/templates/twig-registry-loader-test-include.html.twig');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php
index 85464dcf56..d10fe71c09 100644
--- a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php
@@ -125,32 +125,32 @@ public function testEmptyTwigTransTags() {
    * Asserts Twig trans tags.
    */
   protected function assertTwigTransTags() {
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'OH HAI SUNZ',
       '{% trans "Hello sun." %} was successfully translated.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'O HAI SUNZZZZZZZ',
       '{% trans "Hello sun." with {"context": "Lolspeak"} %} was successfully translated.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'O HERRO ERRRF.',
       '{{ "Hello Earth."|trans }} was successfully translated.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'OH HAI TEH MUUN',
       '{% trans %}Hello moon.{% endtrans %} was successfully translated.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'O HAI STARRRRR',
       '{% trans %} with {% plural count = 1 %} was successfully translated.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'O HAI 2 STARZZZZ',
       '{% trans %} with {% plural count = 2 %} was successfully translated.'
     );
@@ -170,28 +170,28 @@ protected function assertTwigTransTags() {
       '{{ complex.tokens }} were successfully translated with appropriate prefixes.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'I have context.',
       '{% trans %} with a context only msgid was excluded from translation.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'I HAZ KONTEX.',
       '{% trans with {"context": "Lolspeak"} %} was successfully translated with context.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'O HAI NU TXT.',
       '{% trans with {"langcode": "zz"} %} was successfully translated in specified language.'
     );
 
-    $this->assertText(
+    $this->assertSession()->responseContains(
       'O HAI NU TXTZZZZ.',
       '{% trans with {"context": "Lolspeak", "langcode": "zz"} %} was successfully translated with context in specified language.'
     );
     // Makes sure https://www.drupal.org/node/2489024 doesn't happen without
     // twig debug.
-    $this->assertNoText(pi(), 'Running php code inside a Twig trans is not possible.');
+    $this->assertSession()->responseNotContains(pi(), 'Running php code inside a Twig trans is not possible.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php
index 99cfb669ba..3d3d2f6e21 100644
--- a/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php
+++ b/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php
@@ -59,7 +59,7 @@ public function testInvalidUpdateHook() {
     $this->drupalGet($this->updateUrl);
     $this->updateRequirementsProblem();
     $this->clickLink(t('Continue'));
-    $this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
+    $this->assertSession()->responseContains(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php
index 60c1ef7d8f..b1fd8b3e42 100644
--- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php
+++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php
@@ -57,7 +57,7 @@ public function testUpdatedSite() {
       // Assert that nodes are all published.
       $this->assertTrue($node->isPublished());
       $this->drupalGet('node/' . $id);
-      $this->assertText($title);
+      $this->assertSession()->responseContains($title);
     }
 
     // Make sure the translated node still exists.
@@ -66,33 +66,33 @@ public function testUpdatedSite() {
 
     // Make sure our alias still works.
     $this->drupalGet('test-article');
-    $this->assertText('Test Article - New title');
-    $this->assertText('Body');
-    $this->assertText('Tags');
+    $this->assertSession()->responseContains('Test Article - New title');
+    $this->assertSession()->responseContains('Body');
+    $this->assertSession()->responseContains('Tags');
 
     // Make sure a translated page exists.
     $this->drupalGet('node/8', ['language' => $spanish]);
     // Check for text of two comments.
-    $this->assertText('Hola');
-    $this->assertText('Hello');
+    $this->assertSession()->responseContains('Hola');
+    $this->assertSession()->responseContains('Hello');
     // The user entity reference field is access restricted.
-    $this->assertNoText('Test 12');
+    $this->assertSession()->responseNotContains('Test 12');
     // Make sure all other field labels are there.
     for ($i = 1; $i <= 23; $i++) {
       if ($i != 12) {
-        $this->assertText('Test ' . $i);
+        $this->assertSession()->responseContains('Test ' . $i);
       }
     }
 
     // Make sure the translated slogan appears.
-    $this->assertText('drupal Spanish');
+    $this->assertSession()->responseContains('drupal Spanish');
 
     // Make sure the custom block appears.
     $this->drupalGet('<front>');
     // Block title.
-    $this->assertText('Another block');
+    $this->assertSession()->responseContains('Another block');
     // Block body.
-    $this->assertText('Hello');
+    $this->assertSession()->responseContains('Hello');
 
     // Log in as user 1.
     $account = User::load(1);
@@ -102,78 +102,78 @@ public function testUpdatedSite() {
     // Make sure we can see the access-restricted entity reference field
     // now that we're logged in.
     $this->drupalGet('node/8', ['language' => $spanish]);
-    $this->assertText('Test 12');
+    $this->assertSession()->responseContains('Test 12');
     $this->assertLink('drupal');
 
     // Make sure the content for node 8 is still in the edit form.
     $this->drupalGet('node/8/edit');
-    $this->assertText('Test title');
-    $this->assertText('Test body');
+    $this->assertSession()->responseContains('Test title');
+    $this->assertSession()->responseContains('Test body');
     $this->assertFieldChecked('edit-field-test-1-value');
     $this->assertRaw('2015-08-16');
     $this->assertRaw('test@example.com');
     $this->assertRaw('drupal.org');
-    $this->assertText('0.1');
-    $this->assertText('0.2');
+    $this->assertSession()->responseContains('0.1');
+    $this->assertSession()->responseContains('0.2');
     $this->assertRaw('+31612345678');
     $this->assertRaw('+31612345679');
-    $this->assertText('Test Article - New title');
-    $this->assertText('test.txt');
-    $this->assertText('druplicon.small');
+    $this->assertSession()->responseContains('Test Article - New title');
+    $this->assertSession()->responseContains('test.txt');
+    $this->assertSession()->responseContains('druplicon.small');
     $this->assertRaw('General discussion');
-    $this->assertText('Test Article - New title');
-    $this->assertText('Test 1');
+    $this->assertSession()->responseContains('Test Article - New title');
+    $this->assertSession()->responseContains('Test 1');
     $this->assertRaw('0.01');
     $this->drupalPostForm('node/8/edit', [], 'Save (this translation)');
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet('node/8/edit', ['language' => $spanish]);
-    $this->assertText('Test title Spanish');
-    $this->assertText('Test body Spanish');
+    $this->assertSession()->responseContains('Test title Spanish');
+    $this->assertSession()->responseContains('Test body Spanish');
 
     // Make sure the user page is correct.
     $this->drupalGet('user/3');
-    $this->assertText('usuario_test');
+    $this->assertSession()->responseContains('usuario_test');
     $this->assertRaw('druplicon.small');
-    $this->assertText('Test file field');
+    $this->assertSession()->responseContains('Test file field');
     $this->assertLink('test.txt');
 
     // Make sure the user is translated.
     $this->drupalGet('user/3/translations');
-    $this->assertNoText('Not translated');
+    $this->assertSession()->responseNotContains('Not translated');
 
     // Make sure the custom field on the user is still there.
     $this->drupalGet('admin/config/people/accounts/fields');
-    $this->assertText('Test file field');
+    $this->assertSession()->responseContains('Test file field');
 
     // Make sure the test view still exists.
     $this->drupalGet('admin/structure/views/view/test_view');
-    $this->assertText('Test view');
+    $this->assertSession()->responseContains('Test view');
 
     // Make sure the book node exists.
     $this->drupalGet('admin/structure/book');
     $this->clickLink('Test Article - New title');
-    $this->assertText('Body');
-    $this->assertText('Tags');
+    $this->assertSession()->responseContains('Body');
+    $this->assertSession()->responseContains('Tags');
     $this->assertRaw('Text format');
 
     // Make sure that users still exist.
     $this->drupalGet('admin/people');
-    $this->assertText('usuario_test');
-    $this->assertText('drupal');
+    $this->assertSession()->responseContains('usuario_test');
+    $this->assertSession()->responseContains('drupal');
     $this->drupalGet('user/1/edit');
     $this->assertRaw('drupal@example.com');
 
     // Make sure the content view works.
     $this->drupalGet('admin/content');
-    $this->assertText('Test title');
+    $this->assertSession()->responseContains('Test title');
 
     // Make sure our custom blocks show up.
     $this->drupalGet('admin/structure/block');
-    $this->assertText('Another block');
-    $this->assertText('Test block');
+    $this->assertSession()->responseContains('Another block');
+    $this->assertSession()->responseContains('Test block');
     $this->drupalGet('admin/structure/block/block-content');
-    $this->assertText('Another block');
-    $this->assertText('Test block');
+    $this->assertSession()->responseContains('Another block');
+    $this->assertSession()->responseContains('Test block');
 
     // Make sure our custom visibility conditions are correct.
     $this->drupalGet('admin/structure/block/manage/testblock');
@@ -188,28 +188,28 @@ public function testUpdatedSite() {
 
     // Make sure our custom text format exists.
     $this->drupalGet('admin/config/content/formats');
-    $this->assertText('Test text format');
+    $this->assertSession()->responseContains('Test text format');
     $this->drupalGet('admin/config/content/formats/manage/test_text_format');
     $this->assertSession()->statusCodeEquals(200);
 
     // Make sure our feed still exists.
     $this->drupalGet('admin/config/services/aggregator');
-    $this->assertText('Test feed');
+    $this->assertSession()->responseContains('Test feed');
     $this->drupalGet('admin/config/services/aggregator/fields');
-    $this->assertText('field_test');
+    $this->assertSession()->responseContains('field_test');
 
     // Make sure our view appears in the overview.
     $this->drupalGet('admin/structure/views');
-    $this->assertText('test_view');
-    $this->assertText('Test view');
+    $this->assertSession()->responseContains('test_view');
+    $this->assertSession()->responseContains('Test view');
 
     // Make sure our custom forum exists.
     $this->drupalGet('admin/structure/forum');
-    $this->assertText('Test forum');
+    $this->assertSession()->responseContains('Test forum');
 
     // Make sure our custom menu exists.
     $this->drupalGet('admin/structure/menu');
-    $this->assertText('Test menu');
+    $this->assertSession()->responseContains('Test menu');
 
     // Make sure our custom menu exists.
     $this->drupalGet('admin/structure/menu/manage/test-menu');
@@ -223,15 +223,15 @@ public function testUpdatedSite() {
 
     // Make sure our comment type exists.
     $this->drupalGet('admin/structure/comment');
-    $this->assertText('Test comment type');
+    $this->assertSession()->responseContains('Test comment type');
     $this->drupalGet('admin/structure/comment/manage/test_comment_type/fields');
-    $this->assertText('comment_body');
+    $this->assertSession()->responseContains('comment_body');
 
     // Make sure our contact form exists.
     $this->drupalGet('admin/structure/contact');
-    $this->assertText('Test contact form');
+    $this->assertSession()->responseContains('Test contact form');
     $this->drupalGet('admin/structure/types');
-    $this->assertText('Test content type description');
+    $this->assertSession()->responseContains('Test content type description');
     $this->drupalGet('admin/structure/types/manage/test_content_type/fields');
 
     // Make sure fields are the right type.
@@ -256,40 +256,40 @@ public function testUpdatedSite() {
 
     // Make sure our form mode exists.
     $this->drupalGet('admin/structure/display-modes/form');
-    $this->assertText('New form mode');
+    $this->assertSession()->responseContains('New form mode');
 
     // Make sure our view mode exists.
     $this->drupalGet('admin/structure/display-modes/view');
-    $this->assertText('New view mode');
+    $this->assertSession()->responseContains('New view mode');
     $this->drupalGet('admin/structure/display-modes/view/manage/node.new_view_mode');
     $this->assertSession()->statusCodeEquals(200);
 
     // Make sure our other language is still there.
     $this->drupalGet('admin/config/regional/language');
-    $this->assertText('Spanish');
+    $this->assertSession()->responseContains('Spanish');
 
     // Make sure our custom date format exists.
     $this->drupalGet('admin/config/regional/date-time');
-    $this->assertText('Test date format');
+    $this->assertSession()->responseContains('Test date format');
     $this->drupalGet('admin/config/regional/date-time/formats/manage/test_date_format');
     $this->assertOptionSelected('edit-langcode', 'es');
 
     // Make sure our custom image style exists.
     $this->drupalGet('admin/config/media/image-styles/manage/test_image_style');
-    $this->assertText('Test image style');
-    $this->assertText('Desaturate');
-    $this->assertText('Convert PNG');
+    $this->assertSession()->responseContains('Test image style');
+    $this->assertSession()->responseContains('Desaturate');
+    $this->assertSession()->responseContains('Convert PNG');
 
     // Make sure our custom responsive image style exists.
     $this->drupalGet('admin/config/media/responsive-image-style/test');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('Test');
+    $this->assertSession()->responseContains('Test');
 
     // Make sure our custom shortcut exists.
     $this->drupalGet('admin/config/user-interface/shortcut');
-    $this->assertText('Test shortcut');
+    $this->assertSession()->responseContains('Test shortcut');
     $this->drupalGet('admin/config/user-interface/shortcut/manage/test/customize');
-    $this->assertText('All content');
+    $this->assertSession()->responseContains('All content');
 
     // Make sure our language detection settings are still correct.
     $this->drupalGet('admin/config/regional/language/detection');
@@ -301,27 +301,27 @@ public function testUpdatedSite() {
 
     // Make sure strings are still translated.
     $this->drupalGet('admin/structure/views/view/content/translate/es/edit');
-    $this->assertText('Contenido');
+    $this->assertSession()->responseContains('Contenido');
     $this->drupalPostForm('admin/config/regional/translate', ['string' => 'Full comment'], 'Filter');
-    $this->assertText('Comentario completo');
+    $this->assertSession()->responseContains('Comentario completo');
 
     // Make sure our custom action is still there.
     $this->drupalGet('admin/config/system/actions');
-    $this->assertText('Test action');
+    $this->assertSession()->responseContains('Test action');
     $this->drupalGet('admin/config/system/actions/configure/test_action');
-    $this->assertText('test_action');
+    $this->assertSession()->responseContains('test_action');
     $this->assertRaw('drupal.org');
 
     // Make sure our ban still exists.
     $this->drupalGet('admin/config/people/ban');
-    $this->assertText('8.8.8.8');
+    $this->assertSession()->responseContains('8.8.8.8');
 
     // Make sure our vocabulary exists.
     $this->drupalGet('admin/structure/taxonomy/manage/test_vocabulary/overview');
 
     // Make sure our terms exist.
-    $this->assertText('Test root term');
-    $this->assertText('Test child term');
+    $this->assertSession()->responseContains('Test root term');
+    $this->assertSession()->responseContains('Test child term');
     $this->drupalGet('taxonomy/term/3');
     $this->assertSession()->statusCodeEquals(200);
 
@@ -331,12 +331,12 @@ public function testUpdatedSite() {
 
     // Make sure our contact form exists.
     $this->drupalGet('admin/structure/contact');
-    $this->assertText('Test contact form');
+    $this->assertSession()->responseContains('Test contact form');
     $this->drupalGet('admin/structure/contact/manage/test_contact_form');
-    $this->assertText('test@example.com');
-    $this->assertText('Hello');
+    $this->assertSession()->responseContains('test@example.com');
+    $this->assertSession()->responseContains('Hello');
     $this->drupalGet('admin/structure/contact/manage/test_contact_form/translate/es/edit');
-    $this->assertText('Hola');
+    $this->assertSession()->responseContains('Hola');
     $this->assertRaw('Test contact form Spanish');
 
     // Make sure our modules are still enabled.
diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php
index 8ba22aadb4..a1a850dfca 100644
--- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php
+++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateTest.php
@@ -124,7 +124,7 @@ public function testPostUpdate() {
     $this->drupalGet('update.php/selection');
     $this->updateRequirementsProblem();
     $this->drupalGet('update.php/selection');
-    $this->assertText('No pending updates.');
+    $this->assertSession()->responseContains('No pending updates.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
index 38a6120d8f..09eb2c6f03 100644
--- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
+++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
@@ -130,9 +130,9 @@ public function testRequirements() {
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
     $this->updateRequirementsProblem();
     $this->clickLink(t('Continue'));
-    $this->assertText(t('No pending updates.'), 'End of update process was reached.');
+    $this->assertSession()->responseContains(t('No pending updates.'), 'End of update process was reached.');
     // Confirm that all caches were cleared.
-    $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared when there were no requirements warnings or errors.');
+    $this->assertSession()->responseContains(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared when there were no requirements warnings or errors.');
 
     // If there is a requirements warning, we expect it to be initially
     // displayed, but clicking the link to proceed should allow us to go
@@ -144,34 +144,34 @@ public function testRequirements() {
     $update_script_test_config->set('requirement_type', REQUIREMENT_WARNING)->save();
     drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
-    $this->assertText('This is a requirements warning provided by the update_script_test module.');
+    $this->assertSession()->responseContains('This is a requirements warning provided by the update_script_test module.');
     $this->clickLink('try again');
-    $this->assertNoText('This is a requirements warning provided by the update_script_test module.');
+    $this->assertSession()->responseNotContains('This is a requirements warning provided by the update_script_test module.');
     $this->clickLink(t('Continue'));
     $this->clickLink(t('Apply pending updates'));
     $this->checkForMetaRefresh();
-    $this->assertText(t('The update_script_test_update_8001() update was executed successfully.'), 'End of update process was reached.');
+    $this->assertSession()->responseContains(t('The update_script_test_update_8001() update was executed successfully.'), 'End of update process was reached.');
     // Confirm that all caches were cleared.
-    $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.');
+    $this->assertSession()->responseContains(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.');
 
     // Now try again without pending updates to make sure that works too.
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
-    $this->assertText('This is a requirements warning provided by the update_script_test module.');
+    $this->assertSession()->responseContains('This is a requirements warning provided by the update_script_test module.');
     $this->clickLink('try again');
-    $this->assertNoText('This is a requirements warning provided by the update_script_test module.');
+    $this->assertSession()->responseNotContains('This is a requirements warning provided by the update_script_test module.');
     $this->clickLink(t('Continue'));
-    $this->assertText(t('No pending updates.'), 'End of update process was reached.');
+    $this->assertSession()->responseContains(t('No pending updates.'), 'End of update process was reached.');
     // Confirm that all caches were cleared.
-    $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after applying updates and re-running the script.');
+    $this->assertSession()->responseContains(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after applying updates and re-running the script.');
 
     // If there is a requirements error, it should be displayed even after
     // clicking the link to proceed (since the problem that triggered the error
     // has not been fixed).
     $update_script_test_config->set('requirement_type', REQUIREMENT_ERROR)->save();
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
-    $this->assertText('This is a requirements error provided by the update_script_test module.');
+    $this->assertSession()->responseContains('This is a requirements error provided by the update_script_test module.');
     $this->clickLink('try again');
-    $this->assertText('This is a requirements error provided by the update_script_test module.');
+    $this->assertSession()->responseContains('This is a requirements error provided by the update_script_test module.');
 
     // Ensure that changes to a module's requirements that would cause errors
     // are displayed correctly.
@@ -518,7 +518,7 @@ public function testNoUpdateFunctionality() {
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
     $this->updateRequirementsProblem();
     $this->clickLink(t('Continue'));
-    $this->assertText(t('No pending updates.'));
+    $this->assertSession()->responseContains(t('No pending updates.'));
     $this->assertNoLink('Administration pages');
     $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php']));
     $this->clickLink('Front page');
@@ -530,7 +530,7 @@ public function testNoUpdateFunctionality() {
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
     $this->updateRequirementsProblem();
     $this->clickLink(t('Continue'));
-    $this->assertText(t('No pending updates.'));
+    $this->assertSession()->responseContains(t('No pending updates.'));
     $this->assertLink('Administration pages');
     $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php']));
     $this->clickLink('Administration pages');
@@ -565,7 +565,7 @@ public function testSuccessfulUpdateFunctionality() {
     $this->clickLink(t('Continue'));
     $this->clickLink(t('Apply pending updates'));
     $this->checkForMetaRefresh();
-    $this->assertText('Updates were attempted.');
+    $this->assertSession()->responseContains('Updates were attempted.');
     $this->assertLink('logged');
     $this->assertLink('Administration pages');
     $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php']));
@@ -633,7 +633,7 @@ public function testSuccessfulMultilingualUpdateFunctionality() {
     $this->clickLink(t('Continue'));
     $this->clickLink(t('Apply pending updates'));
     $this->checkForMetaRefresh();
-    $this->assertText('Updates were attempted.');
+    $this->assertSession()->responseContains('Updates were attempted.');
     $this->assertLink('logged');
     $this->assertLink('Administration pages');
     $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php']));
@@ -673,10 +673,10 @@ protected function runUpdates($maintenance_mode) {
     // Click through update.php with 'administer software updates' permission.
     $this->drupalLogin($this->updateUser);
     if ($maintenance_mode) {
-      $this->assertText('Operating in maintenance mode.');
+      $this->assertSession()->responseContains('Operating in maintenance mode.');
     }
     else {
-      $this->assertNoText('Operating in maintenance mode.');
+      $this->assertSession()->responseNotContains('Operating in maintenance mode.');
     }
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
     $this->updateRequirementsProblem();
@@ -685,13 +685,13 @@ protected function runUpdates($maintenance_mode) {
     $this->checkForMetaRefresh();
 
     // Verify that updates were completed successfully.
-    $this->assertText('Updates were attempted.');
+    $this->assertSession()->responseContains('Updates were attempted.');
     $this->assertLink('site');
-    $this->assertText('The update_script_test_update_8001() update was executed successfully.');
+    $this->assertSession()->responseContains('The update_script_test_update_8001() update was executed successfully.');
 
     // Verify that no 7.x updates were run.
-    $this->assertNoText('The update_script_test_update_7200() update was executed successfully.');
-    $this->assertNoText('The update_script_test_update_7201() update was executed successfully.');
+    $this->assertSession()->responseNotContains('The update_script_test_update_7200() update was executed successfully.');
+    $this->assertSession()->responseNotContains('The update_script_test_update_7201() update was executed successfully.');
 
     // Verify that there are no links to different parts of the workflow.
     $this->assertNoLink('Administration pages');
diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php
index 27e721b762..7827de99f9 100644
--- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php
+++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php
@@ -60,7 +60,7 @@ public function testWith7x() {
     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
     $this->updateRequirementsProblem();
     $this->clickLink(t('Continue'));
-    $this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
+    $this->assertSession()->responseContains(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
   }
 
 }
diff --git a/core/modules/system/tests/src/Kernel/Render/ClassyTest.php b/core/modules/system/tests/src/Kernel/Render/ClassyTest.php
index 1eab0f78a7..8fa0e2a99c 100644
--- a/core/modules/system/tests/src/Kernel/Render/ClassyTest.php
+++ b/core/modules/system/tests/src/Kernel/Render/ClassyTest.php
@@ -43,7 +43,7 @@ public function testClassyTheme() {
       '#type' => 'status_messages',
     ];
     $this->render($messages);
-    $this->assertNoText('custom-test-messages-class', 'The custom class attribute value added in the status messages preprocess function is not displayed as page content.');
+    $this->assertSession()->responseNotContains('custom-test-messages-class', 'The custom class attribute value added in the status messages preprocess function is not displayed as page content.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php b/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php
index 40c476f0b5..1c8ee44ca1 100644
--- a/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php
+++ b/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php
@@ -61,8 +61,8 @@ public function testTwigNamespaces() {
     $test = ['#theme' => 'twig_namespace_test'];
     $this->setRawContent(\Drupal::service('renderer')->renderRoot($test));
 
-    $this->assertText('This line is from twig_namespace_a/templates/test.html.twig');
-    $this->assertText('This line is from twig_namespace_b/templates/test.html.twig');
+    $this->assertSession()->responseContains('This line is from twig_namespace_a/templates/test.html.twig');
+    $this->assertSession()->responseContains('This line is from twig_namespace_b/templates/test.html.twig');
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php
index ff60bfbda1..f7a396923e 100644
--- a/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php
@@ -92,7 +92,7 @@ public function testTaxonomyImageAccess() {
     $this->drupalPostForm(NULL, ['field_test[0][alt]' => $this->randomMachineName()], t('Save'));
     $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $edit['name[0][value]']]);
     $term = reset($terms);
-    $this->assertText(t('Created new term @name.', ['@name' => $term->getName()]));
+    $this->assertSession()->responseContains(t('Created new term @name.', ['@name' => $term->getName()]));
 
     // Create a user that should have access to the file and one that doesn't.
     $access_user = $this->drupalCreateUser(['access content']);
diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php
index b4ca5364db..1e4f8b52d0 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php
@@ -158,26 +158,26 @@ public function testTaxonomyTermChildTerms() {
 
     // Get Page 1.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
-    $this->assertText($term1->getName(), 'Parent Term is displayed on Page 1');
+    $this->assertSession()->responseContains($term1->getName(), 'Parent Term is displayed on Page 1');
     for ($x = 1; $x <= 13; $x++) {
-      $this->assertText($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 1');
+      $this->assertSession()->responseContains($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 1');
     }
 
     // Get Page 2.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', ['query' => ['page' => 1]]);
-    $this->assertText($term1->getName(), 'Parent Term is displayed on Page 2');
+    $this->assertSession()->responseContains($term1->getName(), 'Parent Term is displayed on Page 2');
     for ($x = 1; $x <= 18; $x++) {
-      $this->assertText($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 2');
+      $this->assertSession()->responseContains($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 2');
     }
 
     // Get Page 3.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', ['query' => ['page' => 2]]);
-    $this->assertNoText($term1->getName(), 'Parent Term is not displayed on Page 3');
+    $this->assertSession()->responseNotContains($term1->getName(), 'Parent Term is not displayed on Page 3');
     for ($x = 1; $x <= 17; $x++) {
-      $this->assertNoText($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' not found on Page 3');
+      $this->assertSession()->responseNotContains($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' not found on Page 3');
     }
     for ($x = 18; $x <= 25; $x++) {
-      $this->assertText($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 3');
+      $this->assertSession()->responseContains($terms_array[$x]->getName(), $terms_array[$x]->getName() . ' found on Page 3');
     }
   }
 
@@ -201,19 +201,19 @@ public function testTaxonomyNode() {
     // Check that the term is displayed when the node is viewed.
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($term1->getName(), 'Term is displayed when viewing the node.');
+    $this->assertSession()->responseContains($term1->getName(), 'Term is displayed when viewing the node.');
 
     $this->clickLink(t('Edit'));
-    $this->assertText($term1->getName(), 'Term is displayed when editing the node.');
+    $this->assertSession()->responseContains($term1->getName(), 'Term is displayed when editing the node.');
     $this->drupalPostForm(NULL, [], t('Save'));
-    $this->assertText($term1->getName(), 'Term is displayed after saving the node with no changes.');
+    $this->assertSession()->responseContains($term1->getName(), 'Term is displayed after saving the node with no changes.');
 
     // Edit the node with a different term.
     $edit[$this->field->getName() . '[]'] = $term2->id();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
 
     $this->drupalGet('node/' . $node->id());
-    $this->assertText($term2->getName(), 'Term is displayed when viewing the node.');
+    $this->assertSession()->responseContains($term2->getName(), 'Term is displayed when viewing the node.');
 
     // Preview the node.
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
@@ -261,7 +261,7 @@ public function testNodeTermCreationAndDeletion() {
     // Preview and verify the terms appear but are not created.
     $this->drupalPostForm(NULL, $edit, t('Preview'));
     foreach ($terms as $term) {
-      $this->assertText($term, 'The term appears on the node preview.');
+      $this->assertSession()->responseContains($term, 'The term appears on the node preview.');
     }
     $tree = $this->container->get('entity_type.manager')->getStorage('taxonomy_term')->loadTree($this->vocabulary->id());
     $this->assertTrue(empty($tree), 'The terms are not created on preview.');
@@ -271,14 +271,14 @@ public function testNodeTermCreationAndDeletion() {
 
     // Save, creating the terms.
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
-    $this->assertText(t('@type @title has been created.', ['@type' => t('Article'), '@title' => $edit['title[0][value]']]), 'The node was created successfully.');
+    $this->assertSession()->responseContains(t('@type @title has been created.', ['@type' => t('Article'), '@title' => $edit['title[0][value]']]), 'The node was created successfully.');
 
     // Verify that the creation message contains a link to a node.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'node/']);
     $this->assert(isset($view_link), 'The message area contains a link to a node');
 
     foreach ($terms as $term) {
-      $this->assertText($term, 'The term was saved and appears on the node page.');
+      $this->assertSession()->responseContains($term, 'The term was saved and appears on the node page.');
     }
 
     // Get the created terms.
@@ -294,7 +294,7 @@ public function testNodeTermCreationAndDeletion() {
     // Test editing the node.
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     foreach ($terms as $term) {
-      $this->assertText($term, 'The term was retained after edit and still appears on the node page.');
+      $this->assertSession()->responseContains($term, 'The term was retained after edit and still appears on the node page.');
     }
 
     // Delete term 1 from the term edit page.
@@ -310,10 +310,10 @@ public function testNodeTermCreationAndDeletion() {
     $this->drupalGet('node/' . $node->id());
 
     foreach ($term_names as $term_name) {
-      $this->assertText($term_name, new FormattableMarkup('The term %name appears on the node page after two terms, %deleted1 and %deleted2, were deleted.', ['%name' => $term_name, '%deleted1' => $term_objects['term1']->getName(), '%deleted2' => $term_objects['term2']->getName()]));
+      $this->assertSession()->responseContains($term_name, new FormattableMarkup('The term %name appears on the node page after two terms, %deleted1 and %deleted2, were deleted.', ['%name' => $term_name, '%deleted1' => $term_objects['term1']->getName(), '%deleted2' => $term_objects['term2']->getName()]));
     }
-    $this->assertNoText($term_objects['term1']->getName(), new FormattableMarkup('The deleted term %name does not appear on the node page.', ['%name' => $term_objects['term1']->getName()]));
-    $this->assertNoText($term_objects['term2']->getName(), new FormattableMarkup('The deleted term %name does not appear on the node page.', ['%name' => $term_objects['term2']->getName()]));
+    $this->assertSession()->responseNotContains($term_objects['term1']->getName(), new FormattableMarkup('The deleted term %name does not appear on the node page.', ['%name' => $term_objects['term1']->getName()]));
+    $this->assertSession()->responseNotContains($term_objects['term2']->getName(), new FormattableMarkup('The deleted term %name does not appear on the node page.', ['%name' => $term_objects['term2']->getName()]));
   }
 
   /**
@@ -342,7 +342,7 @@ public function testTermInterface() {
     $this->clickLink(t('Edit'));
 
     $this->assertRaw($edit['name[0][value]'], 'The randomly generated term name is present.');
-    $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.');
+    $this->assertSession()->responseContains($edit['description[0][value]'], 'The randomly generated term description is present.');
 
     $edit = [
       'name[0][value]' => $this->randomMachineName(14),
@@ -354,7 +354,7 @@ public function testTermInterface() {
 
     // Check that the term is still present at admin UI after edit.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
-    $this->assertText($edit['name[0][value]'], 'The randomly generated term name is present.');
+    $this->assertSession()->responseContains($edit['name[0][value]'], 'The randomly generated term name is present.');
     $this->assertLink(t('Edit'));
 
     // Check the term link can be clicked through to the term page.
@@ -363,8 +363,8 @@ public function testTermInterface() {
 
     // View the term and check that it is correct.
     $this->drupalGet('taxonomy/term/' . $term->id());
-    $this->assertText($edit['name[0][value]'], 'The randomly generated term name is present.');
-    $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.');
+    $this->assertSession()->responseContains($edit['name[0][value]'], 'The randomly generated term name is present.');
+    $this->assertSession()->responseContains($edit['description[0][value]'], 'The randomly generated term description is present.');
 
     // Did this page request display a 'term-listing-heading'?
     $this->assertSession()->elementExists('xpath', '//div[contains(@class, "field--name-description")]');
diff --git a/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php b/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php
index 78b3b25ead..9af7fbb926 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php
@@ -64,11 +64,11 @@ public function testTranslatedTaxonomyTermReferenceDisplay() {
     $translation_path = $this->translateToLangcode . '/' . $path;
 
     $this->drupalGet($path);
-    $this->assertNoText($this->translatedTagName);
-    $this->assertText($this->baseTagName);
+    $this->assertSession()->responseNotContains($this->translatedTagName);
+    $this->assertSession()->responseContains($this->baseTagName);
     $this->drupalGet($translation_path);
-    $this->assertText($this->translatedTagName);
-    $this->assertNoText($this->baseTagName);
+    $this->assertSession()->responseContains($this->translatedTagName);
+    $this->assertSession()->responseNotContains($this->baseTagName);
   }
 
   /**
diff --git a/core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php b/core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php
index 5e0127248c..9b1c732804 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php
@@ -106,15 +106,15 @@ public function testTermsTranslation() {
 
     // Test terms are listed.
     $this->drupalget('node/add/article');
-    $this->assertText('one');
-    $this->assertText('two');
-    $this->assertText('three');
+    $this->assertSession()->responseContains('one');
+    $this->assertSession()->responseContains('two');
+    $this->assertSession()->responseContains('three');
 
     // Test terms translated are listed.
     $this->drupalget('hu/node/add/article');
-    $this->assertText('translatedOne');
-    $this->assertText('translatedTwo');
-    $this->assertText('translatedThree');
+    $this->assertSession()->responseContains('translatedOne');
+    $this->assertSession()->responseContains('translatedTwo');
+    $this->assertSession()->responseContains('translatedThree');
   }
 
   /**
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
index a136d51669..bc06bfa6d8 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
@@ -53,20 +53,20 @@ public function testViewsHandlerAllTermsWithTokens() {
     $this->drupalGet('taxonomy_all_terms_token_test');
 
     // Term itself: {{ term_node_tid }}
-    $this->assertText('Term: ' . $this->term1->getName());
+    $this->assertSession()->responseContains('Term: ' . $this->term1->getName());
 
     // The taxonomy term ID for the term: {{ term_node_tid__tid }}
-    $this->assertText('The taxonomy term ID for the term: ' . $this->term1->id());
+    $this->assertSession()->responseContains('The taxonomy term ID for the term: ' . $this->term1->id());
 
     // The taxonomy term name for the term: {{ term_node_tid__name }}
-    $this->assertText('The taxonomy term name for the term: ' . $this->term1->getName());
+    $this->assertSession()->responseContains('The taxonomy term name for the term: ' . $this->term1->getName());
 
     // The machine name for the vocabulary the term belongs to: {{ term_node_tid__vocabulary_vid }}
-    $this->assertText('The machine name for the vocabulary the term belongs to: ' . $this->term1->bundle());
+    $this->assertSession()->responseContains('The machine name for the vocabulary the term belongs to: ' . $this->term1->bundle());
 
     // The name for the vocabulary the term belongs to: {{ term_node_tid__vocabulary }}
     $vocabulary = Vocabulary::load($this->term1->bundle());
-    $this->assertText('The name for the vocabulary the term belongs to: ' . $vocabulary->label());
+    $this->assertSession()->responseContains('The name for the vocabulary the term belongs to: ' . $vocabulary->label());
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php
index 91d3d68e88..5cf0815dc0 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php
@@ -46,7 +46,7 @@ protected function setUp($import_test_views = TRUE): void {
    */
   public function testTaxonomyParentUI() {
     $this->drupalGet('admin/structure/views/nojs/handler/test_taxonomy_parent/default/relationship/parent');
-    $this->assertNoText('The handler for this item is broken or missing.');
+    $this->assertSession()->responseNotContains('The handler for this item is broken or missing.');
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
index 56b30fd047..c918ca7d6a 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
@@ -94,8 +94,8 @@ public function testTaxonomyTermView() {
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
 
     $this->drupalGet('taxonomy/term/' . $term->id());
-    $this->assertText($term->label());
-    $this->assertText($node->label());
+    $this->assertSession()->responseContains($term->label());
+    $this->assertSession()->responseContains($node->label());
 
     \Drupal::service('module_installer')->install(['language', 'content_translation']);
     ConfigurableLanguage::createFromLangcode('ur')->save();
@@ -113,14 +113,14 @@ public function testTaxonomyTermView() {
     $this->drupalPostForm('node/' . $node->id() . '/translations/add/en/ur', $edit, t('Save (this translation)'));
 
     $this->drupalGet('taxonomy/term/' . $term->id());
-    $this->assertText($term->label());
-    $this->assertText($original_title);
-    $this->assertNoText($translated_title);
+    $this->assertSession()->responseContains($term->label());
+    $this->assertSession()->responseContains($original_title);
+    $this->assertSession()->responseNotContains($translated_title);
 
     $this->drupalGet('ur/taxonomy/term/' . $term->id());
-    $this->assertText($term->label());
-    $this->assertNoText($original_title);
-    $this->assertText($translated_title);
+    $this->assertSession()->responseContains($term->label());
+    $this->assertSession()->responseNotContains($original_title);
+    $this->assertSession()->responseContains($translated_title);
 
     // Uninstall language module and ensure that the language is not part of the
     // query anymore.
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php
index e9cfe225bb..58204b7afe 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php
@@ -73,9 +73,9 @@ protected function setUp($import_test_views = TRUE): void {
   public function testTermWithVocabularyArgument() {
     $this->drupalGet('test_argument_taxonomy_vocabulary/' . $this->vocabularies[0]->id());
     // First term should be present.
-    $this->assertText($this->terms[0]->label());
+    $this->assertSession()->responseContains($this->terms[0]->label());
     // Second term should not be present.
-    $this->assertNoText($this->terms[1]->label());
+    $this->assertSession()->responseNotContains($this->terms[1]->label());
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
index 85d17a3b15..7ae6f36070 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
@@ -243,7 +243,7 @@ public function testVocabularyPermissionsTaxonomyTerm() {
     $edit['name[0][value]'] = $this->randomMachineName();
 
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('Created new term @name.', ['@name' => $edit['name[0][value]']]), 'Term created successfully.');
+    $this->assertSession()->responseContains(t('Created new term @name.', ['@name' => $edit['name[0][value]']]), 'Term created successfully.');
 
     // Verify that the creation message contains a link to a term.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'term/']);
@@ -257,11 +257,11 @@ public function testVocabularyPermissionsTaxonomyTerm() {
     // Edit the term.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($edit['name[0][value]'], 'Edit taxonomy term form opened successfully.');
+    $this->assertSession()->responseContains($edit['name[0][value]'], 'Edit taxonomy term form opened successfully.');
 
     $edit['name[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('Updated term @name.', ['@name' => $edit['name[0][value]']]), 'Term updated successfully.');
+    $this->assertSession()->responseContains(t('Updated term @name.', ['@name' => $edit['name[0][value]']]), 'Term updated successfully.');
 
     // Delete the vocabulary.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
@@ -314,11 +314,11 @@ public function testVocabularyPermissionsTaxonomyTerm() {
     // Edit the term.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($term->getName(), 'Edit taxonomy term form opened successfully.');
+    $this->assertSession()->responseContains($term->getName(), 'Edit taxonomy term form opened successfully.');
 
     $edit['name[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('Updated term @name.', ['@name' => $edit['name[0][value]']]), 'Term updated successfully.');
+    $this->assertSession()->responseContains(t('Updated term @name.', ['@name' => $edit['name[0][value]']]), 'Term updated successfully.');
 
     // Verify that the update message contains a link to a term.
     $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'term/']);
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
index 50f3afd659..c3be2f758c 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
@@ -51,8 +51,8 @@ public function testVocabularyInterface() {
 
     // Edit the vocabulary.
     $this->drupalGet('admin/structure/taxonomy');
-    $this->assertText($edit['name'], 'Vocabulary name found in the vocabulary overview listing.');
-    $this->assertText($edit['description'], 'Vocabulary description found in the vocabulary overview listing.');
+    $this->assertSession()->responseContains($edit['name'], 'Vocabulary name found in the vocabulary overview listing.');
+    $this->assertSession()->responseContains($edit['description'], 'Vocabulary description found in the vocabulary overview listing.');
     $this->assertLinkByHref(Url::fromRoute('entity.taxonomy_term.add_form', ['taxonomy_vocabulary' => $edit['vid']])->toString());
     $this->clickLink(t('Edit vocabulary'));
     $edit = [];
@@ -60,18 +60,18 @@ public function testVocabularyInterface() {
     $edit['description'] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->drupalGet('admin/structure/taxonomy');
-    $this->assertText($edit['name'], 'Vocabulary name found in the vocabulary overview listing.');
-    $this->assertText($edit['description'], 'Vocabulary description found in the vocabulary overview listing.');
+    $this->assertSession()->responseContains($edit['name'], 'Vocabulary name found in the vocabulary overview listing.');
+    $this->assertSession()->responseContains($edit['description'], 'Vocabulary description found in the vocabulary overview listing.');
 
     // Try to submit a vocabulary with a duplicate machine name.
     $edit['vid'] = $vid;
     $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
-    $this->assertText(t('The machine-readable name is already in use. It must be unique.'));
+    $this->assertSession()->responseContains(t('The machine-readable name is already in use. It must be unique.'));
 
     // Try to submit an invalid machine name.
     $edit['vid'] = '!&^%';
     $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
-    $this->assertText(t('The machine-readable name must contain only lowercase letters, numbers, and underscores.'));
+    $this->assertSession()->responseContains(t('The machine-readable name must contain only lowercase letters, numbers, and underscores.'));
 
     // Ensure that vocabulary titles are escaped properly.
     $edit = [];
@@ -126,7 +126,7 @@ public function testTaxonomyAdminNoVocabularies() {
     $this->assertEmpty(Vocabulary::loadMultiple(), 'No vocabularies found.');
     $this->drupalGet('admin/structure/taxonomy');
     // Check the default message for no vocabularies.
-    $this->assertText(t('No vocabularies available.'));
+    $this->assertSession()->responseContains(t('No vocabularies available.'));
   }
 
   /**
@@ -140,7 +140,7 @@ public function testTaxonomyAdminDeletingVocabulary() {
       'vid' => $vid,
     ];
     $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
-    $this->assertText(t('Created new vocabulary'), 'New vocabulary was created.');
+    $this->assertSession()->responseContains(t('Created new vocabulary'), 'New vocabulary was created.');
 
     // Check the created vocabulary.
     $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache();
@@ -151,7 +151,7 @@ public function testTaxonomyAdminDeletingVocabulary() {
     $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id());
     $this->clickLink(t('Delete'));
     $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', ['%name' => $vocabulary->label()]), '[confirm deletion] Asks for confirmation.');
-    $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.');
+    $this->assertSession()->responseContains(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.');
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Delete'));
diff --git a/core/modules/text/tests/src/Functional/TextFieldTest.php b/core/modules/text/tests/src/Functional/TextFieldTest.php
index 7d2ba628be..72670818a0 100644
--- a/core/modules/text/tests/src/Functional/TextFieldTest.php
+++ b/core/modules/text/tests/src/Functional/TextFieldTest.php
@@ -134,7 +134,7 @@ public function testRequiredLongTextWithFileUpload() {
     $this->drupalPostForm(NULL, $edit, 'Save');
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet('entity_test/1');
-    $this->assertText('Long text');
+    $this->assertSession()->responseContains('Long text');
   }
 
   /**
@@ -207,7 +207,7 @@ public function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
     $id = $match[1];
-    $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
+    $this->assertSession()->responseContains(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created');
 
     // Display the entity.
     $entity = EntityTest::load($id);
@@ -245,7 +245,7 @@ public function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
       "{$field_name}[0][format]" => $format_id,
     ];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
+    $this->assertSession()->responseContains(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
 
     // Display the entity.
     $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
index 4544a97740..adb748655a 100644
--- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
@@ -149,7 +149,7 @@ public function testMenuLinkUpdateSubtreesHashCacheClear() {
     $edit['enabled'] = FALSE;
     $this->drupalPostForm("admin/structure/menu/link/" . $admin_menu_link_id . "/edit", $edit, t('Save'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The menu link has been saved.');
+    $this->assertSession()->responseContains('The menu link has been saved.');
 
     // Assert that the subtrees hash has been altered because the subtrees
     // structure changed.
@@ -199,7 +199,7 @@ public function testUserRoleUpdateSubtreesHashCacheClear() {
 
     // Assign the role to the user.
     $this->drupalPostForm('user/' . $this->adminUser->id() . '/edit', ["roles[$rid]" => $rid], t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
 
     // Assert that the subtrees hash has been altered because the subtrees
     // structure changed.
@@ -240,7 +240,7 @@ public function testNonCurrentUserAccountUpdates() {
 
     // Assign the role to the user.
     $this->drupalPostForm('user/' . $admin_user_id . '/edit', ["roles[$rid]" => $rid], t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
 
     // Log in adminUser and assert that the subtrees hash has changed.
     $this->drupalLogin($this->adminUser);
@@ -284,7 +284,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() {
     // Reset locale cache.
     $this->container->get('string_translation')->reset();
     $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
-    $this->assertText(t($name), 'Test language added.');
+    $this->assertSession()->responseContains(t($name), 'Test language added.');
 
     // Have the adminUser request a page in the new language.
     $this->drupalGet($langcode . '/test-page');
@@ -307,8 +307,8 @@ public function testLocaleTranslationSubtreesHashCacheClear() {
       'translation' => 'untranslated',
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
-    $this->assertNoText(t('No strings available'));
-    $this->assertText($name, 'Search found the string as untranslated.');
+    $this->assertSession()->responseNotContains(t('No strings available'));
+    $this->assertSession()->responseContains($name, 'Search found the string as untranslated.');
 
     // Assume this is the only result.
     // Translate the string to a random string.
@@ -318,7 +318,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() {
       $lid => $translation,
     ];
     $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
-    $this->assertText(t('The strings have been saved.'), 'The strings have been saved.');
+    $this->assertSession()->responseContains(t('The strings have been saved.'), 'The strings have been saved.');
     $this->assertUrl(Url::fromRoute('locale.translate_page', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
     $this->drupalLogout();
 
@@ -400,11 +400,11 @@ public function testExternalLink() {
 
     // Assert that the new menu link is shown on the menu link listing.
     $this->drupalGet('admin/structure/menu/manage/admin');
-    $this->assertText('External URL');
+    $this->assertSession()->responseContains('External URL');
 
     // Assert that the new menu link is shown in the toolbar on a regular page.
     $this->drupalGet(Url::fromRoute('<front>'));
-    $this->assertText('External URL');
+    $this->assertSession()->responseContains('External URL');
     // Ensure the description is escaped as expected.
     $this->assertRaw('title="External URL &amp; escaped"');
   }
diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
index 16c0117274..070ece5f5a 100644
--- a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
@@ -67,7 +67,7 @@ public function testToolbarClasses() {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     // Make sure will be able to translate the menu item.
-    $this->assertNoText('No strings available.', 'Search found the menu item as untranslated.');
+    $this->assertSession()->responseNotContains('No strings available.', 'Search found the menu item as untranslated.');
 
     // Check that the class is on the item before we translate it.
     $xpath = $this->xpath('//a[contains(@class, "icon-system-admin-structure")]');
@@ -90,12 +90,12 @@ public function testToolbarClasses() {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
     // Make sure the menu item string was translated.
-    $this->assertText($menu_item_translated, 'Search found the menu item as translated: ' . $menu_item_translated . '.');
+    $this->assertSession()->responseContains($menu_item_translated, 'Search found the menu item as translated: ' . $menu_item_translated . '.');
 
     // Go to another page in the custom language and make sure the menu item
     // was translated.
     $this->drupalGet($langcode . '/admin/structure');
-    $this->assertText($menu_item_translated, 'Found the menu translated.');
+    $this->assertSession()->responseContains($menu_item_translated, 'Found the menu translated.');
 
     // Toolbar icons are included based on the presence of a specific class on
     // the menu item. Ensure that class also exists for a translated menu item.
diff --git a/core/modules/tour/tests/src/Functional/TourHelpPageTest.php b/core/modules/tour/tests/src/Functional/TourHelpPageTest.php
index f7ceb9d9d3..77f6c97c72 100644
--- a/core/modules/tour/tests/src/Functional/TourHelpPageTest.php
+++ b/core/modules/tour/tests/src/Functional/TourHelpPageTest.php
@@ -71,17 +71,17 @@ protected function verifyHelp($tours_ok = TRUE) {
     $this->drupalGet('admin/help');
 
     // All users should be able to see the module section.
-    $this->assertText('Module overviews are provided by modules');
+    $this->assertSession()->responseContains('Module overviews are provided by modules');
     foreach ($this->getModuleList() as $name) {
       $this->assertLink($name);
     }
 
     // Some users should be able to see the tour section.
     if ($tours_ok) {
-      $this->assertText('Tours guide you through workflows');
+      $this->assertSession()->responseContains('Tours guide you through workflows');
     }
     else {
-      $this->assertNoText('Tours guide you through workflows');
+      $this->assertSession()->responseNotContains('Tours guide you through workflows');
     }
 
     $titles = $this->getTourList();
@@ -105,11 +105,11 @@ protected function verifyHelp($tours_ok = TRUE) {
     // Test the titles that should not be links.
     foreach ($titles[1] as $title) {
       if ($tours_ok) {
-        $this->assertText($title);
+        $this->assertSession()->responseContains($title);
         $this->assertSession()->linkNotExistsExact($title);
       }
       else {
-        $this->assertNoText($title);
+        $this->assertSession()->responseNotContains($title);
         // Just test the first item in the list of text that should not
         // be there, because the second matches part of the name of a module
         // that is in the Module overviews section, so the text will be there
diff --git a/core/modules/tour/tests/src/Functional/TourTest.php b/core/modules/tour/tests/src/Functional/TourTest.php
index 03749a8a66..4956e8d702 100644
--- a/core/modules/tour/tests/src/Functional/TourTest.php
+++ b/core/modules/tour/tests/src/Functional/TourTest.php
@@ -174,7 +174,7 @@ public function testTourFunctionality() {
     $this->assertCount(1, $elements, 'Found code tip was weighted last and had "End tour".');
 
     // Test hook_tour_alter().
-    $this->assertText('Altered by hook_tour_tips_alter');
+    $this->assertSession()->responseContains('Altered by hook_tour_tips_alter');
 
     // Navigate to tour-test-3 and verify the tour_test_1 tip is found with
     // appropriate classes.
diff --git a/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php b/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php
index 1faebc6429..c667b4be02 100644
--- a/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php
+++ b/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php
@@ -66,20 +66,20 @@ public function testTrackerNodeAccess() {
 
     // User with access should see both nodes created.
     $this->drupalGet('activity');
-    $this->assertText($private_node->getTitle(), 'Private node is visible to user with private access.');
-    $this->assertText($public_node->getTitle(), 'Public node is visible to user with private access.');
+    $this->assertSession()->responseContains($private_node->getTitle(), 'Private node is visible to user with private access.');
+    $this->assertSession()->responseContains($public_node->getTitle(), 'Public node is visible to user with private access.');
     $this->drupalGet('user/' . $access_user->id() . '/activity');
-    $this->assertText($private_node->getTitle(), 'Private node is visible to user with private access.');
-    $this->assertText($public_node->getTitle(), 'Public node is visible to user with private access.');
+    $this->assertSession()->responseContains($private_node->getTitle(), 'Private node is visible to user with private access.');
+    $this->assertSession()->responseContains($public_node->getTitle(), 'Public node is visible to user with private access.');
 
     // User without access should not see private node.
     $this->drupalLogin($no_access_user);
     $this->drupalGet('activity');
-    $this->assertNoText($private_node->getTitle(), 'Private node is not visible to user without private access.');
-    $this->assertText($public_node->getTitle(), 'Public node is visible to user without private access.');
+    $this->assertSession()->responseNotContains($private_node->getTitle(), 'Private node is not visible to user without private access.');
+    $this->assertSession()->responseContains($public_node->getTitle(), 'Public node is visible to user without private access.');
     $this->drupalGet('user/' . $access_user->id() . '/activity');
-    $this->assertNoText($private_node->getTitle(), 'Private node is not visible to user without private access.');
-    $this->assertText($public_node->getTitle(), 'Public node is visible to user without private access.');
+    $this->assertSession()->responseNotContains($private_node->getTitle(), 'Private node is not visible to user without private access.');
+    $this->assertSession()->responseContains($public_node->getTitle(), 'Public node is visible to user without private access.');
   }
 
 }
diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php
index 76a44724a9..3b524da30f 100644
--- a/core/modules/tracker/tests/src/Functional/TrackerTest.php
+++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php
@@ -89,8 +89,8 @@ public function testTrackerAll() {
     ]);
 
     $this->drupalGet('activity');
-    $this->assertNoText($unpublished->label(), 'Unpublished node does not show up in the tracker listing.');
-    $this->assertText($published->label(), 'Published node shows up in the tracker listing.');
+    $this->assertSession()->responseNotContains($unpublished->label(), 'Unpublished node does not show up in the tracker listing.');
+    $this->assertSession()->responseContains($published->label(), 'Published node shows up in the tracker listing.');
     $this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
 
     // Assert cache contexts, specifically the pager and node access contexts.
@@ -122,7 +122,7 @@ public function testTrackerAll() {
     // Delete a node and ensure it no longer appears on the tracker.
     $published->delete();
     $this->drupalGet('activity');
-    $this->assertNoText($published->label(), 'Deleted node does not show up in the tracker listing.');
+    $this->assertSession()->responseNotContains($published->label(), 'Deleted node does not show up in the tracker listing.');
 
     // Test proper display of time on activity page when comments are disabled.
     // Disable comments.
@@ -136,8 +136,8 @@ public function testTrackerAll() {
     ]);
 
     $this->drupalGet('activity');
-    $this->assertText($node->label(), 'Published node shows up in the tracker listing.');
-    $this->assertText(\Drupal::service('date.formatter')->formatTimeDiffSince($node->getChangedTime()), 'The changed time was displayed on the tracker listing.');
+    $this->assertSession()->responseContains($node->label(), 'Published node shows up in the tracker listing.');
+    $this->assertSession()->responseContains(\Drupal::service('date.formatter')->formatTimeDiffSince($node->getChangedTime()), 'The changed time was displayed on the tracker listing.');
   }
 
   /**
@@ -173,10 +173,10 @@ public function testTrackerUser() {
     $this->drupalPostForm('comment/reply/node/' . $other_published_my_comment->id() . '/comment', $comment, t('Save'));
 
     $this->drupalGet('user/' . $this->user->id() . '/activity');
-    $this->assertNoText($unpublished->label(), "Unpublished nodes do not show up in the user's tracker listing.");
-    $this->assertText($my_published->label(), "Published nodes show up in the user's tracker listing.");
-    $this->assertNoText($other_published_no_comment->label(), "Another user's nodes do not show up in the user's tracker listing.");
-    $this->assertText($other_published_my_comment->label(), "Nodes that the user has commented on appear in the user's tracker listing.");
+    $this->assertSession()->responseNotContains($unpublished->label(), "Unpublished nodes do not show up in the user's tracker listing.");
+    $this->assertSession()->responseContains($my_published->label(), "Published nodes show up in the user's tracker listing.");
+    $this->assertSession()->responseNotContains($other_published_no_comment->label(), "Another user's nodes do not show up in the user's tracker listing.");
+    $this->assertSession()->responseContains($other_published_my_comment->label(), "Nodes that the user has commented on appear in the user's tracker listing.");
 
     // Assert cache contexts.
     $this->assertCacheContexts(['languages:language_interface', 'route', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.query_args.pagers:0', 'user', 'user.node_grants:view']);
@@ -211,7 +211,7 @@ public function testTrackerUser() {
     $this->assertLink($my_published->label());
     $this->assertNoLink($unpublished->label());
     // Verify that title and tab title have been set correctly.
-    $this->assertText('Activity', 'The user activity tab has the name "Activity".');
+    $this->assertSession()->responseContains('Activity', 'The user activity tab has the name "Activity".');
     $this->assertTitle(t('@name | @site', ['@name' => $this->user->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'The user tracker page has the correct page title.');
 
     // Verify that unpublished comments are removed from the tracker.
@@ -219,7 +219,7 @@ public function testTrackerUser() {
     $this->drupalLogin($admin_user);
     $this->drupalPostForm('comment/1/edit', ['status' => CommentInterface::NOT_PUBLISHED], t('Save'));
     $this->drupalGet('user/' . $this->user->id() . '/activity');
-    $this->assertNoText($other_published_my_comment->label(), 'Unpublished comments are not counted on the tracker listing.');
+    $this->assertSession()->responseNotContains($other_published_my_comment->label(), 'Unpublished comments are not counted on the tracker listing.');
 
     // Test escaping of title on user's tracker tab.
     \Drupal::service('module_installer')->install(['user_hooks_test']);
@@ -400,7 +400,7 @@ public function testTrackerCronIndexing() {
 
     // Assert that all node titles are displayed.
     foreach ($nodes as $i => $node) {
-      $this->assertText($node->label(), new FormattableMarkup('Node @i is displayed on the tracker listing pages.', ['@i' => $i]));
+      $this->assertSession()->responseContains($node->label(), new FormattableMarkup('Node @i is displayed on the tracker listing pages.', ['@i' => $i]));
     }
 
     // Fetch the site-wide tracker.
@@ -408,7 +408,7 @@ public function testTrackerCronIndexing() {
 
     // Assert that all node titles are displayed.
     foreach ($nodes as $i => $node) {
-      $this->assertText($node->label(), new FormattableMarkup('Node @i is displayed on the tracker listing pages.', ['@i' => $i]));
+      $this->assertSession()->responseContains($node->label(), new FormattableMarkup('Node @i is displayed on the tracker listing pages.', ['@i' => $i]));
     }
   }
 
@@ -427,7 +427,7 @@ public function testTrackerAdminUnpublish() {
 
     // Assert that the node is displayed.
     $this->drupalGet('activity');
-    $this->assertText($node->label(), 'A node is displayed on the tracker listing pages.');
+    $this->assertSession()->responseContains($node->label(), 'A node is displayed on the tracker listing pages.');
 
     // Unpublish the node and ensure that it's no longer displayed.
     $edit = [
@@ -437,7 +437,7 @@ public function testTrackerAdminUnpublish() {
     $this->drupalPostForm('admin/content', $edit, t('Apply to selected items'));
 
     $this->drupalGet('activity');
-    $this->assertText(t('No content available.'), 'A node is displayed on the tracker listing pages.');
+    $this->assertSession()->responseContains(t('No content available.'), 'A node is displayed on the tracker listing pages.');
   }
 
   /**
diff --git a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
index 63e5e9d96b..7107f4d210 100644
--- a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
+++ b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php
@@ -48,7 +48,7 @@ public function testViaAuthorize($url) {
 
     // Ensure the module does not already exist.
     $this->drupalGet('admin/modules');
-    $this->assertNoText('Update test new module');
+    $this->assertSession()->responseNotContains('Update test new module');
 
     $edit = [
       'project_url' => $url,
@@ -59,11 +59,11 @@ public function testViaAuthorize($url) {
       'connection_settings[system_test][update_test_username]' => $this->randomMachineName(),
     ];
     $this->drupalPostForm(NULL, $edit, t('Continue'));
-    $this->assertText(t('Installation was completed successfully.'));
+    $this->assertSession()->responseContains(t('Installation was completed successfully.'));
 
     // Ensure the module is available to install.
     $this->drupalGet('admin/modules');
-    $this->assertText('Update test new module');
+    $this->assertSession()->responseContains('Update test new module');
   }
 
   /**
diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php
index 14b2a53eab..947a4b14ce 100644
--- a/core/modules/update/tests/src/Functional/UpdateContribTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php
@@ -70,10 +70,10 @@ public function testNoReleasesAvailable() {
     // 'No available releases found' string.
     $this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
     $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString());
-    $this->assertText(t('Up to date'));
+    $this->assertSession()->responseContains(t('Up to date'));
     $this->assertRaw('<h3>' . t('Modules') . '</h3>');
-    $this->assertNoText(t('Update available'));
-    $this->assertText(t('No available releases found'));
+    $this->assertSession()->responseNotContains(t('Update available'));
+    $this->assertSession()->responseContains(t('No available releases found'));
     $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString());
 
     $available = update_get_available();
@@ -103,9 +103,9 @@ public function testUpdateContribBasic() {
       ]
     );
     $this->standardTests();
-    $this->assertText(t('Up to date'));
+    $this->assertSession()->responseContains(t('Up to date'));
     $this->assertRaw('<h3>' . t('Modules') . '</h3>');
-    $this->assertNoText(t('Update available'));
+    $this->assertSession()->responseNotContains(t('Update available'));
     $this->assertRaw($project_link, 'Link to aaa_update_test project appears.');
 
     // Since aaa_update_test is installed the fact it is hidden and in the
@@ -181,13 +181,13 @@ public function testUpdateContribOrder() {
     $this->refreshUpdateStatus(['drupal' => '0.0', '#all' => '1_0']);
     $this->standardTests();
     // We're expecting the report to say all projects are up to date.
-    $this->assertText(t('Up to date'));
-    $this->assertNoText(t('Update available'));
+    $this->assertSession()->responseContains(t('Up to date'));
+    $this->assertSession()->responseNotContains(t('Update available'));
     // We want to see all 3 module names listed, since they'll show up either
     // as project names or as modules under the "Includes" listing.
-    $this->assertText(t('AAA Update test'));
-    $this->assertText(t('BBB Update test'));
-    $this->assertText(t('CCC Update test'));
+    $this->assertSession()->responseContains(t('AAA Update test'));
+    $this->assertSession()->responseContains(t('BBB Update test'));
+    $this->assertSession()->responseContains(t('CCC Update test'));
     // We want aaa_update_test included in the ccc_update_test project, not as
     // its own project on the report.
     $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project does not appear.');
@@ -239,7 +239,7 @@ public function testUpdateBaseThemeSecurityUpdate() {
       'update_test_basetheme' => '1_1-sec',
     ];
     $this->refreshUpdateStatus($xml_mapping);
-    $this->assertText(t('Security update required!'));
+    $this->assertSession()->responseContains(t('Security update required!'));
     $this->assertRaw(Link::fromTextAndUrl(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'))->toString(), 'Link to the Update test base theme project appears.');
   }
 
@@ -393,14 +393,14 @@ public function testUpdateShowDisabledThemes() {
       $this->refreshUpdateStatus($xml_mapping);
       // In neither case should we see the "Themes" heading for installed
       // themes.
-      $this->assertNoText(t('Themes'));
+      $this->assertSession()->responseNotContains(t('Themes'));
       if ($check_disabled) {
-        $this->assertText(t('Uninstalled themes'));
+        $this->assertSession()->responseContains(t('Uninstalled themes'));
         $this->assertRaw($base_theme_project_link, 'Link to the Update test base theme project appears.');
         $this->assertRaw($sub_theme_project_link, 'Link to the Update test subtheme project appears.');
       }
       else {
-        $this->assertNoText(t('Uninstalled themes'));
+        $this->assertSession()->responseNotContains(t('Uninstalled themes'));
         $this->assertNoRaw($base_theme_project_link, 'Link to the Update test base theme project does not appear.');
         $this->assertNoRaw($sub_theme_project_link, 'Link to the Update test subtheme project does not appear.');
       }
@@ -475,12 +475,12 @@ public function testUpdateBrokenFetchURL() {
     ];
     $this->refreshUpdateStatus($xml_mapping);
 
-    $this->assertText(t('Up to date'));
+    $this->assertSession()->responseContains(t('Up to date'));
     // We're expecting the report to say most projects are up to date, so we
     // hope that 'Up to date' is not unique.
     $this->assertNoUniqueText(t('Up to date'));
     // It should say we failed to get data, not that we're missing an update.
-    $this->assertNoText(t('Update available'));
+    $this->assertSession()->responseNotContains(t('Update available'));
 
     // We need to check that this string is found as part of a project row, not
     // just in the "Failed to get available update data" message at the top of
@@ -535,7 +535,7 @@ public function testHookUpdateStatusAlter() {
     );
     $this->drupalGet('admin/reports/updates');
     $this->assertRaw('<h3>' . t('Modules') . '</h3>');
-    $this->assertText(t('Security update required!'));
+    $this->assertSession()->responseContains(t('Security update required!'));
     $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project appears.');
 
     // Visit the reports page again without the altering and make sure the
@@ -543,18 +543,18 @@ public function testHookUpdateStatusAlter() {
     $update_test_config->set('update_status', [])->save();
     $this->drupalGet('admin/reports/updates');
     $this->assertRaw('<h3>' . t('Modules') . '</h3>');
-    $this->assertNoText(t('Security update required!'));
+    $this->assertSession()->responseNotContains(t('Security update required!'));
     $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project appears.');
 
     // Turn the altering back on and visit the Update manager UI.
     $update_test_config->set('update_status', $update_status)->save();
     $this->drupalGet('admin/modules/update');
-    $this->assertText(t('Security update'));
+    $this->assertSession()->responseContains(t('Security update'));
 
     // Turn the altering back off and visit the Update manager UI.
     $update_test_config->set('update_status', [])->save();
     $this->drupalGet('admin/modules/update');
-    $this->assertNoText(t('Security update'));
+    $this->assertSession()->responseNotContains(t('Security update'));
   }
 
   /**
diff --git a/core/modules/update/tests/src/Functional/UpdateCoreTest.php b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
index 8d60257aad..6d709f4fd1 100644
--- a/core/modules/update/tests/src/Functional/UpdateCoreTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
@@ -81,9 +81,9 @@ public function testNoUpdatesAvailable() {
           // release but because '8.2.0' is not in a supported branch it will
           // not be in the available updates.
           $this->assertNoRaw('8.2.0');
-          $this->assertText(t('Up to date'));
-          $this->assertNoText(t('Update available'));
-          $this->assertNoText(t('Security update required!'));
+          $this->assertSession()->responseContains(t('Up to date'));
+          $this->assertSession()->responseNotContains(t('Update available'));
+          $this->assertSession()->responseNotContains(t('Security update required!'));
           $this->assertRaw('check.svg', 'Check icon was found.');
         }
       }
@@ -108,7 +108,7 @@ public function testNormalUpdateAvailable() {
         $this->drupalGet('admin/reports/updates');
         $this->clickLink(t('Check manually'));
         $this->checkForMetaRefresh();
-        $this->assertNoText(t('Security update required!'));
+        $this->assertSession()->responseNotContains(t('Security update required!'));
         // The XML test fixtures for this method all contain the '8.2.0' release
         // but because '8.2.0' is not in a supported branch it will not be in
         // the available updates.
@@ -118,18 +118,18 @@ public function testNormalUpdateAvailable() {
             // Both stable and unstable releases are available.
             // A stable release is the latest.
             if ($extra_version == '') {
-              $this->assertNoText(t('Up to date'));
-              $this->assertText(t('Update available'));
+              $this->assertSession()->responseNotContains(t('Up to date'));
+              $this->assertSession()->responseContains(t('Update available'));
               $this->assertVersionUpdateLinks('Recommended version:', $full_version);
-              $this->assertNoText(t('Latest version:'));
+              $this->assertSession()->responseNotContains(t('Latest version:'));
               $this->assertRaw('warning.svg', 'Warning icon was found.');
             }
             // Only unstable releases are available.
             // An unstable release is the latest.
             else {
-              $this->assertText(t('Up to date'));
-              $this->assertNoText(t('Update available'));
-              $this->assertNoText(t('Recommended version:'));
+              $this->assertSession()->responseContains(t('Up to date'));
+              $this->assertSession()->responseNotContains(t('Update available'));
+              $this->assertSession()->responseNotContains(t('Recommended version:'));
               $this->assertVersionUpdateLinks('Latest version:', $full_version);
               $this->assertRaw('check.svg', 'Check icon was found.');
             }
@@ -138,17 +138,17 @@ public function testNormalUpdateAvailable() {
             // Both stable and unstable releases are available.
             // A stable release is the latest.
             if ($extra_version == '') {
-              $this->assertNoText(t('Up to date'));
-              $this->assertText(t('Update available'));
+              $this->assertSession()->responseNotContains(t('Up to date'));
+              $this->assertSession()->responseContains(t('Update available'));
               $this->assertVersionUpdateLinks('Recommended version:', $full_version);
-              $this->assertNoText(t('Latest version:'));
+              $this->assertSession()->responseNotContains(t('Latest version:'));
               $this->assertRaw('warning.svg', 'Warning icon was found.');
             }
             // Both stable and unstable releases are available.
             // An unstable release is the latest.
             else {
-              $this->assertNoText(t('Up to date'));
-              $this->assertText(t('Update available'));
+              $this->assertSession()->responseNotContains(t('Up to date'));
+              $this->assertSession()->responseContains(t('Update available'));
               $this->assertVersionUpdateLinks('Recommended version:', '8.1.0');
               $this->assertVersionUpdateLinks('Latest version:', $full_version);
               $this->assertRaw('warning.svg', 'Warning icon was found.');
@@ -172,14 +172,14 @@ public function testMajorUpdateAvailable() {
           $this->drupalGet('admin/reports/updates');
           $this->clickLink(t('Check manually'));
           $this->checkForMetaRefresh();
-          $this->assertNoText(t('Security update required!'));
+          $this->assertSession()->responseNotContains(t('Security update required!'));
           $this->assertRaw(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString(), 'Link to release appears.');
           $this->assertRaw(Link::fromTextAndUrl(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz"))->toString(), 'Link to download appears.');
           $this->assertRaw(Link::fromTextAndUrl(t('Release notes'), Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString(), 'Link to release notes appears.');
-          $this->assertNoText(t('Up to date'));
-          $this->assertText(t('Not supported!'));
-          $this->assertText(t('Recommended version:'));
-          $this->assertNoText(t('Latest version:'));
+          $this->assertSession()->responseNotContains(t('Up to date'));
+          $this->assertSession()->responseContains(t('Not supported!'));
+          $this->assertSession()->responseContains(t('Recommended version:'));
+          $this->assertSession()->responseNotContains(t('Latest version:'));
           $this->assertRaw('error.svg', 'Error icon was found.');
         }
       }
@@ -631,10 +631,10 @@ public function testDatestampMismatch() {
     ];
     $this->config('update_test.settings')->set('system_info', $system_info)->save();
     $this->refreshUpdateStatus(['drupal' => 'dev']);
-    $this->assertNoText(t('2001-Sep-'));
-    $this->assertText(t('Up to date'));
-    $this->assertNoText(t('Update available'));
-    $this->assertNoText(t('Security update required!'));
+    $this->assertSession()->responseNotContains(t('2001-Sep-'));
+    $this->assertSession()->responseContains(t('Up to date'));
+    $this->assertSession()->responseNotContains(t('Update available'));
+    $this->assertSession()->responseNotContains(t('Security update required!'));
   }
 
   /**
@@ -651,7 +651,7 @@ public function testModulePageRunCron() {
 
     $this->cronRun();
     $this->drupalGet('admin/modules');
-    $this->assertNoText(t('No update information available.'));
+    $this->assertSession()->responseNotContains(t('No update information available.'));
   }
 
   /**
@@ -687,10 +687,10 @@ public function testModulePageUpToDate() {
     $this->drupalGet('admin/reports/updates');
     $this->clickLink(t('Check manually'));
     $this->checkForMetaRefresh();
-    $this->assertText(t('Checked available update data for one project.'));
+    $this->assertSession()->responseContains(t('Checked available update data for one project.'));
     $this->drupalGet('admin/modules');
-    $this->assertNoText(t('There are updates available for your version of Drupal.'));
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There are updates available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
   }
 
   /**
@@ -709,10 +709,10 @@ public function testModulePageRegularUpdate() {
     $this->drupalGet('admin/reports/updates');
     $this->clickLink(t('Check manually'));
     $this->checkForMetaRefresh();
-    $this->assertText(t('Checked available update data for one project.'));
+    $this->assertSession()->responseContains(t('Checked available update data for one project.'));
     $this->drupalGet('admin/modules');
-    $this->assertText(t('There are updates available for your version of Drupal.'));
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseContains(t('There are updates available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
   }
 
   /**
@@ -731,15 +731,15 @@ public function testModulePageSecurityUpdate() {
     $this->drupalGet('admin/reports/updates');
     $this->clickLink(t('Check manually'));
     $this->checkForMetaRefresh();
-    $this->assertText(t('Checked available update data for one project.'));
+    $this->assertSession()->responseContains(t('Checked available update data for one project.'));
     $this->drupalGet('admin/modules');
-    $this->assertNoText(t('There are updates available for your version of Drupal.'));
-    $this->assertText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There are updates available for your version of Drupal.'));
+    $this->assertSession()->responseContains(t('There is a security update available for your version of Drupal.'));
 
     // Make sure admin/appearance warns you you're missing a security update.
     $this->drupalGet('admin/appearance');
-    $this->assertNoText(t('There are updates available for your version of Drupal.'));
-    $this->assertText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There are updates available for your version of Drupal.'));
+    $this->assertSession()->responseContains(t('There is a security update available for your version of Drupal.'));
 
     // Make sure duplicate messages don't appear on Update status pages.
     $this->drupalGet('admin/reports/status');
@@ -750,10 +750,10 @@ public function testModulePageSecurityUpdate() {
     $this->assertNoRaw('<li>' . t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/reports/updates');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/reports/updates/settings');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
   }
 
   /**
@@ -762,7 +762,7 @@ public function testModulePageSecurityUpdate() {
   public function testServiceUnavailable() {
     $this->refreshUpdateStatus([], '503-error');
     // Ensure that no "Warning: SimpleXMLElement..." parse errors are found.
-    $this->assertNoText('SimpleXMLElement');
+    $this->assertSession()->responseNotContains('SimpleXMLElement');
     $this->assertUniqueText(t('Failed to get available update data for one project.'));
   }
 
@@ -806,7 +806,7 @@ public function testLanguageModuleUpdate() {
       ->save();
 
     $this->drupalGet('admin/reports/updates');
-    $this->assertText(t('Language'));
+    $this->assertSession()->responseContains(t('Language'));
   }
 
   /**
diff --git a/core/modules/update/tests/src/Functional/UpdateTestBase.php b/core/modules/update/tests/src/Functional/UpdateTestBase.php
index 80f5b2496c..d1800bcea1 100644
--- a/core/modules/update/tests/src/Functional/UpdateTestBase.php
+++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php
@@ -108,7 +108,7 @@ protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
   protected function standardTests() {
     $this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
     $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString(), 'Link to the Drupal project appears.');
-    $this->assertNoText(t('No available releases found'));
+    $this->assertSession()->responseNotContains(t('No available releases found'));
   }
 
   /**
diff --git a/core/modules/update/tests/src/Functional/UpdateUploadTest.php b/core/modules/update/tests/src/Functional/UpdateUploadTest.php
index bf61745493..ae83cefa87 100644
--- a/core/modules/update/tests/src/Functional/UpdateUploadTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateUploadTest.php
@@ -66,7 +66,7 @@ public function testUploadModule() {
       'files[project_upload]' => $validArchiveFile,
     ];
     $this->drupalPostForm('admin/modules/install', $edit, t('Install'));
-    $this->assertText(t('@module_name is already installed.', ['@module_name' => 'AAA Update test']), 'Existing module was extracted and not reinstalled.');
+    $this->assertSession()->responseContains(t('@module_name is already installed.', ['@module_name' => 'AAA Update test']), 'Existing module was extracted and not reinstalled.');
     $this->assertUrl('admin/modules/install');
 
     // Ensure that a new module can be extracted and installed.
@@ -128,7 +128,7 @@ public function testUploadModule() {
     // Run the updates for the new module.
     $this->drupalPostForm('admin/reports/updates/update', ['projects[update_test_new_module]' => TRUE], t('Download these updates'));
     $this->drupalPostForm(NULL, ['maintenance_mode' => FALSE], t('Continue'));
-    $this->assertText(t('Update was completed successfully.'));
+    $this->assertSession()->responseContains(t('Update was completed successfully.'));
     $this->assertRaw(t('Installed %project_name successfully', ['%project_name' => 'update_test_new_module']));
 
     // Parse the info file again to check that the module has been updated to
@@ -171,25 +171,25 @@ public function testUpdateManagerCoreSecurityUpdateMessages() {
     // about core missing a security update.
 
     $this->drupalGet('admin/modules/install');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/modules/update');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/appearance/install');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/appearance/update');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/reports/updates/install');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/reports/updates/update');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
 
     $this->drupalGet('admin/update/ready');
-    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+    $this->assertSession()->responseNotContains(t('There is a security update available for your version of Drupal.'));
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/UserAdminLanguageTest.php b/core/modules/user/tests/src/Functional/UserAdminLanguageTest.php
index ece02e140e..fc64fafdbf 100644
--- a/core/modules/user/tests/src/Functional/UserAdminLanguageTest.php
+++ b/core/modules/user/tests/src/Functional/UserAdminLanguageTest.php
@@ -125,9 +125,9 @@ public function testActualNegotiation() {
     // no preference set, negotiation will fall back further.
     $path = 'user/' . $this->adminUser->id() . '/edit';
     $this->drupalGet($path);
-    $this->assertText('Language negotiation method: language-default');
+    $this->assertSession()->responseContains('Language negotiation method: language-default');
     $this->drupalGet('xx/' . $path);
-    $this->assertText('Language negotiation method: language-url');
+    $this->assertSession()->responseContains('Language negotiation method: language-url');
 
     // Set a preferred language code for the user.
     $edit = [];
@@ -137,26 +137,26 @@ public function testActualNegotiation() {
     // Test negotiation with the URL method first. The admin method will only
     // be used if the URL method did not match.
     $this->drupalGet($path);
-    $this->assertText('Language negotiation method: language-user-admin');
+    $this->assertSession()->responseContains('Language negotiation method: language-user-admin');
     $this->drupalGet('xx/' . $path);
-    $this->assertText('Language negotiation method: language-url');
+    $this->assertSession()->responseContains('Language negotiation method: language-url');
 
     // Test negotiation with the admin language method first. The admin method
     // will be used at all times.
     $this->setLanguageNegotiation(TRUE);
     $this->drupalGet($path);
-    $this->assertText('Language negotiation method: language-user-admin');
+    $this->assertSession()->responseContains('Language negotiation method: language-user-admin');
     $this->drupalGet('xx/' . $path);
-    $this->assertText('Language negotiation method: language-user-admin');
+    $this->assertSession()->responseContains('Language negotiation method: language-user-admin');
 
     // Unset the preferred language code for the user.
     $edit = [];
     $edit['preferred_admin_langcode'] = '';
     $this->drupalPostForm($path, $edit, t('Save'));
     $this->drupalGet($path);
-    $this->assertText('Language negotiation method: language-default');
+    $this->assertSession()->responseContains('Language negotiation method: language-default');
     $this->drupalGet('xx/' . $path);
-    $this->assertText('Language negotiation method: language-url');
+    $this->assertSession()->responseContains('Language negotiation method: language-url');
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php
index a428bac8c8..d4b345d1ed 100644
--- a/core/modules/user/tests/src/Functional/UserAdminTest.php
+++ b/core/modules/user/tests/src/Functional/UserAdminTest.php
@@ -56,10 +56,10 @@ public function testUserAdmin() {
     $admin_user->save();
     $this->drupalLogin($admin_user);
     $this->drupalGet('admin/people');
-    $this->assertText($user_a->getAccountName(), 'Found user A on admin users page');
-    $this->assertText($user_b->getAccountName(), 'Found user B on admin users page');
-    $this->assertText($user_c->getAccountName(), 'Found user C on admin users page');
-    $this->assertText($admin_user->getAccountName(), 'Found Admin user on admin users page');
+    $this->assertSession()->responseContains($user_a->getAccountName(), 'Found user A on admin users page');
+    $this->assertSession()->responseContains($user_b->getAccountName(), 'Found user B on admin users page');
+    $this->assertSession()->responseContains($user_c->getAccountName(), 'Found user C on admin users page');
+    $this->assertSession()->responseContains($admin_user->getAccountName(), 'Found Admin user on admin users page');
 
     // Test for existence of edit link in table.
     $link = $user_a->toLink(t('Edit'), 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString();
@@ -88,9 +88,9 @@ public function testUserAdmin() {
     $this->drupalGet('admin/people', ['query' => ['permission' => 'administer taxonomy']]);
 
     // Check if the correct users show up.
-    $this->assertNoText($user_a->getAccountName(), 'User A not on filtered by perm admin users page');
-    $this->assertText($user_b->getAccountName(), 'Found user B on filtered by perm admin users page');
-    $this->assertText($user_c->getAccountName(), 'Found user C on filtered by perm admin users page');
+    $this->assertSession()->responseNotContains($user_a->getAccountName(), 'User A not on filtered by perm admin users page');
+    $this->assertSession()->responseContains($user_b->getAccountName(), 'Found user B on filtered by perm admin users page');
+    $this->assertSession()->responseContains($user_c->getAccountName(), 'Found user C on filtered by perm admin users page');
 
     // Filter the users by role. Grab the system-generated role name for User C.
     $roles = $user_c->getRoles();
@@ -98,9 +98,9 @@ public function testUserAdmin() {
     $this->drupalGet('admin/people', ['query' => ['role' => reset($roles)]]);
 
     // Check if the correct users show up when filtered by role.
-    $this->assertNoText($user_a->getAccountName(), 'User A not on filtered by role on admin users page');
-    $this->assertNoText($user_b->getAccountName(), 'User B not on filtered by role on admin users page');
-    $this->assertText($user_c->getAccountName(), 'User C on filtered by role on admin users page');
+    $this->assertSession()->responseNotContains($user_a->getAccountName(), 'User A not on filtered by role on admin users page');
+    $this->assertSession()->responseNotContains($user_b->getAccountName(), 'User B not on filtered by role on admin users page');
+    $this->assertSession()->responseContains($user_c->getAccountName(), 'User C on filtered by role on admin users page');
 
     // Test blocking of a user.
     $account = $user_storage->load($user_c->id());
@@ -124,9 +124,9 @@ public function testUserAdmin() {
 
     // Test filtering on admin page for blocked users
     $this->drupalGet('admin/people', ['query' => ['status' => 2]]);
-    $this->assertNoText($user_a->getAccountName(), 'User A not on filtered by status on admin users page');
-    $this->assertNoText($user_b->getAccountName(), 'User B not on filtered by status on admin users page');
-    $this->assertText($user_c->getAccountName(), 'User C on filtered by status on admin users page');
+    $this->assertSession()->responseNotContains($user_a->getAccountName(), 'User A not on filtered by status on admin users page');
+    $this->assertSession()->responseNotContains($user_b->getAccountName(), 'User B not on filtered by status on admin users page');
+    $this->assertSession()->responseContains($user_c->getAccountName(), 'User C on filtered by status on admin users page');
 
     // Test unblocking of a user from /admin/people page and sending of activation mail
     $editunblock = [];
diff --git a/core/modules/user/tests/src/Functional/UserBlocksTest.php b/core/modules/user/tests/src/Functional/UserBlocksTest.php
index 0030612d84..482b214fdd 100644
--- a/core/modules/user/tests/src/Functional/UserBlocksTest.php
+++ b/core/modules/user/tests/src/Functional/UserBlocksTest.php
@@ -77,7 +77,7 @@ public function testUserLoginBlock() {
     $edit['name'] = $user->getAccountName();
     $edit['pass'] = $user->passRaw;
     $this->drupalPostForm('admin/people/permissions', $edit, t('Log in'));
-    $this->assertNoText(t('User login'), 'Logged in.');
+    $this->assertSession()->responseNotContains(t('User login'), 'Logged in.');
 
     // Check that we are still on the same page.
     $this->assertUrl(Url::fromRoute('user.admin_permissions', [], ['absolute' => TRUE])->toString(), [], 'Still on the same page after login for access denied page');
@@ -87,7 +87,7 @@ public function testUserLoginBlock() {
     $this->drupalGet('filter/tips');
     $this->assertEqual('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
     $this->drupalPostForm(NULL, $edit, t('Log in'));
-    $this->assertNoText(t('User login'), 'Logged in.');
+    $this->assertSession()->responseNotContains(t('User login'), 'Logged in.');
     $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', 'Still on the same page after login for allowed page');
 
     // Log out again and repeat with a non-403 page including query arguments.
@@ -95,7 +95,7 @@ public function testUserLoginBlock() {
     $this->drupalGet('filter/tips', ['query' => ['foo' => 'bar']]);
     $this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
     $this->drupalPostForm(NULL, $edit, t('Log in'));
-    $this->assertNoText(t('User login'), 'Logged in.');
+    $this->assertSession()->responseNotContains(t('User login'), 'Logged in.');
     $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', 'Still on the same page after login for allowed page');
     $this->assertStringContainsString('/filter/tips?foo=bar', $this->getUrl(), 'Correct query arguments are displayed after login');
 
@@ -104,7 +104,7 @@ public function testUserLoginBlock() {
     $this->drupalGet('filter/tips', ['query' => ['foo' => 'baz']]);
     $this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
     $this->drupalPostForm(NULL, $edit, t('Log in'));
-    $this->assertNoText(t('User login'), 'Logged in.');
+    $this->assertSession()->responseNotContains(t('User login'), 'Logged in.');
     $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', 'Still on the same page after login for allowed page');
     $this->assertStringContainsString('/filter/tips?foo=baz', $this->getUrl(), 'Correct query arguments are displayed after login');
 
@@ -122,9 +122,9 @@ public function testUserLoginBlock() {
     $edit['name'] = 'foo';
     $edit['pass'] = 'invalid password';
     $this->drupalPostForm('filter/tips', $edit, t('Log in'));
-    $this->assertText(t('Unrecognized username or password. Forgot your password?'));
+    $this->assertSession()->responseContains(t('Unrecognized username or password. Forgot your password?'));
     $this->drupalGet('filter/tips');
-    $this->assertNoText(t('Unrecognized username or password. Forgot your password?'));
+    $this->assertSession()->responseNotContains(t('Unrecognized username or password. Forgot your password?'));
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php
index 8b67a1c890..c5cb587072 100644
--- a/core/modules/user/tests/src/Functional/UserCancelTest.php
+++ b/core/modules/user/tests/src/Functional/UserCancelTest.php
@@ -145,12 +145,12 @@ public function testUserCancelInvalid() {
     // Confirm account cancellation.
     $timestamp = time();
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
 
     // Attempt bogus account cancellation request confirmation.
     $bogus_timestamp = $timestamp + 60;
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account, $bogus_timestamp));
-    $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Bogus cancelling request rejected.');
+    $this->assertSession()->responseContains(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Bogus cancelling request rejected.');
     $user_storage->resetCache([$account->id()]);
     $account = $user_storage->load($account->id());
     $this->assertTrue($account->isActive(), 'User account was not canceled.');
@@ -158,7 +158,7 @@ public function testUserCancelInvalid() {
     // Attempt expired account cancellation request confirmation.
     $bogus_timestamp = $timestamp - 86400 - 60;
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account, $bogus_timestamp));
-    $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Expired cancel account request rejected.');
+    $this->assertSession()->responseContains(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Expired cancel account request rejected.');
     $user_storage->resetCache([$account->id()]);
     $account = $user_storage->load($account->id());
     $this->assertTrue($account->isActive(), 'User account was not canceled.');
@@ -187,15 +187,15 @@ public function testUserBlock() {
     // Attempt to cancel account.
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
-    $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your username.'), 'Informs that all content will be remain as is.');
-    $this->assertNoText(t('Select the method to cancel the account above.'), 'Does not allow user to select account cancellation method.');
+    $this->assertSession()->responseContains(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
+    $this->assertSession()->responseContains(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your username.'), 'Informs that all content will be remain as is.');
+    $this->assertSession()->responseNotContains(t('Select the method to cancel the account above.'), 'Does not allow user to select account cancellation method.');
 
     // Confirm account cancellation.
     $timestamp = time();
 
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp));
@@ -247,13 +247,13 @@ public function testUserBlockUnpublish() {
     // Attempt to cancel account.
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
-    $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), 'Informs that all content will be unpublished.');
+    $this->assertSession()->responseContains(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
+    $this->assertSession()->responseContains(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), 'Informs that all content will be unpublished.');
 
     // Confirm account cancellation.
     $timestamp = time();
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp));
@@ -327,13 +327,13 @@ public function testUserAnonymize() {
     // Attempt to cancel account.
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
+    $this->assertSession()->responseContains(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')]), 'Informs that all content will be attributed to anonymous account.');
 
     // Confirm account cancellation.
     $timestamp = time();
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp));
@@ -387,13 +387,13 @@ public function testUserAnonymizeBatch() {
     // Attempt to cancel account.
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
+    $this->assertSession()->responseContains(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')]), 'Informs that all content will be attributed to anonymous account.');
 
     // Confirm account cancellation.
     $timestamp = time();
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp));
@@ -436,7 +436,7 @@ public function testUserDelete() {
 
     $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $edit, t('Preview'));
     $this->drupalPostForm(NULL, [], t('Save'));
-    $this->assertText(t('Your comment has been posted.'));
+    $this->assertSession()->responseContains(t('Your comment has been posted.'));
     $comments = \Drupal::entityTypeManager()->getStorage('comment')->loadByProperties(['subject' => $edit['subject[0][value]']]);
     $comment = reset($comments);
     $this->assertNotEmpty($comment->id(), 'Comment found.');
@@ -454,13 +454,13 @@ public function testUserDelete() {
     // Attempt to cancel account.
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
-    $this->assertText(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), 'Informs that all content will be deleted.');
+    $this->assertSession()->responseContains(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
+    $this->assertSession()->responseContains(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), 'Informs that all content will be deleted.');
 
     // Confirm account cancellation.
     $timestamp = time();
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
     $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp));
@@ -497,7 +497,7 @@ public function testUserCancelByAdmin() {
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()]), 'Confirmation form to cancel account displayed.');
-    $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
+    $this->assertSession()->responseContains(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
@@ -525,7 +525,7 @@ public function testUserWithoutEmailCancelByAdmin() {
     $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()]), 'Confirmation form to cancel account displayed.');
-    $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
+    $this->assertSession()->responseContains(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Cancel account'));
@@ -562,10 +562,10 @@ public function testMassUserCancelByAdmin() {
       $edit['user_bulk_form[' . $i . ']'] = TRUE;
     }
     $this->drupalPostForm('admin/people', $edit, t('Apply to selected items'));
-    $this->assertText(t('Are you sure you want to cancel these user accounts?'), 'Confirmation form to cancel accounts displayed.');
-    $this->assertText(t('When cancelling these accounts'), 'Allows to select account cancellation method.');
-    $this->assertText(t('Require email confirmation to cancel account'), 'Allows to send confirmation mail.');
-    $this->assertText(t('Notify user when account is canceled'), 'Allows to send notification mail.');
+    $this->assertSession()->responseContains(t('Are you sure you want to cancel these user accounts?'), 'Confirmation form to cancel accounts displayed.');
+    $this->assertSession()->responseContains(t('When cancelling these accounts'), 'Allows to select account cancellation method.');
+    $this->assertSession()->responseContains(t('Require email confirmation to cancel account'), 'Allows to send confirmation mail.');
+    $this->assertSession()->responseContains(t('Notify user when account is canceled'), 'Allows to send notification mail.');
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Cancel accounts'));
@@ -578,7 +578,7 @@ public function testMassUserCancelByAdmin() {
     $this->assertTrue($status, 'Users deleted and not found in the database.');
 
     // Ensure that admin account was not cancelled.
-    $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
+    $this->assertSession()->responseContains(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.');
     $admin_user = $user_storage->load($admin_user->id());
     $this->assertTrue($admin_user->isActive(), 'Administrative user is found in the database and enabled.');
 
diff --git a/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php b/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php
index 915b82a23d..143f25428e 100644
--- a/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php
+++ b/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php
@@ -43,8 +43,8 @@ public function testUserAdd() {
     ];
     $this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
 
-    $this->assertText(t('Unable to send email. Contact the site administrator if the problem persists.'));
-    $this->assertNoText(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]));
+    $this->assertSession()->responseContains(t('Unable to send email. Contact the site administrator if the problem persists.'));
+    $this->assertSession()->responseNotContains(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]));
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php
index fef1a53b05..b1f6e5c661 100644
--- a/core/modules/user/tests/src/Functional/UserCreateTest.php
+++ b/core/modules/user/tests/src/Functional/UserCreateTest.php
@@ -108,16 +108,16 @@ public function testUserAdd() {
       $this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
 
       if ($notify) {
-        $this->assertText(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]), 'User created');
+        $this->assertSession()->responseContains(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]), 'User created');
         $this->assertCount(1, $this->drupalGetMails(), 'Notification email sent');
       }
       else {
-        $this->assertText(t('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]), 'User created');
+        $this->assertSession()->responseContains(t('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]), 'User created');
         $this->assertCount(0, $this->drupalGetMails(), 'Notification email not sent');
       }
 
       $this->drupalGet('admin/people');
-      $this->assertText($edit['name'], 'User found in list of users');
+      $this->assertSession()->responseContains($edit['name'], 'User found in list of users');
       $user = user_load_by_name($name);
       $this->assertTrue($user->isActive(), 'User is not blocked');
     }
@@ -133,8 +133,8 @@ public function testUserAdd() {
       'notify' => FALSE,
     ];
     $this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
-    $this->assertText("Created a new user account for $name. No email has been sent");
-    $this->assertNoText('Password field is required');
+    $this->assertSession()->responseContains("Created a new user account for $name. No email has been sent");
+    $this->assertSession()->responseNotContains('Password field is required');
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/UserEditTest.php b/core/modules/user/tests/src/Functional/UserEditTest.php
index 6a71927a96..ae433eafd3 100644
--- a/core/modules/user/tests/src/Functional/UserEditTest.php
+++ b/core/modules/user/tests/src/Functional/UserEditTest.php
@@ -49,12 +49,12 @@ public function testUserEdit() {
     $edit['pass[pass1]'] = '';
     $edit['pass[pass2]'] = $this->randomMachineName();
     $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
-    $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
+    $this->assertSession()->responseContains(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
     $edit['pass[pass1]'] = $this->randomMachineName();
     $edit['pass[pass2]'] = '';
     $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
-    $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
+    $this->assertSession()->responseContains(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
     // Test that the error message appears when attempting to change the mail or
     // pass without the current password.
@@ -111,13 +111,13 @@ public function testUserEdit() {
 
     $edit = ['status' => 0];
     $this->drupalPostForm('user/' . $user1->id() . '/edit', $edit, t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
     $this->assertFieldChecked('edit-status-0');
     $this->assertNoFieldChecked('edit-status-1');
 
     $edit = ['status' => 1];
     $this->drupalPostForm('user/' . $user1->id() . '/edit', $edit, t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-status-0');
     $this->assertFieldChecked('edit-status-1');
   }
diff --git a/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php b/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php
index 1f385ab92f..1595010a84 100644
--- a/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php
+++ b/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php
@@ -42,7 +42,7 @@ public function testLocalUserCreation() {
       'language_interface[enabled][language-url]' => TRUE,
     ];
     $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
-    $this->assertText(t('Language detection configuration saved.'), 'Set language negotiation.');
+    $this->assertSession()->responseContains(t('Language detection configuration saved.'), 'Set language negotiation.');
 
     // Check if the language selector is available on admin/people/create and
     // set to the currently active language.
diff --git a/core/modules/user/tests/src/Functional/UserLanguageTest.php b/core/modules/user/tests/src/Functional/UserLanguageTest.php
index f2c7ef61ed..b2656335d9 100644
--- a/core/modules/user/tests/src/Functional/UserLanguageTest.php
+++ b/core/modules/user/tests/src/Functional/UserLanguageTest.php
@@ -53,16 +53,16 @@ public function testUserLanguageConfiguration() {
     $path = 'user/' . $web_user->id() . '/edit';
     $this->drupalGet($path);
     // Ensure language settings widget is available.
-    $this->assertText(t('Language'), 'Language selector available.');
+    $this->assertSession()->responseContains(t('Language'), 'Language selector available.');
     // Ensure custom language is present.
-    $this->assertText($name, 'Language present on form.');
+    $this->assertSession()->responseContains($name, 'Language present on form.');
     // Switch to our custom language.
     $edit = [
       'preferred_langcode' => $langcode,
     ];
     $this->drupalPostForm($path, $edit, t('Save'));
     // Ensure form was submitted successfully.
-    $this->assertText(t('The changes have been saved.'), 'Changes were saved.');
+    $this->assertSession()->responseContains(t('The changes have been saved.'), 'Changes were saved.');
     // Check if language was changed.
     $this->assertOptionSelected('edit-preferred-langcode', $langcode, 'Default language successfully updated.');
 
diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php
index e067915867..422459af6e 100644
--- a/core/modules/user/tests/src/Functional/UserLoginTest.php
+++ b/core/modules/user/tests/src/Functional/UserLoginTest.php
@@ -177,7 +177,7 @@ public function assertFailedLogin($account, $flood_trigger = NULL) {
       }
     }
     else {
-      $this->assertText(t('Unrecognized username or password. Forgot your password?'));
+      $this->assertSession()->responseContains(t('Unrecognized username or password. Forgot your password?'));
     }
   }
 
diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
index af9611f164..d9fff59392 100644
--- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
+++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
@@ -103,8 +103,8 @@ public function testUserPasswordReset() {
     $this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
 
     // Check the one-time login page.
-    $this->assertText($this->account->getAccountName(), 'One-time login page contains the correct username.');
-    $this->assertText(t('This login can be used only once.'), 'Found warning about one-time login.');
+    $this->assertSession()->responseContains($this->account->getAccountName(), 'One-time login page contains the correct username.');
+    $this->assertSession()->responseContains(t('This login can be used only once.'), 'Found warning about one-time login.');
     $this->assertTitle(t('Reset password | Drupal'), 'Page title is "Reset password".');
 
     // Check successful login.
@@ -116,17 +116,17 @@ public function testUserPasswordReset() {
     $password = user_password();
     $edit = ['pass[pass1]' => $password, 'pass[pass2]' => $password];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('The changes have been saved.'), 'Forgotten password changed.');
+    $this->assertSession()->responseContains(t('The changes have been saved.'), 'Forgotten password changed.');
 
     // Verify that the password reset session has been destroyed.
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t("Your current password is missing or incorrect; it's required to change the Password."), 'Password needed to make profile changes.');
+    $this->assertSession()->responseContains(t("Your current password is missing or incorrect; it's required to change the Password."), 'Password needed to make profile changes.');
 
     // Log out, and try to log in again using the same one-time link.
     $this->drupalLogout();
     $this->drupalGet($resetURL);
     $this->drupalPostForm(NULL, NULL, t('Log in'));
-    $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.');
+    $this->assertSession()->responseContains(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.');
 
     // Request a new password again, this time using the email address.
     // Count email messages before to compare with after.
@@ -143,7 +143,7 @@ public function testUserPasswordReset() {
     $this->drupalGet($resetURL);
     $this->drupalPostForm(NULL, NULL, t('Log in'));
     $this->drupalGet('user/' . $this->account->id() . '/edit');
-    $this->assertNoText('Expected user_string to be a string, NULL given');
+    $this->assertSession()->responseNotContains('Expected user_string to be a string, NULL given');
     $this->drupalLogout();
 
     // Create a password reset link as if the request time was 60 seconds older than the allowed limit.
@@ -152,7 +152,7 @@ public function testUserPasswordReset() {
     $_uid = $this->account->id();
     $this->drupalGet("user/reset/$_uid/$bogus_timestamp/" . user_pass_rehash($this->account, $bogus_timestamp));
     $this->drupalPostForm(NULL, NULL, t('Log in'));
-    $this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.');
+    $this->assertSession()->responseContains(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.');
 
     // Create a user, block the account, and verify that a login link is denied.
     $timestamp = REQUEST_TIME - 1;
@@ -179,7 +179,7 @@ public function testUserPasswordReset() {
     $this->account->save();
     $this->drupalGet($old_email_reset_link);
     $this->drupalPostForm(NULL, NULL, t('Log in'));
-    $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.');
+    $this->assertSession()->responseContains(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.');
 
     // Verify a password reset link will automatically log a user when /login is
     // appended.
@@ -239,7 +239,7 @@ public function testUserPasswordResetLoggedIn() {
 
     $another_account->delete();
     $this->drupalGet($resetURL);
-    $this->assertText('The one-time login link you clicked is invalid.');
+    $this->assertSession()->responseContains('The one-time login link you clicked is invalid.');
 
     // Log in.
     $this->drupalLogin($this->account);
@@ -257,7 +257,7 @@ public function testUserPasswordResetLoggedIn() {
     $password = user_password();
     $edit = ['pass[pass1]' => $password, 'pass[pass2]' => $password];
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertText(t('The changes have been saved.'), 'Password changed.');
+    $this->assertSession()->responseContains(t('The changes have been saved.'), 'Password changed.');
 
     // Logged in users should not be able to access the user.reset.login or the
     // user.reset.form routes.
@@ -375,7 +375,7 @@ public function testUserResetPasswordUserFloodControlIsCleared() {
    */
   public function assertValidPasswordReset($name) {
     // Make sure the error text is not displayed and email sent.
-    $this->assertNoText(t('Sorry, @name is not recognized as a username or an e-mail address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.');
+    $this->assertSession()->responseNotContains(t('Sorry, @name is not recognized as a username or an e-mail address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.');
     $this->assertMail('to', $this->account->getEmail(), 'Password e-mail sent to user.');
     $subject = t('Replacement login information for @username at @site', ['@username' => $this->account->getAccountName(), '@site' => \Drupal::config('system.site')->get('name')]);
     $this->assertMail('subject', $subject, 'Password reset e-mail subject is correct.');
@@ -386,7 +386,7 @@ public function assertValidPasswordReset($name) {
    */
   public function assertNoValidPasswordReset($name) {
     // Make sure the error text is displayed and no email sent.
-    $this->assertText(t('@name is not recognized as a username or an email address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.');
+    $this->assertSession()->responseContains(t('@name is not recognized as a username or an email address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.');
     $this->assertCount(0, $this->drupalGetMails(['id' => 'user_password_reset']), 'No e-mail was sent when requesting a password for an invalid account.');
   }
 
@@ -394,28 +394,28 @@ public function assertNoValidPasswordReset($name) {
    * Helper function to make assertions about a password reset triggering user flood cotrol.
    */
   public function assertPasswordUserFlood() {
-    $this->assertText(t('Too many password recovery requests for this account. It is temporarily blocked. Try again later or contact the site administrator.'), 'User password reset flood error message shown.');
+    $this->assertSession()->responseContains(t('Too many password recovery requests for this account. It is temporarily blocked. Try again later or contact the site administrator.'), 'User password reset flood error message shown.');
   }
 
   /**
    * Helper function to make assertions about a password reset not triggering user flood control.
    */
   public function assertNoPasswordUserFlood() {
-    $this->assertNoText(t('Too many password recovery requests for this account. It is temporarily blocked. Try again later or contact the site administrator.'), 'User password reset flood error message not shown.');
+    $this->assertSession()->responseNotContains(t('Too many password recovery requests for this account. It is temporarily blocked. Try again later or contact the site administrator.'), 'User password reset flood error message not shown.');
   }
 
   /**
    * Helper function to make assertions about a password reset triggering IP flood cotrol.
    */
   public function assertPasswordIpFlood() {
-    $this->assertText(t('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'), 'IP password reset flood error message shown.');
+    $this->assertSession()->responseContains(t('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'), 'IP password reset flood error message shown.');
   }
 
   /**
    * Helper function to make assertions about a password reset not triggering IP flood control.
    */
   public function assertNoPasswordIpFlood() {
-    $this->assertNoText(t('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'), 'IP password reset flood error message not shown.');
+    $this->assertSession()->responseNotContains(t('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'), 'IP password reset flood error message not shown.');
   }
 
   /**
@@ -453,9 +453,9 @@ public function testResetImpersonation() {
     $attack_reset_url = str_replace("user/reset/{$user1->id()}", "user/reset/{$user2->id()}", $reset_url);
     $this->drupalGet($attack_reset_url);
     $this->drupalPostForm(NULL, NULL, t('Log in'));
-    $this->assertNoText($user2->getAccountName(), 'The invalid password reset page does not show the user name.');
+    $this->assertSession()->responseNotContains($user2->getAccountName(), 'The invalid password reset page does not show the user name.');
     $this->assertUrl('user/password', [], 'The user is redirected to the password reset request page.');
-    $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.');
+    $this->assertSession()->responseContains('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.');
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/UserPermissionsTest.php b/core/modules/user/tests/src/Functional/UserPermissionsTest.php
index ea246a8171..5fbfcd9f71 100644
--- a/core/modules/user/tests/src/Functional/UserPermissionsTest.php
+++ b/core/modules/user/tests/src/Functional/UserPermissionsTest.php
@@ -67,7 +67,7 @@ public function testUserPermissionChanges() {
     $edit = [];
     $edit[$rid . '[administer users]'] = TRUE;
     $this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions'));
-    $this->assertText(t('The changes have been saved.'), 'Successful save message displayed.');
+    $this->assertSession()->responseContains(t('The changes have been saved.'), 'Successful save message displayed.');
     $storage->resetCache();
     $this->assertTrue($account->hasPermission('administer users'), 'User now has "administer users" permission.');
     $current_permissions_hash = $permissions_hash_generator->generate($account);
@@ -80,7 +80,7 @@ public function testUserPermissionChanges() {
     $edit = [];
     $edit[$rid . '[access user profiles]'] = FALSE;
     $this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions'));
-    $this->assertText(t('The changes have been saved.'), 'Successful save message displayed.');
+    $this->assertSession()->responseContains(t('The changes have been saved.'), 'Successful save message displayed.');
     $storage->resetCache();
     $this->assertFalse($account->hasPermission('access user profiles'), 'User no longer has "access user profiles" permission.');
     $current_permissions_hash = $permissions_hash_generator->generate($account);
diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php
index fece43d6a4..6fe17dd5aa 100644
--- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php
+++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php
@@ -46,7 +46,7 @@ public function testRegistrationWithEmailVerification() {
     $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
-    $this->assertText(t('A welcome message with further instructions has been sent to your email address.'), 'User registered successfully.');
+    $this->assertSession()->responseContains(t('A welcome message with further instructions has been sent to your email address.'), 'User registered successfully.');
 
     /** @var EntityStorageInterface $storage */
     $storage = $this->container->get('entity_type.manager')->getStorage('user');
@@ -86,7 +86,7 @@ public function testRegistrationWithoutEmailVerification() {
     $edit['pass[pass1]'] = '99999.0';
     $edit['pass[pass2]'] = '99999';
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
-    $this->assertText(t('The specified passwords do not match.'), 'Typing mismatched passwords displays an error message.');
+    $this->assertSession()->responseContains(t('The specified passwords do not match.'), 'Typing mismatched passwords displays an error message.');
 
     // Enter a correct password.
     $edit['pass[pass1]'] = $new_pass = $this->randomMachineName();
@@ -97,7 +97,7 @@ public function testRegistrationWithoutEmailVerification() {
       ->loadByProperties(['name' => $name, 'mail' => $mail]);
     $new_user = reset($accounts);
     $this->assertNotNull($new_user, 'New account successfully created with matching passwords.');
-    $this->assertText(t('Registration successful. You are now logged in.'), 'Users are logged in after registering.');
+    $this->assertSession()->responseContains(t('Registration successful. You are now logged in.'), 'Users are logged in after registering.');
     $this->drupalLogout();
 
     // Allow registration by site visitors, but require administrator approval.
@@ -108,7 +108,7 @@ public function testRegistrationWithoutEmailVerification() {
     $edit['pass[pass1]'] = $pass = $this->randomMachineName();
     $edit['pass[pass2]'] = $pass;
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
-    $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');
+    $this->assertSession()->responseContains(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');
 
     // Try to log in before administrator approval.
     $auth = [
@@ -116,7 +116,7 @@ public function testRegistrationWithoutEmailVerification() {
       'pass' => $pass,
     ];
     $this->drupalPostForm('user/login', $auth, t('Log in'));
-    $this->assertText(t('The username @name has not been activated or is blocked.', ['@name' => $name]), 'User cannot log in yet.');
+    $this->assertSession()->responseContains(t('The username @name has not been activated or is blocked.', ['@name' => $name]), 'User cannot log in yet.');
 
     // Activate the new account.
     $accounts = $this->container->get('entity_type.manager')->getStorage('user')
@@ -132,7 +132,7 @@ public function testRegistrationWithoutEmailVerification() {
 
     // Log in after administrator approval.
     $this->drupalPostForm('user/login', $auth, t('Log in'));
-    $this->assertText(t('Member for'), 'User can log in after administrator approval.');
+    $this->assertSession()->responseContains(t('Member for'), 'User can log in after administrator approval.');
   }
 
   public function testRegistrationEmailDuplicates() {
@@ -152,13 +152,13 @@ public function testRegistrationEmailDuplicates() {
 
     // Attempt to create a new account using an existing email address.
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
-    $this->assertText(t('The email address @email is already taken.', ['@email' => $duplicate_user->getEmail()]), 'Supplying an exact duplicate email address displays an error message');
+    $this->assertSession()->responseContains(t('The email address @email is already taken.', ['@email' => $duplicate_user->getEmail()]), 'Supplying an exact duplicate email address displays an error message');
 
     // Attempt to bypass duplicate email registration validation by adding spaces.
     $edit['mail'] = '   ' . $duplicate_user->getEmail() . '   ';
 
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
-    $this->assertText(t('The email address @email is already taken.', ['@email' => $duplicate_user->getEmail()]), 'Supplying a duplicate email address with added whitespace displays an error message');
+    $this->assertSession()->responseContains(t('The email address @email is already taken.', ['@email' => $duplicate_user->getEmail()]), 'Supplying a duplicate email address with added whitespace displays an error message');
   }
 
   /**
@@ -318,7 +318,7 @@ public function testRegistrationWithUserFields() {
 
     // Check that the field does not appear on the registration form.
     $this->drupalGet('user/register');
-    $this->assertNoText($field->label(), 'The field does not appear on user registration form');
+    $this->assertSession()->responseNotContains($field->label(), 'The field does not appear on user registration form');
     $this->assertCacheTag('config:core.entity_form_display.user.user.register');
     $this->assertCacheTag('config:user.settings');
 
@@ -328,7 +328,7 @@ public function testRegistrationWithUserFields() {
       ->save();
 
     $this->drupalGet('user/register');
-    $this->assertText($field->label(), 'The field appears on user registration form');
+    $this->assertSession()->responseContains($field->label(), 'The field appears on user registration form');
     $this->assertRegistrationFormCacheTagsWithUserFields();
 
     // Check that validation errors are correctly reported.
diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
index 8e11fd19b5..1ce7bb72d9 100644
--- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
+++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
@@ -94,10 +94,10 @@ public function testRoleAdministration() {
     // interface.
     $this->drupalGet('admin/people/roles/manage/' . RoleInterface::ANONYMOUS_ID);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText(t('Delete role'), 'Delete button for the anonymous role is not present.');
+    $this->assertSession()->responseNotContains(t('Delete role'), 'Delete button for the anonymous role is not present.');
     $this->drupalGet('admin/people/roles/manage/' . RoleInterface::AUTHENTICATED_ID);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoText(t('Delete role'), 'Delete button for the authenticated role is not present.');
+    $this->assertSession()->responseNotContains(t('Delete role'), 'Delete button for the authenticated role is not present.');
   }
 
   /**
@@ -119,7 +119,7 @@ public function testRoleWeightOrdering() {
       $weight--;
     }
     $this->drupalPostForm('admin/people/roles', $edit, t('Save'));
-    $this->assertText(t('The role settings have been updated.'), 'The role settings form submitted successfully.');
+    $this->assertSession()->responseContains(t('The role settings have been updated.'), 'The role settings form submitted successfully.');
 
     // Load up the user roles with the new weights.
     $roles = user_roles();
diff --git a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php
index b31580e9a9..da47de6a12 100644
--- a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php
+++ b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php
@@ -32,13 +32,13 @@ public function testAssignAndRemoveRole() {
 
     // Assign the role to the user.
     $this->drupalPostForm('user/' . $account->id() . '/edit', ["roles[$rid]" => $rid], t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
     $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
     $this->userLoadAndCheckRoleAssigned($account, $rid);
 
     // Remove the role from the user.
     $this->drupalPostForm('user/' . $account->id() . '/edit', ["roles[$rid]" => FALSE], t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
   }
@@ -58,7 +58,7 @@ public function testCreateUserWithRole() {
       "roles[$rid]" => $rid,
     ];
     $this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
-    $this->assertText(t('Created a new user account for @name.', ['@name' => $edit['name']]));
+    $this->assertSession()->responseContains(t('Created a new user account for @name.', ['@name' => $edit['name']]));
     // Get the newly added user.
     $account = user_load_by_name($edit['name']);
 
@@ -68,7 +68,7 @@ public function testCreateUserWithRole() {
 
     // Remove the role again.
     $this->drupalPostForm('user/' . $account->id() . '/edit', ["roles[$rid]" => FALSE], t('Save'));
-    $this->assertText(t('The changes have been saved.'));
+    $this->assertSession()->responseContains(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
   }
diff --git a/core/modules/user/tests/src/Functional/UserSearchTest.php b/core/modules/user/tests/src/Functional/UserSearchTest.php
index 539112e916..65a262b1f8 100644
--- a/core/modules/user/tests/src/Functional/UserSearchTest.php
+++ b/core/modules/user/tests/src/Functional/UserSearchTest.php
@@ -33,14 +33,14 @@ public function testUserSearch() {
     $keys = $user1->getEmail();
     $edit = ['keys' => $keys];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText(t('Your search yielded no results.'), 'Search by email did not work for non-admin user');
-    $this->assertText('no results', 'Search by email gave no-match message');
+    $this->assertSession()->responseContains(t('Your search yielded no results.'), 'Search by email did not work for non-admin user');
+    $this->assertSession()->responseContains('no results', 'Search by email gave no-match message');
 
     // Verify that a non-matching query gives an appropriate message.
     $keys = 'nomatch';
     $edit = ['keys' => $keys];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText('no results', 'Non-matching search gave appropriate message');
+    $this->assertSession()->responseContains('no results', 'Non-matching search gave appropriate message');
 
     // Verify that a user with search permission can search for users by name.
     $keys = $user1->getAccountName();
@@ -67,28 +67,28 @@ public function testUserSearch() {
     $keys = $user2->getEmail();
     $edit = ['keys' => $keys];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText($keys, 'Search by email works for administrative user');
-    $this->assertText($user2->getAccountName(), 'Search by email resulted in username on page for administrative user');
+    $this->assertSession()->responseContains($keys, 'Search by email works for administrative user');
+    $this->assertSession()->responseContains($user2->getAccountName(), 'Search by email resulted in username on page for administrative user');
 
     // Verify that a substring works too for email.
     $subkey = substr($keys, 1, 5);
     $edit = ['keys' => $subkey];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText($keys, 'Search by email substring works for administrative user');
-    $this->assertText($user2->getAccountName(), 'Search by email substring resulted in username on page for administrative user');
+    $this->assertSession()->responseContains($keys, 'Search by email substring works for administrative user');
+    $this->assertSession()->responseContains($user2->getAccountName(), 'Search by email substring resulted in username on page for administrative user');
 
     // Verify that wildcard search works for email
     $subkey = substr($keys, 0, 2) . '*' . substr($keys, 4, 2);
     $edit = ['keys' => $subkey];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText($user2->getAccountName(), 'Search for email wildcard resulted in username on page for administrative user');
+    $this->assertSession()->responseContains($user2->getAccountName(), 'Search for email wildcard resulted in username on page for administrative user');
 
     // Verify that if they search by user name, they see email address too.
     $keys = $user1->getAccountName();
     $edit = ['keys' => $keys];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText($keys, 'Search by username works for admin user');
-    $this->assertText($user1->getEmail(), 'Search by username for admin shows email address too');
+    $this->assertSession()->responseContains($keys, 'Search by username works for admin user');
+    $this->assertSession()->responseContains($user1->getEmail(), 'Search by username for admin shows email address too');
 
     // Create a blocked user.
     $blocked_user = $this->drupalCreateUser();
@@ -99,14 +99,14 @@ public function testUserSearch() {
     // accounts in search results.
     $edit = ['keys' => $blocked_user->getAccountName()];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText($blocked_user->getAccountName(), 'Blocked users are listed on the user search results for users with the "administer users" permission.');
+    $this->assertSession()->responseContains($blocked_user->getAccountName(), 'Blocked users are listed on the user search results for users with the "administer users" permission.');
 
     // Verify that users without "administer users" permissions do not see
     // blocked accounts in search results.
     $this->drupalLogin($user1);
     $edit = ['keys' => $blocked_user->getAccountName()];
     $this->drupalPostForm('search/user', $edit, t('Search'));
-    $this->assertText(t('Your search yielded no results.'), 'Blocked users are hidden from the user search results.');
+    $this->assertSession()->responseContains(t('Your search yielded no results.'), 'Blocked users are hidden from the user search results.');
 
     // Ensure that a user without access to user profiles cannot access the
     // user search page.
diff --git a/core/modules/user/tests/src/Functional/UserTimeZoneTest.php b/core/modules/user/tests/src/Functional/UserTimeZoneTest.php
index e5fb9ad2e0..5e4576c5b1 100644
--- a/core/modules/user/tests/src/Functional/UserTimeZoneTest.php
+++ b/core/modules/user/tests/src/Functional/UserTimeZoneTest.php
@@ -61,40 +61,40 @@ public function testUserTimeZone() {
 
     // Confirm date format and time zone.
     $this->drupalGet('node/' . $node1->id());
-    $this->assertText('2007-03-09 21:00 0', 'Date should be PST.');
+    $this->assertSession()->responseContains('2007-03-09 21:00 0', 'Date should be PST.');
     $this->drupalGet('node/' . $node2->id());
-    $this->assertText('2007-03-11 01:00 0', 'Date should be PST.');
+    $this->assertSession()->responseContains('2007-03-11 01:00 0', 'Date should be PST.');
     $this->drupalGet('node/' . $node3->id());
-    $this->assertText('2007-03-20 21:00 1', 'Date should be PDT.');
+    $this->assertSession()->responseContains('2007-03-20 21:00 1', 'Date should be PDT.');
 
     // Change user time zone to Santiago time.
     $edit = [];
     $edit['mail'] = $web_user->getEmail();
     $edit['timezone'] = 'America/Santiago';
     $this->drupalPostForm("user/" . $web_user->id() . "/edit", $edit, t('Save'));
-    $this->assertText(t('The changes have been saved.'), 'Time zone changed to Santiago time.');
+    $this->assertSession()->responseContains(t('The changes have been saved.'), 'Time zone changed to Santiago time.');
 
     // Confirm date format and time zone.
     $this->drupalGet('node/' . $node1->id());
-    $this->assertText('2007-03-10 02:00 1', 'Date should be Chile summer time; five hours ahead of PST.');
+    $this->assertSession()->responseContains('2007-03-10 02:00 1', 'Date should be Chile summer time; five hours ahead of PST.');
     $this->drupalGet('node/' . $node2->id());
-    $this->assertText('2007-03-11 05:00 0', 'Date should be Chile time; four hours ahead of PST');
+    $this->assertSession()->responseContains('2007-03-11 05:00 0', 'Date should be Chile time; four hours ahead of PST');
     $this->drupalGet('node/' . $node3->id());
-    $this->assertText('2007-03-21 00:00 0', 'Date should be Chile time; three hours ahead of PDT.');
+    $this->assertSession()->responseContains('2007-03-21 00:00 0', 'Date should be Chile time; three hours ahead of PDT.');
 
     // Ensure that anonymous users also use the default timezone.
     $this->drupalLogout();
     $this->drupalGet('node/' . $node1->id());
-    $this->assertText('2007-03-09 21:00 0', 'Date should be PST.');
+    $this->assertSession()->responseContains('2007-03-09 21:00 0', 'Date should be PST.');
     $this->drupalGet('node/' . $node2->id());
-    $this->assertText('2007-03-11 01:00 0', 'Date should be PST.');
+    $this->assertSession()->responseContains('2007-03-11 01:00 0', 'Date should be PST.');
     $this->drupalGet('node/' . $node3->id());
-    $this->assertText('2007-03-20 21:00 1', 'Date should be PDT.');
+    $this->assertSession()->responseContains('2007-03-20 21:00 1', 'Date should be PDT.');
 
     // Format a date without accessing the current user at all and
     // ensure that it uses the default timezone.
     $this->drupalGet('/system-test/date');
-    $this->assertText('2016-01-13 08:29 0', 'Date should be PST.');
+    $this->assertSession()->responseContains('2016-01-13 08:29 0', 'Date should be PST.');
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php
index 44045ba93a..f3ba50b7ea 100644
--- a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php
+++ b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php
@@ -52,7 +52,7 @@ public function testBulkForm() {
       'action' => 'user_block_user_action',
     ];
     $this->drupalPostForm('test-user-bulk-form', $edit, t('Apply to selected items'));
-    $this->assertText(t('No users selected.'));
+    $this->assertSession()->responseContains(t('No users selected.'));
 
     // Assign a role to a user.
     $account = $user_storage->load($this->users[0]->id());
@@ -102,7 +102,7 @@ public function testBulkForm() {
 
     // Ensure the anonymous user is found.
     $this->drupalGet('test-user-bulk-form');
-    $this->assertText($this->config('user.settings')->get('anonymous'));
+    $this->assertSession()->responseContains($this->config('user.settings')->get('anonymous'));
 
     // Attempt to block the anonymous user.
     $edit = [
diff --git a/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php b/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php
index 7586406649..a7f8d9a2d1 100644
--- a/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php
+++ b/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php
@@ -51,8 +51,8 @@ public function testHandlerUI() {
     $this->assertLink('User: Permission (= View user information)');
     $this->drupalPostForm(NULL, [], 'Save');
     // Verify that we can save the view.
-    $this->assertNoText('No valid values found on filter: User: Permission.');
-    $this->assertText('The view test_filter_permission has been saved.');
+    $this->assertSession()->responseNotContains('No valid values found on filter: User: Permission.');
+    $this->assertSession()->responseContains('The view test_filter_permission has been saved.');
 
     // Verify that the handler summary is also correct when multiple values are
     // selected in the filter.
@@ -66,8 +66,8 @@ public function testHandlerUI() {
     $this->assertLink('User: Permission (or View us…)');
     $this->drupalPostForm(NULL, [], 'Save');
     // Verify that we can save the view.
-    $this->assertNoText('No valid values found on filter: User: Permission.');
-    $this->assertText('The view test_filter_permission has been saved.');
+    $this->assertSession()->responseNotContains('No valid values found on filter: User: Permission.');
+    $this->assertSession()->responseContains('The view test_filter_permission has been saved.');
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php b/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php
index ca191b5a02..88716a797f 100644
--- a/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php
+++ b/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php
@@ -44,8 +44,8 @@ public function testRole() {
 
     $this->drupalLogin($this->createUser(['access user profiles']));
     $this->drupalGet('/test-views-handler-field-role');
-    $this->assertText($rolename_b . Html::escape('<em>' . $rolename_a . '</em>'), 'View test_views_handler_field_role renders role assigned to user in the correct order and markup in role names is escaped.');
-    $this->assertNoText($rolename_not_assigned, 'View test_views_handler_field_role does not render a role not assigned to a user.');
+    $this->assertSession()->responseContains($rolename_b . Html::escape('<em>' . $rolename_a . '</em>'), 'View test_views_handler_field_role renders role assigned to user in the correct order and markup in role names is escaped.');
+    $this->assertSession()->responseNotContains($rolename_not_assigned, 'View test_views_handler_field_role does not render a role not assigned to a user.');
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/Views/UserChangedTest.php b/core/modules/user/tests/src/Functional/Views/UserChangedTest.php
index 4c946f67a8..73e6f995f1 100644
--- a/core/modules/user/tests/src/Functional/Views/UserChangedTest.php
+++ b/core/modules/user/tests/src/Functional/Views/UserChangedTest.php
@@ -49,7 +49,7 @@ public function testChangedField() {
 
     $this->drupalGet($path, $options);
 
-    $this->assertText(t('Updated date') . ': ' . date('Y-m-d', REQUEST_TIME));
+    $this->assertSession()->responseContains(t('Updated date') . ': ' . date('Y-m-d', REQUEST_TIME));
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php
index 10ac272eca..6e089e0cef 100644
--- a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php
+++ b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php
@@ -35,13 +35,13 @@ public function testUserFieldAccess() {
     $this->drupalGet('test_user_fields_access');
 
     // User has access to name and created date by default.
-    $this->assertText(t('Name'));
-    $this->assertText(t('Created'));
+    $this->assertSession()->responseContains(t('Name'));
+    $this->assertSession()->responseContains(t('Created'));
 
     // User does not by default have access to init, mail and status.
-    $this->assertNoText(t('Init'));
-    $this->assertNoText(t('Email'));
-    $this->assertNoText(t('Status'));
+    $this->assertSession()->responseNotContains(t('Init'));
+    $this->assertSession()->responseNotContains(t('Email'));
+    $this->assertSession()->responseNotContains(t('Status'));
 
     // Assign sub-admin role to grant extra access.
     $user = $this->drupalCreateUser(['sub-admin']);
@@ -49,9 +49,9 @@ public function testUserFieldAccess() {
     $this->drupalGet('test_user_fields_access');
 
     // Access for init, mail and status is added in hook_entity_field_access().
-    $this->assertText(t('Init'));
-    $this->assertText(t('Email'));
-    $this->assertText(t('Status'));
+    $this->assertSession()->responseContains(t('Init'));
+    $this->assertSession()->responseContains(t('Email'));
+    $this->assertSession()->responseContains(t('Status'));
   }
 
   /**
@@ -70,7 +70,7 @@ public function testUserNameLink() {
 
     // No access, so no link.
     $this->drupalGet('test_user_fields_access');
-    $this->assertText($test_user->getAccountName(), 'Found user in view');
+    $this->assertSession()->responseContains($test_user->getAccountName(), 'Found user in view');
     $result = $this->xpath($xpath);
     $this->assertCount(0, $result, 'User is not a link');
 
diff --git a/core/modules/user/tests/src/Kernel/UserFieldsTest.php b/core/modules/user/tests/src/Kernel/UserFieldsTest.php
index 94475e7db9..65f61668a3 100644
--- a/core/modules/user/tests/src/Kernel/UserFieldsTest.php
+++ b/core/modules/user/tests/src/Kernel/UserFieldsTest.php
@@ -48,7 +48,7 @@ public function testUserFields() {
     $output = \Drupal::service('renderer')->renderRoot($build);
     $this->setRawContent($output);
     $userEmail = $user->getEmail();
-    $this->assertText($userEmail, "User's mail field is found in the twig template");
+    $this->assertSession()->responseContains($userEmail, "User's mail field is found in the twig template");
   }
 
 }
diff --git a/core/modules/user/tests/src/Kernel/WhosOnlineBlockTest.php b/core/modules/user/tests/src/Kernel/WhosOnlineBlockTest.php
index b38a66523b..304d254d78 100644
--- a/core/modules/user/tests/src/Kernel/WhosOnlineBlockTest.php
+++ b/core/modules/user/tests/src/Kernel/WhosOnlineBlockTest.php
@@ -111,9 +111,9 @@ public function testWhosOnlineBlock() {
       ->view($entity, 'block');
     $this->setRawContent($this->renderer->renderRoot($output));
     $this->assertRaw('2 users', 'Correct number of online users (2 users).');
-    $this->assertText($user1->getAccountName(), 'Active user 1 found in online list.');
-    $this->assertText($user2->getAccountName(), 'Active user 2 found in online list.');
-    $this->assertNoText($user3->getAccountName(), 'Inactive user not found in online list.');
+    $this->assertSession()->responseContains($user1->getAccountName(), 'Active user 1 found in online list.');
+    $this->assertSession()->responseContains($user2->getAccountName(), 'Active user 2 found in online list.');
+    $this->assertSession()->responseNotContains($user3->getAccountName(), 'Inactive user not found in online list.');
     $this->assertTrue(strpos($this->getRawContent(), $user1->getAccountName()) > strpos($this->getRawContent(), $user2->getAccountName()), 'Online users are ordered correctly.');
   }
 
diff --git a/core/modules/views/tests/src/Functional/BulkFormTest.php b/core/modules/views/tests/src/Functional/BulkFormTest.php
index 224dc9fd91..bd8e5966f3 100644
--- a/core/modules/views/tests/src/Functional/BulkFormTest.php
+++ b/core/modules/views/tests/src/Functional/BulkFormTest.php
@@ -35,7 +35,7 @@ public function testBulkForm() {
     // First, test an empty bulk form with the default style plugin to make sure
     // the empty region is rendered correctly.
     $this->drupalGet('test_bulk_form_empty');
-    $this->assertText(t('This view is empty.'), 'Empty text found on empty bulk form.');
+    $this->assertSession()->responseContains(t('This view is empty.'), 'Empty text found on empty bulk form.');
 
     $nodes = [];
     for ($i = 0; $i < 10; $i++) {
@@ -82,7 +82,7 @@ public function testBulkForm() {
       $this->assertTrue($changed_node->isSticky(), new FormattableMarkup('Node @nid got marked as sticky.', ['@nid' => $node->id()]));
     }
 
-    $this->assertText('Make content sticky was applied to 10 items.');
+    $this->assertSession()->responseContains('Make content sticky was applied to 10 items.');
 
     // Unpublish just one node.
     $node = $node_storage->load($nodes[0]->id());
@@ -91,7 +91,7 @@ public function testBulkForm() {
     $edit = ['node_bulk_form[0]' => TRUE, 'action' => 'node_unpublish_action'];
     $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
 
-    $this->assertText('Unpublish content was applied to 1 item.');
+    $this->assertSession()->responseContains('Unpublish content was applied to 1 item.');
 
     // Load the node again.
     $node_storage->resetCache([$node->id()]);
@@ -155,7 +155,7 @@ public function testBulkForm() {
     $errors = $this->xpath('//div[contains(@class, "messages--status")]');
     $this->assertEmpty($errors, 'No action message shown.');
     $this->drupalPostForm(NULL, [], t('Delete'));
-    $this->assertText(t('Deleted 5 content items.'));
+    $this->assertSession()->responseContains(t('Deleted 5 content items.'));
     // Check if we got redirected to the original page.
     $this->assertUrl('test_bulk_form');
 
@@ -193,7 +193,7 @@ public function testBulkForm() {
     $errors = $this->xpath('//div[contains(@class, "messages--status")]');
     $this->assertEmpty($errors, 'No action message shown.');
     $this->drupalPostForm(NULL, [], t('Delete'));
-    $this->assertText(t('Deleted 1 content item.'));
+    $this->assertSession()->responseContains(t('Deleted 1 content item.'));
 
     // Test that the bulk form works when multiple nodes are selected
     // but all of the selected nodes are already deleted
@@ -208,7 +208,7 @@ public function testBulkForm() {
       'action' => 'node_delete_action',
     ];
     $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
-    $this->assertText('No content selected.');
+    $this->assertSession()->responseContains('No content selected.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php b/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php
index 0a7608a90c..ce954321e7 100644
--- a/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php
+++ b/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php
@@ -66,8 +66,8 @@ protected function setUp($import_test_views = TRUE): void {
    */
   public function testProtectedField() {
     $this->drupalGet('test-entity-protected-access');
-    $this->assertText('ok to see this one');
-    $this->assertNoText('no access value');
+    $this->assertSession()->responseContains('ok to see this one');
+    $this->assertSession()->responseNotContains('no access value');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Entity/ViewNonTranslatableEntityTest.php b/core/modules/views/tests/src/Functional/Entity/ViewNonTranslatableEntityTest.php
index d4b6e9c8fe..5361ca45af 100644
--- a/core/modules/views/tests/src/Functional/Entity/ViewNonTranslatableEntityTest.php
+++ b/core/modules/views/tests/src/Functional/Entity/ViewNonTranslatableEntityTest.php
@@ -44,8 +44,8 @@ public function testViewNoTranslatableEntity() {
     // Visit the view page and assert it is displayed properly.
     $this->drupalGet('no-entity-translation-view');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('No Entity Translation View');
-    $this->assertText($no_language_entity->uuid());
+    $this->assertSession()->responseContains('No Entity Translation View');
+    $this->assertSession()->responseContains($no_language_entity->uuid());
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Handler/AreaTest.php b/core/modules/views/tests/src/Functional/Handler/AreaTest.php
index 7e44392f7f..2eeece4b4c 100644
--- a/core/modules/views/tests/src/Functional/Handler/AreaTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/AreaTest.php
@@ -67,13 +67,13 @@ public function testUI() {
 
       // First setup an empty label.
       $this->drupalPostForm($edit_path, [], t('Apply'));
-      $this->assertText('Test Example area');
+      $this->assertSession()->responseContains('Test Example area');
 
       // Then setup a no empty label.
       $labels[$type] = $this->randomMachineName();
       $this->drupalPostForm($edit_path, ['options[admin_label]' => $labels[$type]], t('Apply'));
       // Make sure that the new label appears on the site.
-      $this->assertText($labels[$type]);
+      $this->assertSession()->responseContains($labels[$type]);
 
       // Test that the settings (empty/admin_label) are accessible.
       $this->drupalGet($edit_path);
@@ -180,7 +180,7 @@ public function testRenderAreaToken() {
 
       // Test that each item exists in the list.
       foreach ($available[$type] as $token => $info) {
-        $this->assertText("[$type:$token]");
+        $this->assertSession()->responseContains("[$type:$token]");
       }
     }
 
@@ -217,7 +217,7 @@ public function testTitleArea() {
     $view->storage->enable()->save();
 
     $this->drupalGet('node');
-    $this->assertText('Overridden title', 'Overridden title found.');
+    $this->assertSession()->responseContains('Overridden title', 'Overridden title found.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php b/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
index 89bcf774b3..9e123e2e9d 100644
--- a/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
@@ -193,7 +193,7 @@ protected function _testUiValidation() {
     // Generate a definitive wrong value, which should be checked by validation.
     $edit['options[value][value]'] = $this->randomString() . '-------';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertText(t('Invalid date format.'), 'Make sure that validation is run and the invalidate date format is identified.');
+    $this->assertSession()->responseContains(t('Invalid date format.'), 'Make sure that validation is run and the invalidate date format is identified.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersBlockContextTest.php b/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersBlockContextTest.php
index 91945643d8..68a018a852 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersBlockContextTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ContextualFiltersBlockContextTest.php
@@ -126,13 +126,13 @@ public function testBlockContext() {
 
     // Make sure view behaves as expected.
     $this->drupalGet('<front>');
-    $this->assertText('Test view: No results found.');
+    $this->assertSession()->responseContains('Test view: No results found.');
 
     $this->drupalGet($this->nodes[0]->toUrl());
-    $this->assertText('Test view row: First test node');
+    $this->assertSession()->responseContains('Test view row: First test node');
 
     $this->drupalGet($this->nodes[1]->toUrl());
-    $this->assertText('Test view row: Second test node');
+    $this->assertSession()->responseContains('Test view row: Second test node');
 
     // Check the second block which should expose two integer contexts, one
     // based on the numeric plugin and the other based on numeric validation.
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php
index 5843e989ed..54d91c35ac 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php
@@ -140,8 +140,8 @@ public function testEntityReferenceDisplay() {
 
     // Test that the right fields are shown on the display settings form.
     $this->drupalGet('admin/structure/views/nojs/display/test_display_entity_reference/entity_reference_1/style_options');
-    $this->assertText('Test entity: Name');
-    $this->assertText('Test entity: ' . $this->field->label());
+    $this->assertSession()->responseContains('Test entity: Name');
+    $this->assertSession()->responseContains('Test entity: ' . $this->field->label());
 
     // Add the new field to the search fields.
     $this->drupalPostForm(NULL, ['style_options[search_fields][' . $this->fieldName . ']' => $this->fieldName], t('Apply'));
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php
index d1d1e11052..18770300fc 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php
@@ -123,7 +123,7 @@ public function testDisplayPlugin() {
 
     // Test that the display category/summary is in the UI.
     $this->drupalGet('admin/structure/views/view/test_view/edit/display_test_1');
-    $this->assertText('Display test settings');
+    $this->assertSession()->responseContains('Display test settings');
     // Ensure that the order is as expected.
     $result = $this->xpath('//ul[@id="views-display-menu-tabs"]/li/a/child::text()');
     $this->assertEqual($result[0]->getText(), 'Display test 2');
@@ -308,7 +308,7 @@ public function testInvalidDisplayPlugins() {
 
     $this->drupalGet('test_display_invalid');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The &quot;invalid&quot; plugin does not exist.');
+    $this->assertSession()->responseContains('The &quot;invalid&quot; plugin does not exist.');
 
     // Rebuild the router, and ensure that the path is not accessible anymore.
     views_invalidate_cache();
@@ -338,7 +338,7 @@ public function testInvalidDisplayPlugins() {
     // plugin warning message.
     $this->drupalGet('<front>');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText('The &quot;invalid&quot; plugin does not exist.');
+    $this->assertSession()->responseContains('The &quot;invalid&quot; plugin does not exist.');
     $this->assertCount(0, $this->xpath('//div[@id = :id]', [':id' => 'block-' . $block->id()]));
   }
 
@@ -446,17 +446,17 @@ protected function checkTranslationSetting($expected_node_translatability = FALS
 
     $this->drupalGet('admin/structure/views/nojs/display/content/page_1/rendering_language');
     if ($expected_node_translatability) {
-      $this->assertNoText($not_supported_text);
-      $this->assertText($supported_text);
+      $this->assertSession()->responseNotContains($not_supported_text);
+      $this->assertSession()->responseContains($supported_text);
     }
     else {
-      $this->assertText($not_supported_text);
-      $this->assertNoText($supported_text);
+      $this->assertSession()->responseContains($not_supported_text);
+      $this->assertSession()->responseNotContains($supported_text);
     }
 
     $this->drupalGet('admin/structure/views/nojs/display/files/page_1/rendering_language');
-    $this->assertText($not_supported_text);
-    $this->assertNoText($supported_text);
+    $this->assertSession()->responseContains($not_supported_text);
+    $this->assertSession()->responseNotContains($supported_text);
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php
index 425e54fb9a..5a6bddb5df 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php
@@ -109,7 +109,7 @@ public function testExposedFormRenderCheckboxes() {
     $this->clickLink('Page 2');
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
     $this->assertCount(1, $rows, '1 row is displayed by default on the second page when no options are checked.');
-    $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
+    $this->assertSession()->responseNotContains('An illegal choice has been detected. Please contact the site administrator.');
   }
 
   /**
@@ -157,7 +157,7 @@ public function testExposedIsAllOfFilter() {
     // Ensure that all results are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
     $this->assertCount(8, $rows, 'All rows are displayed by default on the first page when no options are checked.');
-    $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
+    $this->assertSession()->responseNotContains('An illegal choice has been detected. Please contact the site administrator.');
 
     // Select one option and ensure we still have results.
     $tid = $this->terms[0]->id();
@@ -166,7 +166,7 @@ public function testExposedIsAllOfFilter() {
     // Ensure only nodes tagged with $tid are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
     $this->assertCount(2, $rows, 'Correct rows are displayed when a tid is selected.');
-    $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
+    $this->assertSession()->responseNotContains('An illegal choice has been detected. Please contact the site administrator.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
index d5b0ce8998..f11228bf47 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
@@ -211,7 +211,7 @@ public function testExposedBlock() {
 
     // Test that the block label is found.
     $this->drupalGet('test_exposed_block');
-    $this->assertText($view->getTitle(), 'Block title found.');
+    $this->assertSession()->responseContains($view->getTitle(), 'Block title found.');
 
     // Set a custom label on the exposed filter form block.
     $block->getPlugin()->setConfigurationValue('views_label', '<strong>Custom</strong> title<script>alert("hacked!");</script>');
@@ -228,7 +228,7 @@ public function testExposedBlock() {
     // Test that the label is removed.
     $this->drupalGet('test_exposed_block');
     $this->assertNoRaw('<strong>Custom</strong> titlealert("hacked!");', 'Custom title was not displayed.');
-    $this->assertNoText($view->getTitle(), 'Block title was not displayed.');
+    $this->assertSession()->responseNotContains($view->getTitle(), 'Block title was not displayed.');
 
     // Test there is an exposed form in a block.
     $xpath = $this->buildXPathQuery('//div[@id=:id]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
@@ -294,12 +294,12 @@ public function testTextInputRequired() {
     // Ensure that the "on demand text" is displayed when no exposed filters are
     // applied.
     $this->drupalGet('test_exposed_form_buttons');
-    $this->assertText('Select any filter and click Apply to see results.');
+    $this->assertSession()->responseContains('Select any filter and click Apply to see results.');
 
     // Ensure that the "on demand text" is not displayed when an exposed filter
     // is applied.
     $this->drupalGet('test_exposed_form_buttons', ['query' => ['type' => 'article']]);
-    $this->assertNoText($on_demand_text);
+    $this->assertSession()->responseNotContains($on_demand_text);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
index 393d602563..1464d0155e 100644
--- a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
@@ -167,7 +167,7 @@ public function testInOperatorSelectAllOptions() {
     $this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_in_operator_ui/default/filter/type', $edit, t('Apply'));
     $this->drupalPostForm('admin/structure/views/view/test_filter_in_operator_ui/edit/default', [], t('Save'));
     $this->drupalPostForm(NULL, [], t('Update preview'));
-    $this->assertNoText('An illegal choice has been detected.');
+    $this->assertSession()->responseNotContains('An illegal choice has been detected.');
   }
 
   /**
@@ -212,7 +212,7 @@ public function testLimitExposedOperators() {
     $edit['options[operator]'] = '=';
     $edit['options[expose][operator_list][]'] = ['<', '>'];
     $this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_in_operator_ui/default/filter/nid', $edit, t('Apply'));
-    $this->assertText('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
+    $this->assertSession()->responseContains('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php b/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php
index f7168ac780..b356ea1819 100644
--- a/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php
@@ -97,14 +97,14 @@ public function testHierarchicalMenuLinkVisibility() {
 
     // Test if the primary menu item (node) is visible, and the secondary menu
     // item (view) is hidden.
-    $this->assertText('Primary level node');
-    $this->assertNoText('Secondary level view page');
+    $this->assertSession()->responseContains('Primary level node');
+    $this->assertSession()->responseNotContains('Secondary level view page');
 
     // Go to the node page and ensure that both the first and second level items
     // are visible.
     $this->drupalGet($node->toUrl());
-    $this->assertText('Primary level node');
-    $this->assertText('Secondary level view page');
+    $this->assertSession()->responseContains('Primary level node');
+    $this->assertSession()->responseContains('Secondary level view page');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php
index 4fa2fd4269..d3975499f4 100644
--- a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php
@@ -54,27 +54,27 @@ protected function setUp($import_test_views = TRUE): void {
    */
   public function testMiniPagerRender() {
     $this->drupalGet('test_mini_pager');
-    $this->assertText('›› test', 'The next link appears on the first page.');
-    $this->assertText('Page 1', 'The current page info shows the first page.');
-    $this->assertNoText('‹‹ test', 'The previous link does not appear on the first page.');
-    $this->assertText($this->nodes[0]->label());
-    $this->assertText($this->nodes[1]->label());
-    $this->assertText($this->nodes[2]->label());
+    $this->assertSession()->responseContains('›› test', 'The next link appears on the first page.');
+    $this->assertSession()->responseContains('Page 1', 'The current page info shows the first page.');
+    $this->assertSession()->responseNotContains('‹‹ test', 'The previous link does not appear on the first page.');
+    $this->assertSession()->responseContains($this->nodes[0]->label());
+    $this->assertSession()->responseContains($this->nodes[1]->label());
+    $this->assertSession()->responseContains($this->nodes[2]->label());
 
     $this->drupalGet('test_mini_pager', ['query' => ['page' => 1]]);
-    $this->assertText('‹‹ test', 'The previous link appears.');
-    $this->assertText('Page 2', 'The current page info shows the second page.');
-    $this->assertText('›› test', 'The next link appears.');
-    $this->assertText($this->nodes[3]->label());
-    $this->assertText($this->nodes[4]->label());
-    $this->assertText($this->nodes[5]->label());
+    $this->assertSession()->responseContains('‹‹ test', 'The previous link appears.');
+    $this->assertSession()->responseContains('Page 2', 'The current page info shows the second page.');
+    $this->assertSession()->responseContains('›› test', 'The next link appears.');
+    $this->assertSession()->responseContains($this->nodes[3]->label());
+    $this->assertSession()->responseContains($this->nodes[4]->label());
+    $this->assertSession()->responseContains($this->nodes[5]->label());
 
     $this->drupalGet('test_mini_pager', ['query' => ['page' => 6]]);
-    $this->assertNoText('›› test', 'The next link appears on the last page.');
-    $this->assertText('Page 7', 'The current page info shows the last page.');
-    $this->assertText('‹‹ test', 'The previous link does not appear on the last page.');
-    $this->assertText($this->nodes[18]->label());
-    $this->assertText($this->nodes[19]->label());
+    $this->assertSession()->responseNotContains('›› test', 'The next link appears on the last page.');
+    $this->assertSession()->responseContains('Page 7', 'The current page info shows the last page.');
+    $this->assertSession()->responseContains('‹‹ test', 'The previous link does not appear on the last page.');
+    $this->assertSession()->responseContains($this->nodes[18]->label());
+    $this->assertSession()->responseContains($this->nodes[19]->label());
 
     // Test @total value in result summary
     $view = Views::getView('test_mini_pager');
@@ -84,32 +84,32 @@ public function testMiniPagerRender() {
     $this->assertEqual(count($this->nodes), $view->total_rows, 'The total row count is equal to the number of nodes.');
 
     $this->drupalGet('test_mini_pager_total', ['query' => ['page' => 1]]);
-    $this->assertText('of ' . count($this->nodes), 'The first page shows the total row count.');
+    $this->assertSession()->responseContains('of ' . count($this->nodes), 'The first page shows the total row count.');
     $this->drupalGet('test_mini_pager_total', ['query' => ['page' => 6]]);
-    $this->assertText('of ' . count($this->nodes), 'The last page shows the total row count.');
+    $this->assertSession()->responseContains('of ' . count($this->nodes), 'The last page shows the total row count.');
 
     // Test a mini pager with just one item per page.
     $this->drupalGet('test_mini_pager_one');
-    $this->assertText('››');
-    $this->assertText('Page 1');
-    $this->assertText($this->nodes[0]->label());
+    $this->assertSession()->responseContains('››');
+    $this->assertSession()->responseContains('Page 1');
+    $this->assertSession()->responseContains($this->nodes[0]->label());
 
     $this->drupalGet('test_mini_pager_one', ['query' => ['page' => 1]]);
-    $this->assertText('‹‹');
-    $this->assertText('Page 2');
-    $this->assertText('››');
-    $this->assertText($this->nodes[1]->label());
+    $this->assertSession()->responseContains('‹‹');
+    $this->assertSession()->responseContains('Page 2');
+    $this->assertSession()->responseContains('››');
+    $this->assertSession()->responseContains($this->nodes[1]->label());
 
     $this->drupalGet('test_mini_pager_one', ['query' => ['page' => 19]]);
-    $this->assertNoText('››');
-    $this->assertText('Page 20');
-    $this->assertText('‹‹');
-    $this->assertText($this->nodes[19]->label());
+    $this->assertSession()->responseNotContains('››');
+    $this->assertSession()->responseContains('Page 20');
+    $this->assertSession()->responseContains('‹‹');
+    $this->assertSession()->responseContains($this->nodes[19]->label());
 
     $this->drupalGet('test_mini_pager_all');
-    $this->assertNoText('‹‹ test', 'The previous link does not appear on the page.');
-    $this->assertNoText('Page 1', 'The current page info shows the only page.');
-    $this->assertNoText('test ››', 'The next link does not appear on the page.');
+    $this->assertSession()->responseNotContains('‹‹ test', 'The previous link does not appear on the page.');
+    $this->assertSession()->responseNotContains('Page 1', 'The current page info shows the only page.');
+    $this->assertSession()->responseNotContains('test ››', 'The next link does not appear on the page.');
     $result = $this->xpath('//div[contains(@class, "views-row")]');
     $this->assertEqual(count($result), count($this->nodes), 'All rows appear on the page.');
 
@@ -119,10 +119,10 @@ public function testMiniPagerRender() {
     }
 
     $this->drupalGet('test_mini_pager');
-    $this->assertNoText('‹‹ test', 'The previous link does not appear on the page.');
-    $this->assertNoText('Page 1', 'The current page info shows the only page.');
-    $this->assertNoText('‹‹ test', 'The previous link does not appear on the page.');
-    $this->assertText($this->nodes[19]->label());
+    $this->assertSession()->responseNotContains('‹‹ test', 'The previous link does not appear on the page.');
+    $this->assertSession()->responseNotContains('Page 1', 'The current page info shows the only page.');
+    $this->assertSession()->responseNotContains('‹‹ test', 'The previous link does not appear on the page.');
+    $this->assertSession()->responseContains($this->nodes[19]->label());
 
     $view = Views::getView('test_mini_pager');
     $this->executeView($view);
@@ -132,9 +132,9 @@ public function testMiniPagerRender() {
     // Remove the last node as well and ensure that no "Page 1" is shown.
     $this->nodes[19]->delete();
     $this->drupalGet('test_mini_pager');
-    $this->assertNoText('‹‹ test', 'The previous link does not appear on the page.');
-    $this->assertNoText('Page 1', 'The current page info shows the only page.');
-    $this->assertNoText('‹‹ test', 'The previous link does not appear on the page.');
+    $this->assertSession()->responseNotContains('‹‹ test', 'The previous link does not appear on the page.');
+    $this->assertSession()->responseNotContains('Page 1', 'The current page info shows the only page.');
+    $this->assertSession()->responseNotContains('‹‹ test', 'The previous link does not appear on the page.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
index 91d41a760a..b66f61f406 100644
--- a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
@@ -88,7 +88,7 @@ public function testStorePagerSettings() {
       'pager_options[items_per_page]' => 20,
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager_options', $edit, t('Apply'));
-    $this->assertText('20 items');
+    $this->assertSession()->responseContains('20 items');
 
     // Change type and check whether the type is new type is stored.
     $edit = [
@@ -96,7 +96,7 @@ public function testStorePagerSettings() {
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply'));
     $this->drupalGet('admin/structure/views/view/test_view/edit');
-    $this->assertText('Mini', 'Changed pager plugin, should change some text');
+    $this->assertSession()->responseContains('Mini', 'Changed pager plugin, should change some text');
 
     // Test behavior described in
     //   https://www.drupal.org/node/652712#comment-2354400.
@@ -111,13 +111,13 @@ public function testStorePagerSettings() {
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_store_pager_settings/default/pager', $edit, t('Apply'));
     $this->drupalGet('admin/structure/views/view/test_store_pager_settings/edit');
-    $this->assertText('Full');
+    $this->assertSession()->responseContains('Full');
 
     $edit = [
       'pager_options[items_per_page]' => 20,
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_store_pager_settings/default/pager_options', $edit, t('Apply'));
-    $this->assertText('20 items');
+    $this->assertSession()->responseContains('20 items');
 
     // add new display and test the settings again, by override it.
     $edit = [];
@@ -133,15 +133,15 @@ public function testStorePagerSettings() {
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_store_pager_settings/page_1/pager', $edit, t('Apply'));
     $this->drupalGet('admin/structure/views/view/test_store_pager_settings/edit/page_1');
-    $this->assertText('Mini', 'Changed pager plugin, should change some text');
+    $this->assertSession()->responseContains('Mini', 'Changed pager plugin, should change some text');
 
     $edit = [
       'pager_options[items_per_page]' => 10,
     ];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_store_pager_settings/default/pager_options', $edit, t('Apply'));
-    $this->assertText('10 items', 'The default value has been changed.');
+    $this->assertSession()->responseContains('10 items', 'The default value has been changed.');
     $this->drupalGet('admin/structure/views/view/test_store_pager_settings/edit/page_1');
-    $this->assertText('20 items', 'The original value remains unchanged.');
+    $this->assertSession()->responseContains('20 items', 'The original value remains unchanged.');
 
     // Test that the override element is only displayed on pager plugin selection form.
     $this->drupalGet('admin/structure/views/nojs/display/test_store_pager_settings/page_1/pager');
diff --git a/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php b/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php
index 49f74c7151..4120cdaacd 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php
@@ -52,7 +52,7 @@ public function testBulkSelection() {
     // Login as administrator and go to admin/content.
     $this->drupalLogin($this->admin_user);
     $this->drupalGet('admin/content');
-    $this->assertText($node_1->getTitle());
+    $this->assertSession()->responseContains($node_1->getTitle());
 
     // Create second node now that the admin overview has been rendered.
     $node_2 = $this->drupalCreateNode([
@@ -64,8 +64,8 @@ public function testBulkSelection() {
     // Now click 'Apply to selected items' and assert the first node is selected
     // on the confirm form.
     $this->drupalPostForm(NULL, ['node_bulk_form[0]' => TRUE], 'Apply to selected items');
-    $this->assertText($node_1->getTitle());
-    $this->assertNoText($node_2->getTitle());
+    $this->assertSession()->responseContains($node_1->getTitle());
+    $this->assertSession()->responseNotContains($node_2->getTitle());
 
     // Change the pager limit to 2.
     $this->config('views.view.content')->set('display.default.display_options.pager.options.items_per_page', 2)->save();
@@ -82,8 +82,8 @@ public function testBulkSelection() {
     // Now click 'Apply to selected items' and assert the second node is
     // selected on the confirm form.
     $this->drupalPostForm(NULL, ['node_bulk_form[1]' => TRUE], 'Apply to selected items');
-    $this->assertText($node_1->getTitle());
-    $this->assertNoText($node_3->getTitle());
+    $this->assertSession()->responseContains($node_1->getTitle());
+    $this->assertSession()->responseNotContains($node_3->getTitle());
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php b/core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php
index 785f49d3af..ef21ad78df 100644
--- a/core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php
+++ b/core/modules/views/tests/src/Functional/TaxonomyGlossaryTest.php
@@ -57,7 +57,7 @@ protected function setUp($import_test_views = TRUE): void {
   public function testTaxonomyGlossaryView() {
     // Go the taxonomy glossary page for the first term.
     $this->drupalGet('test_taxonomy_glossary/' . substr($this->taxonomyTerms[0]->getName(), 0, 1));
-    $this->assertText($this->taxonomyTerms[0]->getName());
+    $this->assertSession()->responseContains($this->taxonomyTerms[0]->getName());
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/ViewsEscapingTest.php b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php
index 9a1b90bbd4..87ee627b60 100644
--- a/core/modules/views/tests/src/Functional/ViewsEscapingTest.php
+++ b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php
@@ -63,7 +63,7 @@ public function testViewsViewFieldsEscaping() {
     $this->drupalGet('test_page_display_200');
 
     // Assert that we are using the correct template.
-    $this->assertText('force', 'The force is strong with this one');
+    $this->assertSession()->responseContains('force', 'The force is strong with this one');
 
     // Assert that there are no escaped '<'s characters.
     $this->assertNoEscaped('<');
diff --git a/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php b/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php
index d5b0ae5ee3..b8d5cab242 100644
--- a/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php
+++ b/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php
@@ -50,15 +50,15 @@ public function testViewsFormMultiple() {
     // Get the test page.
     $this->drupalGet('views_test_form_multiple');
 
-    $this->assertText('Test base form ID with Views forms and arguments.');
+    $this->assertSession()->responseContains('Test base form ID with Views forms and arguments.');
 
     // Submit the forms, validate argument returned in message set by handler.
     // @note There is not a way to specify a specific index for a submit button. So
     // the row index returned is always the last occurrence.
     $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4--2');
-    $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.');
+    $this->assertSession()->responseContains('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.');
     $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4');
-    $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.');
+    $this->assertSession()->responseContains('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
index acc6a9ca09..011c909fb9 100644
--- a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
@@ -31,7 +31,7 @@ public function testViewsWizardAndListing() {
 
     // Check if we can access the main views admin page.
     $this->drupalGet('admin/structure/views');
-    $this->assertText(t('Add view'));
+    $this->assertSession()->responseContains(t('Add view'));
 
     // Create a simple and not at all useful view.
     $view1 = [];
@@ -42,18 +42,18 @@ public function testViewsWizardAndListing() {
     $this->drupalPostForm('admin/structure/views/add', $view1, t('Save and edit'));
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet('admin/structure/views');
-    $this->assertText($view1['label']);
-    $this->assertText($view1['description']);
+    $this->assertSession()->responseContains($view1['label']);
+    $this->assertSession()->responseContains($view1['description']);
     $this->assertLinkByHref(Url::fromRoute('entity.view.edit_form', ['view' => $view1['id']])->toString());
     $this->assertLinkByHref(Url::fromRoute('entity.view.delete_form', ['view' => $view1['id']])->toString());
     $this->assertLinkByHref(Url::fromRoute('entity.view.duplicate_form', ['view' => $view1['id']])->toString());
 
     // The view should not have a REST export display.
-    $this->assertNoText('REST export', 'When no options are enabled in the wizard, the resulting view does not have a REST export display.');
+    $this->assertSession()->responseNotContains('REST export', 'When no options are enabled in the wizard, the resulting view does not have a REST export display.');
 
     // This view should not have a block.
     $this->drupalGet('admin/structure/block');
-    $this->assertNoText($view1['label']);
+    $this->assertSession()->responseNotContains($view1['label']);
 
     // Create two nodes.
     $node1 = $this->drupalCreateNode(['type' => 'page']);
@@ -76,9 +76,9 @@ public function testViewsWizardAndListing() {
     // Since the view has a page, we expect to be automatically redirected to
     // it.
     $this->assertUrl($view2['page[path]']);
-    $this->assertText($view2['page[title]']);
-    $this->assertText($node1->label());
-    $this->assertText($node2->label());
+    $this->assertSession()->responseContains($view2['page[title]']);
+    $this->assertSession()->responseContains($node1->label());
+    $this->assertSession()->responseContains($node2->label());
 
     // Check if we have the feed.
     $this->assertLinkByHref(Url::fromRoute('view.' . $view2['id'] . '.feed_1')->toString());
@@ -89,24 +89,24 @@ public function testViewsWizardAndListing() {
     // HTML tag being present.
     $this->assertEquals('2.0', $this->getSession()->getDriver()->getAttribute('//rss', 'version'));
     // The feed should have the same title and nodes as the page.
-    $this->assertText($view2['page[title]']);
+    $this->assertSession()->responseContains($view2['page[title]']);
     $this->assertRaw($node1->toUrl('canonical', ['absolute' => TRUE])->toString());
-    $this->assertText($node1->label());
+    $this->assertSession()->responseContains($node1->label());
     $this->assertRaw($node2->toUrl('canonical', ['absolute' => TRUE])->toString());
-    $this->assertText($node2->label());
+    $this->assertSession()->responseContains($node2->label());
 
     // Go back to the views page and check if this view is there.
     $this->drupalGet('admin/structure/views');
-    $this->assertText($view2['label']);
-    $this->assertText($view2['description']);
+    $this->assertSession()->responseContains($view2['label']);
+    $this->assertSession()->responseContains($view2['description']);
     $this->assertLinkByHref(Url::fromRoute('view.' . $view2['id'] . '.page_1')->toString());
 
     // The view should not have a REST export display.
-    $this->assertNoText('REST export', 'If only the page option was enabled in the wizard, the resulting view does not have a REST export display.');
+    $this->assertSession()->responseNotContains('REST export', 'If only the page option was enabled in the wizard, the resulting view does not have a REST export display.');
 
     // This view should not have a block.
     $this->drupalGet('admin/structure/block');
-    $this->assertNoText('View: ' . $view2['label']);
+    $this->assertSession()->responseNotContains('View: ' . $view2['label']);
 
     // Create a view with a page and a block, and filter the listing.
     $view3 = [];
@@ -126,23 +126,23 @@ public function testViewsWizardAndListing() {
 
     // Make sure the view only displays the node we expect.
     $this->assertUrl($view3['page[path]']);
-    $this->assertText($view3['page[title]']);
-    $this->assertText($node1->label());
-    $this->assertNoText($node2->label());
+    $this->assertSession()->responseContains($view3['page[title]']);
+    $this->assertSession()->responseContains($node1->label());
+    $this->assertSession()->responseNotContains($node2->label());
 
     // Go back to the views page and check if this view is there.
     $this->drupalGet('admin/structure/views');
-    $this->assertText($view3['label']);
-    $this->assertText($view3['description']);
+    $this->assertSession()->responseContains($view3['label']);
+    $this->assertSession()->responseContains($view3['description']);
     $this->assertLinkByHref(Url::fromRoute('view.' . $view3['id'] . '.page_1')->toString());
 
     // The view should not have a REST export display.
-    $this->assertNoText('REST export', 'If only the page and block options were enabled in the wizard, the resulting view does not have a REST export display.');
+    $this->assertSession()->responseNotContains('REST export', 'If only the page and block options were enabled in the wizard, the resulting view does not have a REST export display.');
 
     // Confirm that the block is available in the block administration UI.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
     $this->clickLink('Place block');
-    $this->assertText($view3['label']);
+    $this->assertSession()->responseContains($view3['label']);
 
     // Place the block.
     $this->drupalPlaceBlock("views_block:{$view3['id']}-block_1");
@@ -150,11 +150,11 @@ public function testViewsWizardAndListing() {
     // Visit a random page (not the one that displays the view itself) and look
     // for the expected node title in the block.
     $this->drupalGet('user');
-    $this->assertText($node1->label());
-    $this->assertNoText($node2->label());
+    $this->assertSession()->responseContains($node1->label());
+    $this->assertSession()->responseNotContains($node2->label());
 
     // Make sure the listing page doesn't show disabled default views.
-    $this->assertNoText('tracker', 'Default tracker view does not show on the listing page.');
+    $this->assertSession()->responseNotContains('tracker', 'Default tracker view does not show on the listing page.');
 
     // Create a view with only a REST export.
     $view4 = [];
diff --git a/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php b/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php
index 13e6504606..12f6a75627 100644
--- a/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php
@@ -61,14 +61,14 @@ public function testItemsPerPage() {
     // Make sure the page display shows the nodes we expect, and that they
     // appear in the expected order.
     $this->assertUrl($view['page[path]']);
-    $this->assertText($view['page[title]']);
+    $this->assertSession()->responseContains($view['page[title]']);
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertText($node5->label());
-    $this->assertText($node4->label());
-    $this->assertText($node3->label());
-    $this->assertText($node2->label());
-    $this->assertNoText($node1->label());
-    $this->assertNoText($page_node->label());
+    $this->assertSession()->responseContains($node5->label());
+    $this->assertSession()->responseContains($node4->label());
+    $this->assertSession()->responseContains($node3->label());
+    $this->assertSession()->responseContains($node2->label());
+    $this->assertSession()->responseNotContains($node1->label());
+    $this->assertSession()->responseNotContains($page_node->label());
     $pos5 = strpos($content, $node5->label());
     $pos4 = strpos($content, $node4->label());
     $pos3 = strpos($content, $node3->label());
@@ -78,7 +78,7 @@ public function testItemsPerPage() {
     // Confirm that the block is listed in the block administration UI.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
     $this->clickLink('Place block');
-    $this->assertText($view['label']);
+    $this->assertSession()->responseContains($view['label']);
 
     // Place the block, visit a page that displays the block, and check that the
     // nodes we expect appear in the correct order.
@@ -86,12 +86,12 @@ public function testItemsPerPage() {
 
     $this->drupalGet('user');
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertText($node5->label());
-    $this->assertText($node4->label());
-    $this->assertText($node3->label());
-    $this->assertNoText($node2->label());
-    $this->assertNoText($node1->label());
-    $this->assertNoText($page_node->label());
+    $this->assertSession()->responseContains($node5->label());
+    $this->assertSession()->responseContains($node4->label());
+    $this->assertSession()->responseContains($node3->label());
+    $this->assertSession()->responseNotContains($node2->label());
+    $this->assertSession()->responseNotContains($node1->label());
+    $this->assertSession()->responseNotContains($page_node->label());
     $pos5 = strpos($content, $node5->label());
     $pos4 = strpos($content, $node4->label());
     $pos3 = strpos($content, $node3->label());
diff --git a/core/modules/views/tests/src/Functional/Wizard/SortingTest.php b/core/modules/views/tests/src/Functional/Wizard/SortingTest.php
index a73b011be1..dfcbc90cfd 100644
--- a/core/modules/views/tests/src/Functional/Wizard/SortingTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/SortingTest.php
@@ -46,11 +46,11 @@ public function testSorting() {
 
     // Make sure the view shows the nodes in the expected order.
     $this->assertUrl($view1['page[path]']);
-    $this->assertText($view1['page[title]']);
+    $this->assertSession()->responseContains($view1['page[title]']);
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertText($node1->label());
-    $this->assertText($node2->label());
-    $this->assertText($node3->label());
+    $this->assertSession()->responseContains($node1->label());
+    $this->assertSession()->responseContains($node2->label());
+    $this->assertSession()->responseContains($node3->label());
     $pos1 = strpos($content, $node1->label());
     $pos2 = strpos($content, $node2->label());
     $pos3 = strpos($content, $node3->label());
@@ -71,11 +71,11 @@ public function testSorting() {
 
     // Make sure the view shows the nodes in the expected order.
     $this->assertUrl($view2['page[path]']);
-    $this->assertText($view2['page[title]']);
+    $this->assertSession()->responseContains($view2['page[title]']);
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertText($node3->label());
-    $this->assertText($node2->label());
-    $this->assertText($node1->label());
+    $this->assertSession()->responseContains($node3->label());
+    $this->assertSession()->responseContains($node2->label());
+    $this->assertSession()->responseContains($node1->label());
     $pos3 = strpos($content, $node3->label());
     $pos2 = strpos($content, $node2->label());
     $pos1 = strpos($content, $node1->label());
diff --git a/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php b/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php
index 53c12604c9..cc362f4670 100644
--- a/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php
@@ -159,9 +159,9 @@ public function testTaggedWith() {
     // ones we don't expect are absent.
     $this->drupalGet($view1['page[path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($node_tag1_title);
-    $this->assertText($node_tag1_tag2_title);
-    $this->assertNoText($node_no_tags_title);
+    $this->assertSession()->responseContains($node_tag1_title);
+    $this->assertSession()->responseContains($node_tag1_tag2_title);
+    $this->assertSession()->responseNotContains($node_no_tags_title);
 
     // Create a view that filters by taxonomy term "tag2". It should show only
     // the one node from above that is tagged with "tag2".
@@ -179,9 +179,9 @@ public function testTaggedWith() {
     $this->drupalPostForm(NULL, $view2, t('Save and edit'));
     $this->assertSession()->statusCodeEquals(200);
     $this->drupalGet($view2['page[path]']);
-    $this->assertNoText($node_tag1_title);
-    $this->assertText($node_tag1_tag2_title);
-    $this->assertNoText($node_no_tags_title);
+    $this->assertSession()->responseNotContains($node_tag1_title);
+    $this->assertSession()->responseContains($node_tag1_tag2_title);
+    $this->assertSession()->responseNotContains($node_no_tags_title);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php
index a6ea2573c7..f8140b874a 100644
--- a/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php
@@ -74,9 +74,9 @@ public function testRenderEmptyHeaderFooter() {
     $output = $view->render();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->setRawContent($output);
-    $this->assertText($empty_text);
-    $this->assertNoText($empty_header);
-    $this->assertNoText($empty_footer);
+    $this->assertSession()->responseContains($empty_text);
+    $this->assertSession()->responseNotContains($empty_header);
+    $this->assertSession()->responseNotContains($empty_footer);
 
     // Enable displaying the header and footer when the View is empty.
     $view->header['test_example']->options['empty'] = TRUE;
@@ -87,8 +87,8 @@ public function testRenderEmptyHeaderFooter() {
     $output = $view->render();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->setRawContent($output);
-    $this->assertText($empty_header);
-    $this->assertText($empty_footer);
+    $this->assertSession()->responseContains($empty_header);
+    $this->assertSession()->responseContains($empty_footer);
   }
 
 }
diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php
index a0bfb1cd53..ef3508fbff 100644
--- a/core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/AreaMessagesTest.php
@@ -33,7 +33,7 @@ public function testMessageText() {
     $output = $view->render();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->setRawContent($output);
-    $this->assertText('My drupal set message.');
+    $this->assertSession()->responseContains('My drupal set message.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaResultTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaResultTest.php
index 31e252aef2..6ead238e7f 100644
--- a/core/modules/views/tests/src/Kernel/Handler/AreaResultTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/AreaResultTest.php
@@ -28,7 +28,7 @@ public function testResult() {
     $output = $view->render();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->setRawContent($output);
-    $this->assertText('start: 1 | end: 5 | total: 5 | label: test_area_result | per page: 0 | current page: 1 | current record count: 5 | page count: 1');
+    $this->assertSession()->responseContains('start: 1 | end: 5 | total: 5 | label: test_area_result | per page: 0 | current page: 1 | current record count: 5 | page count: 1');
   }
 
   /**
@@ -56,7 +56,7 @@ public function testResultEmpty() {
     $output = $view->render();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->setRawContent($output);
-    $this->assertText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
+    $this->assertSession()->responseContains('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
     $this->assertRaw('<header>');
 
     // Test that the area is not displayed if we have not checked the empty
@@ -67,7 +67,7 @@ public function testResultEmpty() {
     $output = $view->render();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->setRawContent($output);
-    $this->assertNoText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
+    $this->assertSession()->responseNotContains('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
     // Make sure the empty header region isn't rendered.
     $this->assertNoRaw('<header>');
   }
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
index 1f9b017bdb..0b6033c255 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
@@ -122,7 +122,7 @@ protected function assertFieldAccess($entity_type_id, $field_name, $field_conten
     $build = $executable->preview();
     $this->setRawContent($renderer->renderRoot($build));
 
-    $this->assertText($field_content);
+    $this->assertSession()->responseContains($field_content);
     $this->assertTrue(isset($executable->field[$field_name]));
 
     $account_switcher->switchTo($this->userWithoutAccess);
@@ -130,7 +130,7 @@ protected function assertFieldAccess($entity_type_id, $field_name, $field_conten
     $build = $executable->preview();
     $this->setRawContent($renderer->renderRoot($build));
 
-    $this->assertNoText($field_content);
+    $this->assertSession()->responseNotContains($field_content);
     $this->assertFalse(isset($executable->field[$field_name]));
 
     \Drupal::state()->delete('views_field_access_test-field');
diff --git a/core/modules/views/tests/src/Kernel/Plugin/RowEntityTest.php b/core/modules/views/tests/src/Kernel/Plugin/RowEntityTest.php
index f1c60835e4..5ec311a167 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/RowEntityTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/RowEntityTest.php
@@ -62,7 +62,7 @@ public function testEntityRow() {
     $build = $view->preview();
     $this->render($build);
 
-    $this->assertText($term->getName(), 'The rendered entity appears as row in the view.');
+    $this->assertSession()->responseContains($term->getName(), 'The rendered entity appears as row in the view.');
 
     // Tests the available view mode options.
     $form = [];
diff --git a/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php b/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
index e50005f49e..ddf1319c65 100644
--- a/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
@@ -34,7 +34,7 @@ public function testCacheData() {
     $this->drupalGet('admin/structure/views/view/test_view/edit');
     // Make sure we have 'changes' to the view.
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/title', [], t('Apply'));
-    $this->assertText('You have unsaved changes.');
+    $this->assertSession()->responseContains('You have unsaved changes.');
     $this->assertEqual($temp_store->getMetadata('test_view')->getOwnerId(), $views_admin_user_uid, 'View cache has been saved.');
 
     $view_cache = $temp_store->get('test_view');
diff --git a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
index 74d23b5618..537187de96 100644
--- a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
@@ -65,7 +65,7 @@ public function testDefaultViews() {
     $this->drupalPostForm('admin/structure/views/view/glossary/edit/page_1', [], t('Save'));
     $this->drupalGet('glossary');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($new_title);
+    $this->assertSession()->responseContains($new_title);
 
     // Save another view in the UI.
     $this->drupalPostForm('admin/structure/views/nojs/display/archive/page_1/title', [], t('Apply'));
@@ -85,7 +85,7 @@ public function testDefaultViews() {
     // $this->assertLinkByHref($revert_href);
     // $this->drupalPostForm($revert_href, array(), t('Revert'));
     // $this->drupalGet('glossary');
-    // $this->assertNoText($new_title);
+    // $this->assertSession()->responseNotContains($new_title);
 
     // Duplicate the view and check that the normal schema of duplicated views is used.
     $this->drupalGet('admin/structure/views');
@@ -141,7 +141,7 @@ public function testDefaultViews() {
     // Ensure the view is no longer available.
     $this->drupalGet($edit_href);
     $this->assertSession()->statusCodeEquals(404);
-    $this->assertText('Page not found');
+    $this->assertSession()->responseContains('Page not found');
 
     // Delete all duplicated Glossary views.
     $this->drupalGet('admin/structure/views');
@@ -158,7 +158,7 @@ public function testDefaultViews() {
     $this->drupalPostForm(NULL, [], t('Delete'));
     $this->drupalGet('glossary');
     $this->assertSession()->statusCodeEquals(404);
-    $this->assertText('Page not found');
+    $this->assertSession()->responseContains('Page not found');
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
index bcbf4b709b..ea93fbc67f 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
@@ -31,7 +31,7 @@ class DisplayAttachmentTest extends UITestBase {
    */
   public function testAttachmentUI() {
     $this->drupalGet('admin/structure/views/view/test_attachment_ui/edit/attachment_1');
-    $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
+    $this->assertSession()->responseContains(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
 
     $attachment_display_url = 'admin/structure/views/nojs/display/test_attachment_ui/attachment_1/displays';
     $this->drupalGet($attachment_display_url);
@@ -77,7 +77,7 @@ public function testRemoveAttachedDisplay() {
     // Open the Page display and create the attachment display.
     $this->drupalGet($path_prefix . '/page_1');
     $this->drupalPostForm(NULL, [], 'Add Attachment');
-    $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
+    $this->assertSession()->responseContains(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
 
     // Attach the Attachment to the Page display.
     $this->drupalPostForm($attachment_display_url, ['displays[page_1]' => 1], t('Apply'));
@@ -93,10 +93,10 @@ public function testRemoveAttachedDisplay() {
     $this->drupalPostForm(NULL, [], t('Save'));
 
     // Check that there is no warning for the removed page display.
-    $this->assertNoText("Plugin ID &#039;page_1&#039; was not found.");
+    $this->assertSession()->responseNotContains("Plugin ID &#039;page_1&#039; was not found.");
 
     // Check that the attachment is no longer linked to the removed display.
-    $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
+    $this->assertSession()->responseContains(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
 
   }
 
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
index 3ab3c38641..135dd14acb 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
@@ -130,8 +130,8 @@ public function testDuplicateDisplay() {
     $this->drupalPostForm(NULL, [], 'Duplicate as Block');
     $this->assertLinkByHref($path_prefix . '/block_1', 0, 'Make sure after duplicating the new display appears in the UI');
     $this->assertUrl($path_prefix . '/block_1', [], 'The user got redirected to the new display.');
-    $this->assertText(t('Block settings'));
-    $this->assertNoText(t('Page settings'));
+    $this->assertSession()->responseContains(t('Block settings'));
+    $this->assertSession()->responseNotContains(t('Page settings'));
 
     $this->drupalPostForm(NULL, [], t('Save'));
     $view = Views::getView($view['id']);
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php b/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
index 1aa4b1dfe4..5d80086196 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
@@ -51,7 +51,7 @@ protected function checkFeedViewUi($view_name) {
     // Regression test: ViewListBuilder::getDisplayPaths() did not properly
     // check whether a DisplayPluginCollection was returned in iterating over
     // all displays.
-    $this->assertText($view_name);
+    $this->assertSession()->responseContains($view_name);
 
     // Check the attach TO interface.
     $this->drupalGet('admin/structure/views/nojs/display/' . $view_name . '/feed_1/displays');
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
index bec61e28d0..20e2e9e020 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
@@ -56,7 +56,7 @@ protected function doBasicPathUITest() {
 
     // Add a new page display and check the appearing text.
     $this->drupalPostForm(NULL, [], 'Add Page');
-    $this->assertText(t('No path is set'), 'The right text appears if no path was set.');
+    $this->assertSession()->responseContains(t('No path is set'), 'The right text appears if no path was set.');
     $this->assertNoLink(t('View @display', ['@display' => 'page']), 'No view page link found on the page.');
 
     // Save a path and make sure the summary appears as expected.
@@ -66,7 +66,7 @@ protected function doBasicPathUITest() {
     $random_path = str_replace(':', '', $random_path);
 
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => $random_path], t('Apply'));
-    $this->assertText('/' . $random_path, 'The custom path appears in the summary.');
+    $this->assertSession()->responseContains('/' . $random_path, 'The custom path appears in the summary.');
     $display_link_text = t('View @display', ['@display' => 'Page']);
     $this->assertLink($display_link_text, 0, 'view page link found on the page.');
     $this->clickLink($display_link_text);
@@ -103,11 +103,11 @@ protected function doAdvancedPathsValidationTest() {
 
     $this->drupalPostForm($url, ['path' => '%/magrathea'], t('Apply'));
     $this->assertUrl($url);
-    $this->assertText('"%" may not be used for the first segment of a path.');
+    $this->assertSession()->responseContains('"%" may not be used for the first segment of a path.');
 
     $this->drupalPostForm($url, ['path' => 'user/%1/example'], t('Apply'));
     $this->assertUrl($url);
-    $this->assertText("Numeric placeholders may not be used. Please use plain placeholders (%).");
+    $this->assertSession()->responseContains("Numeric placeholders may not be used. Please use plain placeholders (%).");
   }
 
   /**
@@ -133,15 +133,15 @@ public function testMenuOptions() {
 
     // Add an invalid path (only fragment).
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => '#foo'], t('Apply'));
-    $this->assertText('Path is empty');
+    $this->assertSession()->responseContains('Path is empty');
 
     // Add an invalid path with a query.
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => 'foo?bar'], t('Apply'));
-    $this->assertText('No query allowed.');
+    $this->assertSession()->responseContains('No query allowed.');
 
     // Add an invalid path with just a query.
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => '?bar'], t('Apply'));
-    $this->assertText('Path is empty');
+    $this->assertSession()->responseContains('Path is empty');
 
     // Provide a random, valid path string.
     $random_string = $this->randomMachineName();
@@ -247,7 +247,7 @@ public function testDefaultMenuTabRegression() {
       'menu[title]' => 'Menu title',
     ], t('Apply'));
 
-    $this->assertText('Default tab options');
+    $this->assertSession()->responseContains('Default tab options');
 
     $this->drupalPostForm(NULL, [
       'tab_options[type]' => 'normal',
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayTest.php b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
index de7824a3f3..f155698a20 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
@@ -37,12 +37,12 @@ class DisplayTest extends UITestBase {
    */
   public function testAddDisplay() {
     $view = $this->randomView();
-    $this->assertNoText('Block');
-    $this->assertNoText('Block 2');
+    $this->assertSession()->responseNotContains('Block');
+    $this->assertSession()->responseNotContains('Block 2');
 
     $this->drupalPostForm(NULL, [], t('Add @display', ['@display' => 'Block']));
-    $this->assertText('Block');
-    $this->assertNoText('Block 2');
+    $this->assertSession()->responseContains('Block');
+    $this->assertSession()->responseNotContains('Block 2');
   }
 
   /**
@@ -268,26 +268,26 @@ public function testActionLinks() {
   public function testHideDisplayOverride() {
     // Test that the override option appears with two displays.
     $this->drupalGet('admin/structure/views/nojs/handler/test_display/page_1/field/title');
-    $this->assertText('All displays');
+    $this->assertSession()->responseContains('All displays');
 
     // Remove a display and test if the override option is hidden.
     $this->drupalPostForm('admin/structure/views/view/test_display/edit/block_1', [], t('Delete @display', ['@display' => 'Block']));
     $this->drupalPostForm(NULL, [], t('Save'));
 
     $this->drupalGet('admin/structure/views/nojs/handler/test_display/page_1/field/title');
-    $this->assertNoText('All displays');
+    $this->assertSession()->responseNotContains('All displays');
 
     // Test that the override option is shown when display master is on.
     \Drupal::configFactory()->getEditable('views.settings')->set('ui.show.master_display', TRUE)->save();
     $this->drupalGet('admin/structure/views/nojs/handler/test_display/page_1/field/title');
-    $this->assertText('All displays');
+    $this->assertSession()->responseContains('All displays');
 
     // Test that the override option is shown if the current display is
     // overridden so that the option to revert is available.
     $this->drupalPostForm(NULL, ['override[dropdown]' => 'page_1'], t('Apply'));
     \Drupal::configFactory()->getEditable('views.settings')->set('ui.show.master_display', FALSE)->save();
     $this->drupalGet('admin/structure/views/nojs/handler/test_display/page_1/field/title');
-    $this->assertText('Revert to default');
+    $this->assertSession()->responseContains('Revert to default');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/DuplicateTest.php b/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
index 93e73a0638..f53d3ebd26 100644
--- a/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
@@ -42,7 +42,7 @@ public function testDuplicateView() {
     $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
 
     // Assert that the page title is correctly displayed.
-    $this->assertText($view['label']);
+    $this->assertSession()->responseContains($view['label']);
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
index 28eef97864..9901425090 100644
--- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
@@ -93,12 +93,12 @@ public function testExposedAdminUi() {
     $edit = [];
     $edit['options[expose][identifier]'] = '';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertText(t('The identifier is required if the filter is exposed.'));
+    $this->assertSession()->responseContains(t('The identifier is required if the filter is exposed.'));
 
     $edit = [];
     $edit['options[expose][identifier]'] = 'value';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertText(t('This identifier is not allowed.'));
+    $this->assertSession()->responseContains(t('This identifier is not allowed.'));
 
     // Now check the sort criteria.
     $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/sort/created');
@@ -233,7 +233,7 @@ public function testGroupedFilterAdminUiErrors() {
     $edit["options[group_info][group_items][1][title]"] = '';
     $edit["options[group_info][group_items][1][operator]"] = 'empty';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertText($this->groupFormUiErrors['missing_title_empty_operator']);
+    $this->assertSession()->responseContains($this->groupFormUiErrors['missing_title_empty_operator']);
 
     // Specify a title without a value.
     $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
@@ -242,7 +242,7 @@ public function testGroupedFilterAdminUiErrors() {
     $edit = [];
     $edit["options[group_info][group_items][1][title]"] = 'Is Article';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertText($this->groupFormUiErrors['missing_value']);
+    $this->assertSession()->responseContains($this->groupFormUiErrors['missing_value']);
 
     // Specify a value without a title.
     $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
@@ -250,7 +250,7 @@ public function testGroupedFilterAdminUiErrors() {
     $edit["options[group_info][group_items][1][title]"] = '';
     $edit["options[group_info][group_items][1][value][article]"] = 'article';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertText($this->groupFormUiErrors['missing_title']);
+    $this->assertSession()->responseContains($this->groupFormUiErrors['missing_title']);
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/FieldUITest.php b/core/modules/views_ui/tests/src/Functional/FieldUITest.php
index 4c52aea7cc..c012fbe2fa 100644
--- a/core/modules/views_ui/tests/src/Functional/FieldUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/FieldUITest.php
@@ -31,14 +31,14 @@ class FieldUITest extends UITestBase {
   public function testFieldUI() {
     // Ensure the field is not marked as hidden on the first run.
     $this->drupalGet('admin/structure/views/view/test_view/edit');
-    $this->assertText('Views test: Name');
-    $this->assertNoText('Views test: Name [' . t('hidden') . ']');
+    $this->assertSession()->responseContains('Views test: Name');
+    $this->assertSession()->responseNotContains('Views test: Name [' . t('hidden') . ']');
 
     // Hides the field and check whether the hidden label is appended.
     $edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/name';
     $this->drupalPostForm($edit_handler_url, ['options[exclude]' => TRUE], t('Apply'));
 
-    $this->assertText('Views test: Name [' . t('hidden') . ']');
+    $this->assertSession()->responseContains('Views test: Name [' . t('hidden') . ']');
 
     // Ensure that the expected tokens appear in the UI.
     $edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/age';
diff --git a/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php b/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php
index eac88e4dd2..a11167a2f1 100644
--- a/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php
+++ b/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php
@@ -64,17 +64,17 @@ public function testFilterNumericUI() {
 
     // Test that the exposed filter works as expected.
     $this->drupalGet('test_view-path');
-    $this->assertText('John');
-    $this->assertText('Paul');
-    $this->assertText('Ringo');
-    $this->assertText('George');
-    $this->assertText('Meredith');
+    $this->assertSession()->responseContains('John');
+    $this->assertSession()->responseContains('Paul');
+    $this->assertSession()->responseContains('Ringo');
+    $this->assertSession()->responseContains('George');
+    $this->assertSession()->responseContains('Meredith');
     $this->drupalPostForm(NULL, ['age' => '2'], 'Apply');
-    $this->assertText('John');
-    $this->assertText('Paul');
-    $this->assertNoText('Ringo');
-    $this->assertText('George');
-    $this->assertNoText('Meredith');
+    $this->assertSession()->responseContains('John');
+    $this->assertSession()->responseContains('Paul');
+    $this->assertSession()->responseNotContains('Ringo');
+    $this->assertSession()->responseContains('George');
+    $this->assertSession()->responseNotContains('Meredith');
 
     // Change the filter to a single filter to test the schema when the operator
     // is not exposed.
@@ -87,17 +87,17 @@ public function testFilterNumericUI() {
 
     // Test that the filter works as expected.
     $this->drupalGet('test_view-path');
-    $this->assertText('John');
-    $this->assertNoText('Paul');
-    $this->assertNoText('Ringo');
-    $this->assertNoText('George');
-    $this->assertNoText('Meredith');
+    $this->assertSession()->responseContains('John');
+    $this->assertSession()->responseNotContains('Paul');
+    $this->assertSession()->responseNotContains('Ringo');
+    $this->assertSession()->responseNotContains('George');
+    $this->assertSession()->responseNotContains('Meredith');
     $this->drupalPostForm(NULL, ['age' => '26'], t('Apply'));
-    $this->assertNoText('John');
-    $this->assertText('Paul');
-    $this->assertNoText('Ringo');
-    $this->assertNoText('George');
-    $this->assertNoText('Meredith');
+    $this->assertSession()->responseNotContains('John');
+    $this->assertSession()->responseContains('Paul');
+    $this->assertSession()->responseNotContains('Ringo');
+    $this->assertSession()->responseNotContains('George');
+    $this->assertSession()->responseNotContains('Meredith');
 
     // Change the filter to a 'between' filter to test if the label and
     // description are set for the 'minimum' filter element.
diff --git a/core/modules/views_ui/tests/src/Functional/FilterUITest.php b/core/modules/views_ui/tests/src/Functional/FilterUITest.php
index 651ede4d25..635d4cb539 100644
--- a/core/modules/views_ui/tests/src/Functional/FilterUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/FilterUITest.php
@@ -105,14 +105,14 @@ public function testFilterIdentifier() {
       'options[expose][identifier]' => '',
     ];
     $this->drupalPostForm($path, $edit, t('Apply'));
-    $this->assertText('The identifier is required if the filter is exposed.');
+    $this->assertSession()->responseContains('The identifier is required if the filter is exposed.');
 
     // Set the identifier to 'value'.
     $edit = [
       'options[expose][identifier]' => 'value',
     ];
     $this->drupalPostForm($path, $edit, t('Apply'));
-    $this->assertText('This identifier is not allowed.');
+    $this->assertSession()->responseContains('This identifier is not allowed.');
 
     // Try a few restricted values for the identifier.
     foreach (['value value', 'value^value'] as $identifier) {
@@ -120,7 +120,7 @@ public function testFilterIdentifier() {
         'options[expose][identifier]' => $identifier,
       ];
       $this->drupalPostForm($path, $edit, t('Apply'));
-      $this->assertText('This identifier has illegal characters.');
+      $this->assertSession()->responseContains('This identifier has illegal characters.');
     }
   }
 
diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
index dc2101b817..ebed53d3a8 100644
--- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php
+++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
@@ -230,7 +230,7 @@ public function testBrokenHandlers() {
       ];
 
       foreach ($original_configuration as $key => $value) {
-        $this->assertText(new FormattableMarkup('@key: @value', ['@key' => $key, '@value' => $value]));
+        $this->assertSession()->responseContains(new FormattableMarkup('@key: @value', ['@key' => $key, '@value' => $value]));
       }
     }
   }
@@ -265,12 +265,12 @@ public function testErrorMissingHelp() {
     // Test that the error message is not shown for entity fields but an empty
     // description field is shown instead.
     $this->drupalGet('admin/structure/views/nojs/add-handler/test_node_view/default/field');
-    $this->assertNoText('Error: missing help');
+    $this->assertSession()->responseNotContains('Error: missing help');
     $this->assertRaw('<td class="description"></td>', 'Empty description found');
 
     // Test that no error message is shown for other fields.
     $this->drupalGet('admin/structure/views/nojs/add-handler/test_view_empty/default/field');
-    $this->assertNoText('Error: missing help');
+    $this->assertSession()->responseNotContains('Error: missing help');
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php b/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php
index 2354eba1b7..6813f42c51 100644
--- a/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php
+++ b/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php
@@ -52,19 +52,19 @@ public function testOverrideDisplays() {
     // Make sure the title appears in the page.
     $this->drupalGet($view_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($original_title);
+    $this->assertSession()->responseContains($original_title);
 
     // Confirm that the view block is available in the block administration UI.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
     $this->clickLink('Place block');
-    $this->assertText($view['label']);
+    $this->assertSession()->responseContains($view['label']);
 
     // Place the block.
     $this->drupalPlaceBlock("views_block:{$view['id']}-block_1");
 
     // Make sure the title appears in the block.
     $this->drupalGet('');
-    $this->assertText($original_title);
+    $this->assertSession()->responseContains($original_title);
 
     // Change the title for the page display only, and make sure that the
     // original title still appears on the page.
@@ -75,8 +75,8 @@ public function testOverrideDisplays() {
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/page_1", [], t('Save'));
     $this->drupalGet($view_path);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($new_title);
-    $this->assertText($original_title);
+    $this->assertSession()->responseContains($new_title);
+    $this->assertSession()->responseContains($original_title);
   }
 
   /**
@@ -107,17 +107,17 @@ public function testWizardMixedDefaultOverriddenDisplays() {
     // titles.
     $this->drupalGet($view['page[path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($view['page[title]']);
-    $this->assertNoText($view['block[title]']);
+    $this->assertSession()->responseContains($view['page[title]']);
+    $this->assertSession()->responseNotContains($view['block[title]']);
     $this->drupalGet($view['page[feed_properties][path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($view['page[title]']);
-    $this->assertNoText($view['block[title]']);
+    $this->assertSession()->responseContains($view['page[title]']);
+    $this->assertSession()->responseNotContains($view['block[title]']);
 
     // Confirm that the block is available in the block administration UI.
     $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
     $this->clickLink('Place block');
-    $this->assertText($view['label']);
+    $this->assertSession()->responseContains($view['label']);
 
     // Put the block into the first sidebar region, and make sure it will not
     // display on the view's page display (since we will be searching for the
@@ -132,8 +132,8 @@ public function testWizardMixedDefaultOverriddenDisplays() {
     ]);
 
     $this->drupalGet('');
-    $this->assertText($view['block[title]']);
-    $this->assertNoText($view['page[title]']);
+    $this->assertSession()->responseContains($view['block[title]']);
+    $this->assertSession()->responseNotContains($view['page[title]']);
 
     // Edit the page and change the title. This should automatically change
     // the feed's title also, but not the block.
@@ -143,18 +143,18 @@ public function testWizardMixedDefaultOverriddenDisplays() {
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/page_1", [], t('Save'));
     $this->drupalGet($view['page[path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($new_default_title);
-    $this->assertNoText($view['page[title]']);
-    $this->assertNoText($view['block[title]']);
+    $this->assertSession()->responseContains($new_default_title);
+    $this->assertSession()->responseNotContains($view['page[title]']);
+    $this->assertSession()->responseNotContains($view['block[title]']);
     $this->drupalGet($view['page[feed_properties][path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($new_default_title);
-    $this->assertNoText($view['page[title]']);
-    $this->assertNoText($view['block[title]']);
+    $this->assertSession()->responseContains($new_default_title);
+    $this->assertSession()->responseNotContains($view['page[title]']);
+    $this->assertSession()->responseNotContains($view['block[title]']);
     $this->drupalGet('');
-    $this->assertNoText($new_default_title);
-    $this->assertNoText($view['page[title]']);
-    $this->assertText($view['block[title]']);
+    $this->assertSession()->responseNotContains($new_default_title);
+    $this->assertSession()->responseNotContains($view['page[title]']);
+    $this->assertSession()->responseContains($view['block[title]']);
 
     // Edit the block and change the title. This should automatically change
     // the block title only, and leave the defaults alone.
@@ -164,14 +164,14 @@ public function testWizardMixedDefaultOverriddenDisplays() {
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/block_1", [], t('Save'));
     $this->drupalGet($view['page[path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($new_default_title);
+    $this->assertSession()->responseContains($new_default_title);
     $this->drupalGet($view['page[feed_properties][path]']);
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText($new_default_title);
-    $this->assertNoText($new_block_title);
+    $this->assertSession()->responseContains($new_default_title);
+    $this->assertSession()->responseNotContains($new_block_title);
     $this->drupalGet('');
-    $this->assertText($new_block_title);
-    $this->assertNoText($view['block[title]']);
+    $this->assertSession()->responseContains($new_block_title);
+    $this->assertSession()->responseNotContains($view['block[title]']);
   }
 
   /**
@@ -198,7 +198,7 @@ public function testRevertAllDisplays() {
 
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/block_1/title", $edit, t('Apply'));
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/block_1", [], t('Save'));
-    $this->assertText($view['page[title]']);
+    $this->assertSession()->responseContains($view['page[title]']);
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/PreviewTest.php b/core/modules/views_ui/tests/src/Functional/PreviewTest.php
index 735c0c4c72..0b40220ad3 100644
--- a/core/modules/views_ui/tests/src/Functional/PreviewTest.php
+++ b/core/modules/views_ui/tests/src/Functional/PreviewTest.php
@@ -39,9 +39,9 @@ public function testPreviewContextual() {
 
     // Test that area text and exposed filters are present and rendered.
     $this->assertFieldByName('id', NULL, 'ID exposed filter field found.');
-    $this->assertText('Test header text', 'Rendered header text found');
-    $this->assertText('Test footer text', 'Rendered footer text found.');
-    $this->assertText('Test empty text', 'Rendered empty text found.');
+    $this->assertSession()->responseContains('Test header text', 'Rendered header text found');
+    $this->assertSession()->responseContains('Test footer text', 'Rendered footer text found.');
+    $this->assertSession()->responseContains('Test empty text', 'Rendered empty text found.');
   }
 
   /**
@@ -70,9 +70,9 @@ public function testPreviewUI() {
 
     // Test that area text and exposed filters are present and rendered.
     $this->assertFieldByName('id', NULL, 'ID exposed filter field found.');
-    $this->assertText('Test header text', 'Rendered header text found');
-    $this->assertText('Test footer text', 'Rendered footer text found.');
-    $this->assertText('Test empty text', 'Rendered empty text found.');
+    $this->assertSession()->responseContains('Test header text', 'Rendered header text found');
+    $this->assertSession()->responseContains('Test footer text', 'Rendered footer text found.');
+    $this->assertSession()->responseContains('Test empty text', 'Rendered empty text found.');
 
     // Test feed preview.
     $view = [];
@@ -95,17 +95,17 @@ public function testPreviewUI() {
     $settings->set('ui.show.performance_statistics', TRUE)->save();
     $this->drupalGet('admin/structure/views/view/test_preview/edit');
     $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview'));
-    $this->assertText(t('Query build time'));
-    $this->assertText(t('Query execute time'));
-    $this->assertText(t('View render time'));
+    $this->assertSession()->responseContains(t('Query build time'));
+    $this->assertSession()->responseContains(t('Query execute time'));
+    $this->assertSession()->responseContains(t('View render time'));
     $this->assertNoRaw('<strong>Query</strong>');
 
     // Statistics and query.
     $settings->set('ui.show.sql_query.enabled', TRUE)->save();
     $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview'));
-    $this->assertText(t('Query build time'));
-    $this->assertText(t('Query execute time'));
-    $this->assertText(t('View render time'));
+    $this->assertSession()->responseContains(t('Query build time'));
+    $this->assertSession()->responseContains(t('Query execute time'));
+    $this->assertSession()->responseContains(t('View render time'));
     $this->assertRaw('<strong>Query</strong>');
     $query_string = <<<SQL
 SELECT "views_test_data"."name" AS "views_test_data_name"
@@ -160,7 +160,7 @@ public function testPreviewError() {
 
     $this->drupalPostForm(NULL, $edit = [], t('Update preview'));
 
-    $this->assertText('Unable to preview due to validation errors.', 'Preview error text found.');
+    $this->assertSession()->responseContains('Unable to preview due to validation errors.', 'Preview error text found.');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/SettingsTest.php b/core/modules/views_ui/tests/src/Functional/SettingsTest.php
index 6c16a7e161..9e25496104 100644
--- a/core/modules/views_ui/tests/src/Functional/SettingsTest.php
+++ b/core/modules/views_ui/tests/src/Functional/SettingsTest.php
@@ -43,7 +43,7 @@ public function testEditUI() {
 
     // Test the confirmation message.
     $this->drupalPostForm('admin/structure/views/settings', [], t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
 
     // Configure to always show the master display.
     $edit = [
@@ -130,7 +130,7 @@ public function testEditUI() {
 
     // Test the confirmation message.
     $this->drupalPostForm('admin/structure/views/settings/advanced', [], t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'));
+    $this->assertSession()->responseContains(t('The configuration options have been saved.'));
 
     $edit = [
       'skip_cache' => TRUE,
@@ -143,7 +143,7 @@ public function testEditUI() {
 
     // Test the "Clear Views' cache" button.
     $this->drupalPostForm('admin/structure/views/settings/advanced', [], t("Clear Views' cache"));
-    $this->assertText(t('The cache has been cleared.'));
+    $this->assertSession()->responseContains(t('The cache has been cleared.'));
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/StyleUITest.php b/core/modules/views_ui/tests/src/Functional/StyleUITest.php
index 0bd7e98639..2d088476b3 100644
--- a/core/modules/views_ui/tests/src/Functional/StyleUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/StyleUITest.php
@@ -64,7 +64,7 @@ public function testStyleUI() {
     $this->drupalPostForm("admin/structure/views/view/$view_name/edit", [], 'Add Page');
     $this->drupalPostForm("admin/structure/views/nojs/display/$view_name/page_1/row", ['row[type]' => 'fields'], t('Apply'));
     // If fields are being used this text will not be shown.
-    $this->assertNoText(t('The selected style or row format does not use fields.'));
+    $this->assertSession()->responseNotContains(t('The selected style or row format does not use fields.'));
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php b/core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php
index 922c247177..45e16b85b9 100644
--- a/core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php
@@ -42,9 +42,9 @@ public function testTokenUI() {
 
     $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.area]' => 'views.area'], 'Add and configure header');
     // Test that field tokens are shown.
-    $this->assertText('{{ title }} == Content: Title');
+    $this->assertSession()->responseContains('{{ title }} == Content: Title');
     // Test that argument tokens are shown.
-    $this->assertText('{{ arguments.null }} == Global: Null title');
+    $this->assertSession()->responseContains('{{ arguments.null }} == Global: Null title');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php b/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php
index c99c9b71f9..2d8c6266f6 100644
--- a/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php
+++ b/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php
@@ -82,7 +82,7 @@ public function testTranslatedStrings() {
     // Check if the label is translated.
     $this->drupalGet($edit_url, ['language' => \Drupal::languageManager()->getLanguage('fr')]);
     $this->assertTitle('Files (File) | Drupal');
-    $this->assertNoText('Fichiers');
+    $this->assertSession()->responseNotContains('Fichiers');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php b/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php
index be5d1387f6..9f1a3cbfeb 100644
--- a/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php
+++ b/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php
@@ -66,7 +66,7 @@ public function testUnsavedPageDisplayPreview() {
 
     $this->drupalPostForm(NULL, [], t('Update preview'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertText(t('This display has no path'));
+    $this->assertSession()->responseContains(t('This display has no path'));
 
     $this->drupalGet('admin/structure/views/view/content/edit/page_2');
     $this->assertSession()->statusCodeEquals(200);
diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
index c5cef7402c..f051ce9b5e 100644
--- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
+++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
@@ -54,7 +54,7 @@ public function testOtherOptions() {
     // Test that a long administrative comment is truncated.
     $edit = ['display_comment' => 'one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen'];
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/attachment_1/display_comment', $edit, 'Apply');
-    $this->assertText('one two three four five six seven eight nine ten eleven twelve thirteen fourteen...');
+    $this->assertSession()->responseContains('one two three four five six seven eight nine ten eleven twelve thirteen fourteen...');
 
     // Change the machine name for the display from page_1 to test_1.
     $edit = ['display_id' => 'test_1'];
@@ -90,16 +90,16 @@ public function testOtherOptions() {
 
     $edit = ['display_id' => 'test 1'];
     $this->drupalPostForm($machine_name_edit_url, $edit, 'Apply');
-    $this->assertText($error_text);
+    $this->assertSession()->responseContains($error_text);
 
     $edit = ['display_id' => 'test_1#'];
     $this->drupalPostForm($machine_name_edit_url, $edit, 'Apply');
-    $this->assertText($error_text);
+    $this->assertSession()->responseContains($error_text);
 
     // Test using an existing display ID.
     $edit = ['display_id' => 'default'];
     $this->drupalPostForm($machine_name_edit_url, $edit, 'Apply');
-    $this->assertText(t('Display id should be unique.'));
+    $this->assertSession()->responseContains(t('Display id should be unique.'));
 
     // Test that the display ID has not been changed.
     $this->drupalGet('admin/structure/views/view/test_view/edit/test_1');
@@ -164,7 +164,7 @@ public function testEditFormLanguageOptions() {
       $this->drupalGet($langcode_url);
       $this->assertSession()->statusCodeEquals(200);
       if ($view_name == 'test_view') {
-        $this->assertText(t('The view is not based on a translatable entity type or the site is not multilingual.'));
+        $this->assertSession()->responseContains(t('The view is not based on a translatable entity type or the site is not multilingual.'));
       }
       else {
         $this->assertFieldByName('rendering_language', '***LANGUAGE_entity_translation***');
diff --git a/core/modules/views_ui/tests/src/Functional/WizardTest.php b/core/modules/views_ui/tests/src/Functional/WizardTest.php
index 855efeddc1..15f67311ae 100644
--- a/core/modules/views_ui/tests/src/Functional/WizardTest.php
+++ b/core/modules/views_ui/tests/src/Functional/WizardTest.php
@@ -38,13 +38,13 @@ public function testWizardFieldLength() {
 
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
-    $this->assertText('Machine-readable name cannot be longer than 128 characters but is currently 129 characters long.');
-    $this->assertText('Path cannot be longer than 254 characters but is currently 255 characters long.');
-    $this->assertText('Page title cannot be longer than 255 characters but is currently 256 characters long.');
-    $this->assertText('View name cannot be longer than 255 characters but is currently 256 characters long.');
-    $this->assertText('Feed path cannot be longer than 254 characters but is currently 255 characters long.');
-    $this->assertText('Block title cannot be longer than 255 characters but is currently 256 characters long.');
-    $this->assertText('REST export path cannot be longer than 254 characters but is currently 255 characters long.');
+    $this->assertSession()->responseContains('Machine-readable name cannot be longer than 128 characters but is currently 129 characters long.');
+    $this->assertSession()->responseContains('Path cannot be longer than 254 characters but is currently 255 characters long.');
+    $this->assertSession()->responseContains('Page title cannot be longer than 255 characters but is currently 256 characters long.');
+    $this->assertSession()->responseContains('View name cannot be longer than 255 characters but is currently 256 characters long.');
+    $this->assertSession()->responseContains('Feed path cannot be longer than 254 characters but is currently 255 characters long.');
+    $this->assertSession()->responseContains('Block title cannot be longer than 255 characters but is currently 256 characters long.');
+    $this->assertSession()->responseContains('REST export path cannot be longer than 254 characters but is currently 255 characters long.');
 
     $view['label'] = $this->randomMachineName(255);
     $view['id'] = strtolower($this->randomMachineName(128));
@@ -61,7 +61,7 @@ public function testWizardFieldLength() {
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
     $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
     // Assert that the page title is correctly truncated.
-    $this->assertText(views_ui_truncate($view['page[title]'], 32));
+    $this->assertSession()->responseContains(views_ui_truncate($view['page[title]'], 32));
   }
 
 }
diff --git a/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php b/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php
index 4490d7ee25..c6fa8e1a1b 100644
--- a/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php
+++ b/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php
@@ -178,11 +178,11 @@ public function testWorkspaceFieldUi() {
 
     // Check that the field is displayed on the manage form display page.
     $this->drupalGet('admin/config/workflow/workspaces/form-display');
-    $this->assertText($field_label);
+    $this->assertSession()->responseContains($field_label);
 
     // Check that the field is displayed on the manage display page.
     $this->drupalGet('admin/config/workflow/workspaces/display');
-    $this->assertText($field_label);
+    $this->assertSession()->responseContains($field_label);
   }
 
 }
