diff --git a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
index 5b19c36727101941f2bab9d9e2e22c7a6d68c97f..5e5ac32d06b4598dbbf3947cf183affff0d84f41 100644
--- a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
@@ -66,7 +66,7 @@ public function testFeedLabelEscaping() {
     $this->assertSession()->statusCodeEquals(200);
 
     $this->assertSession()->assertEscaped('Test feed title <script>alert(123);</script>');
-    $this->assertNoRaw('Test feed title <script>alert(123);</script>');
+    $this->assertSession()->responseNotContains('Test feed title <script>alert(123);</script>');
 
     // Ensure the feed icon title is escaped.
     $this->assertStringContainsString('class="feed-icon">  Subscribe to Test feed title &lt;script&gt;alert(123);&lt;/script&gt; feed</a>', str_replace(["\n", "\r"], '', $this->getSession()->getPage()->getContent()));
diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
index 2e3ccf723461b0a1758be3e1664e2eded8cb7b56..e4fbb201786b9a620687098b8496142c3c46efd7 100644
--- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
+++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
@@ -88,18 +88,18 @@ public function testNoJsDetection() {
     $this->drupalGet(Url::fromRoute('<front>'));
     $this->assertSessionCookieExists(FALSE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
-    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
-    $this->assertNoRaw($no_js_to_js_markup);
+    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
+    $this->assertSession()->responseNotContains($no_js_to_js_markup);
 
     // 2. Session (authenticated).
     $this->drupalLogin($this->rootUser);
     $this->assertSessionCookieExists(TRUE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
     $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . UrlHelper::encodePath(base_path() . 'user/1?check_logged_in=1') . '" />' . "\n" . '</noscript>');
-    $this->assertNoRaw($no_js_to_js_markup);
+    $this->assertSession()->responseNotContains($no_js_to_js_markup);
     $this->assertBigPipeNoJsMetaRefreshRedirect();
     $this->assertBigPipeNoJsCookieExists(TRUE);
-    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
+    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
     $this->assertRaw($no_js_to_js_markup);
     $this->drupalLogout();
 
@@ -112,10 +112,10 @@ public function testNoJsDetection() {
     $this->assertSessionCookieExists(TRUE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
     $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" />' . "\n" . '</noscript>');
-    $this->assertNoRaw($no_js_to_js_markup);
+    $this->assertSession()->responseNotContains($no_js_to_js_markup);
     $this->assertBigPipeNoJsMetaRefreshRedirect();
     $this->assertBigPipeNoJsCookieExists(TRUE);
-    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
+    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
     $this->assertRaw($no_js_to_js_markup);
 
     // Close the prior connection and remove the collected state.
@@ -125,14 +125,14 @@ public function testNoJsDetection() {
     $this->drupalGet(Url::fromRoute('no_big_pipe'));
     $this->assertSessionCookieExists(FALSE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
-    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
-    $this->assertNoRaw($no_js_to_js_markup);
+    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
+    $this->assertSession()->responseNotContains($no_js_to_js_markup);
     $this->drupalLogin($this->rootUser);
     $this->drupalGet(Url::fromRoute('no_big_pipe'));
     $this->assertSessionCookieExists(TRUE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
-    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
-    $this->assertNoRaw($no_js_to_js_markup);
+    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
+    $this->assertSession()->responseNotContains($no_js_to_js_markup);
   }
 
   /**
@@ -215,8 +215,8 @@ public function testBigPipe() {
     $this->assertRaw('The website encountered an unexpected error. Please try again later');
     $this->assertRaw('You are not allowed to say llamas are not cool!');
     // Check that stop signal and closing body tag are absent.
-    $this->assertNoRaw(BigPipe::STOP_SIGNAL);
-    $this->assertNoRaw('</body>');
+    $this->assertSession()->responseNotContains(BigPipe::STOP_SIGNAL);
+    $this->assertSession()->responseNotContains('</body>');
     // The exception is expected. Do not interpret it as a test failure.
     unlink($this->root . '/' . $this->siteDirectory . '/error.log');
   }
@@ -266,8 +266,8 @@ public function testBigPipeNoJs() {
     // Verifying there are no BigPipe placeholders & replacements.
     $this->assertSession()->responseHeaderEquals('BigPipe-Test-Placeholders', '<none>');
     // Verifying BigPipe start/stop signals are absent.
-    $this->assertNoRaw(BigPipe::START_SIGNAL);
-    $this->assertNoRaw(BigPipe::STOP_SIGNAL);
+    $this->assertSession()->responseNotContains(BigPipe::START_SIGNAL);
+    $this->assertSession()->responseNotContains(BigPipe::STOP_SIGNAL);
 
     // Verifying BigPipe assets are absent.
     $this->assertArrayNotHasKey('bigPipePlaceholderIds', $this->getDrupalSettings());
@@ -286,7 +286,7 @@ public function testBigPipeNoJs() {
     // The 'edge_case__html_exception' case throws an exception.
     $this->assertRaw('The website encountered an unexpected error. Please try again later');
     $this->assertRaw('You are not allowed to say llamas are not cool!');
-    $this->assertNoRaw('</body>');
+    $this->assertSession()->responseNotContains('</body>');
     // The exception is expected. Do not interpret it as a test failure.
     unlink($this->root . '/' . $this->siteDirectory . '/error.log');
   }
@@ -309,8 +309,8 @@ public function testBigPipeMultiOccurrencePlaceholders() {
     $big_pipe_placeholder_id = 'callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages&amp;args%5B0%5D&amp;token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA';
     $expected_placeholder_replacement = '<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="' . $big_pipe_placeholder_id . '">';
     $this->assertRaw('The count is 1.');
-    $this->assertNoRaw('The count is 2.');
-    $this->assertNoRaw('The count is 3.');
+    $this->assertSession()->responseNotContains('The count is 2.');
+    $this->assertSession()->responseNotContains('The count is 3.');
     $raw_content = $this->getSession()->getPage()->getContent();
     $this->assertSame(1, substr_count($raw_content, $expected_placeholder_replacement), 'Only one placeholder replacement was found for the duplicate #lazy_builder arrays.');
 
@@ -323,8 +323,8 @@ public function testBigPipeMultiOccurrencePlaceholders() {
     $this->assertBigPipeNoJsCookieExists(TRUE);
     $this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence'));
     $this->assertRaw('The count is 1.');
-    $this->assertNoRaw('The count is 2.');
-    $this->assertNoRaw('The count is 3.');
+    $this->assertSession()->responseNotContains('The count is 2.');
+    $this->assertSession()->responseNotContains('The count is 3.');
   }
 
   protected function assertBigPipeResponseHeadersPresent() {
@@ -346,7 +346,7 @@ protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_p
     foreach ($expected_big_pipe_nojs_placeholders as $big_pipe_nojs_placeholder => $expected_replacement) {
       // Checking whether the replacement for the BigPipe no-JS placeholder
       // $big_pipe_nojs_placeholder is present.
-      $this->assertNoRaw($big_pipe_nojs_placeholder);
+      $this->assertSession()->responseNotContains($big_pipe_nojs_placeholder);
       if ($expected_replacement !== NULL) {
         $this->assertRaw($expected_replacement);
       }
@@ -377,7 +377,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
       $result = $this->xpath('//script[@data-big-pipe-replacement-for-placeholder-with-id=:id]', [':id' => Html::decodeEntities($big_pipe_placeholder_id)]);
       if ($expected_ajax_response === NULL) {
         $this->assertCount(0, $result);
-        $this->assertNoRaw($expected_placeholder_replacement);
+        $this->assertSession()->responseNotContains($expected_placeholder_replacement);
         continue;
       }
       $this->assertEquals($expected_ajax_response, trim($result[0]->getText()));
@@ -495,7 +495,7 @@ protected function assertBigPipeNoJsMetaRefreshRedirect() {
     $this->assertEquals('no-store, content="BigPipe/1.0"', $headers[1]['Surrogate-Control'][0], 'The second response has a "Surrogate-Control" header.');
 
     // Check that the <meta> refresh is absent, only one redirect ever happens.
-    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
+    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php b/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php
index 1bae75e734ae7cc97f4e5a4c324500585b2884ca..187cacf3a606c47e48899e8e5191bade509b5023 100644
--- a/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php
+++ b/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php
@@ -80,8 +80,8 @@ public function testSevenAdminTheme() {
     $this->drupalGet('admin');
 
     // Check if contextual link classes are unavailable.
-    $this->assertNoRaw('<div data-contextual-id="block:block=' . $block->id() . ':langcode=en"></div>');
-    $this->assertNoRaw('contextual-region');
+    $this->assertSession()->responseNotContains('<div data-contextual-id="block:block=' . $block->id() . ':langcode=en"></div>');
+    $this->assertSession()->responseNotContains('contextual-region');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php
index 1663175b1bcdba28b702e3ed7479570e00554189..8bd22cb96b2f1f6d0a270634de8892e334ceba9f 100644
--- a/core/modules/block/tests/src/Functional/BlockTest.php
+++ b/core/modules/block/tests/src/Functional/BlockTest.php
@@ -65,7 +65,7 @@ public function testBlockVisibility() {
 
     // Confirm that an empty block is not displayed.
     $this->assertSession()->pageTextNotContains('Powered by Drupal');
-    $this->assertNoRaw('sidebar-first');
+    $this->assertSession()->responseNotContains('sidebar-first');
   }
 
   /**
@@ -259,7 +259,7 @@ public function testBlock() {
     $this->submitForm([], 'Remove');
     $this->assertSession()->pageTextContains('The block ' . $block->label() . ' has been removed from the Left sidebar region.');
     $this->assertSession()->addressEquals('admin');
-    $this->assertNoRaw($block->id());
+    $this->assertSession()->responseNotContains($block->id());
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php
index a8d0b5c2982e1631d4133d9c2c1aa51276616881..140821922bfce9f75114be8684a9f1be50171eb5 100644
--- a/core/modules/block/tests/src/Functional/BlockUiTest.php
+++ b/core/modules/block/tests/src/Functional/BlockUiTest.php
@@ -217,7 +217,7 @@ public function testContextAwareBlocks() {
     $expected_text = '<div id="test_context_aware--username">' . \Drupal::currentUser()->getAccountName() . '</div>';
     $this->drupalGet('');
     $this->assertSession()->pageTextNotContains('Test context-aware block');
-    $this->assertNoRaw($expected_text);
+    $this->assertSession()->responseNotContains($expected_text);
 
     $block_url = 'admin/structure/block/add/test_context_aware/classy';
     $arguments = [
@@ -264,7 +264,7 @@ public function testContextAwareBlocks() {
 
     // Tests that conditions with missing context are not displayed.
     $this->drupalGet('admin/structure/block/manage/testcontextawareblock');
-    $this->assertNoRaw('No existing type');
+    $this->assertSession()->responseNotContains('No existing type');
     $this->assertSession()->elementNotExists('xpath', '//*[@name="visibility[condition_test_no_existing_type][negate]"]');
   }
 
diff --git a/core/modules/block/tests/src/Functional/BlockXssTest.php b/core/modules/block/tests/src/Functional/BlockXssTest.php
index ed422a9f5af34cb2aa4c64c018dd2f34dfc256a3..069d189b2ba258fa1fc7791e433e5bbd8f4b7ee4 100644
--- a/core/modules/block/tests/src/Functional/BlockXssTest.php
+++ b/core/modules/block/tests/src/Functional/BlockXssTest.php
@@ -51,7 +51,7 @@ public function testXssInTitle() {
     \Drupal::state()->set('block_test.content', $this->randomMachineName());
     $this->drupalGet('');
     // Check that the block title was properly sanitized when rendered.
-    $this->assertNoRaw('<script>alert("XSS label");</script>');
+    $this->assertSession()->responseNotContains('<script>alert("XSS label");</script>');
 
     $this->drupalLogin($this->drupalCreateUser([
       'administer blocks',
@@ -61,7 +61,7 @@ public function testXssInTitle() {
     $this->drupalGet('admin/structure/block/list/' . $default_theme);
     // Check that the block title was properly sanitized in Block Plugin UI
     // Admin page.
-    $this->assertNoRaw("<script>alert('XSS subject');</script>");
+    $this->assertSession()->responseNotContains("<script>alert('XSS subject');</script>");
   }
 
   /**
@@ -76,7 +76,7 @@ public function testXssInCategory() {
     ]));
     $this->drupalGet(Url::fromRoute('block.admin_display'));
     $this->clickLink('Place block');
-    $this->assertNoRaw("<script>alert('XSS category');</script>");
+    $this->assertSession()->responseNotContains("<script>alert('XSS category');</script>");
   }
 
   /**
@@ -92,7 +92,7 @@ public function testBlockXss() {
     $this->drupalGet(Url::fromRoute('block.admin_display'));
     $this->clickLink('Place block');
     // Check that the page does not have double escaped HTML tags.
-    $this->assertNoRaw('&amp;lt;');
+    $this->assertSession()->responseNotContains('&amp;lt;');
   }
 
   /**
@@ -135,14 +135,14 @@ protected function doViewTest() {
     // Assert that the blocks have their admin labels escaped and
     // don't appear anywhere unescaped.
     $this->assertSession()->assertEscaped('<script>alert("view1");</script>');
-    $this->assertNoRaw('<script>alert("view1");</script>');
+    $this->assertSession()->responseNotContains('<script>alert("view1");</script>');
     $this->assertSession()->assertEscaped('<script>alert("view2");</script>: Fish & chips');
-    $this->assertNoRaw('<script>alert("view2");</script>');
-    $this->assertNoRaw('Fish & chips');
+    $this->assertSession()->responseNotContains('<script>alert("view2");</script>');
+    $this->assertSession()->responseNotContains('Fish & chips');
 
     // Assert the Display label doesn't appear anywhere double escaped.
-    $this->assertNoRaw('Fish & chips');
-    $this->assertNoRaw('Fish &amp;amp; chips');
+    $this->assertSession()->responseNotContains('Fish & chips');
+    $this->assertSession()->responseNotContains('Fish &amp;amp; chips');
   }
 
   /**
@@ -158,7 +158,7 @@ protected function doMenuTest() {
     $this->clickLink('Place block');
 
     $this->assertSession()->assertEscaped('<script>alert("menu");</script>');
-    $this->assertNoRaw('<script>alert("menu");</script>');
+    $this->assertSession()->responseNotContains('<script>alert("menu");</script>');
   }
 
   /**
@@ -179,7 +179,7 @@ protected function doBlockContentTest() {
     $this->clickLink('Place block');
 
     $this->assertSession()->assertEscaped('<script>alert("block_content");</script>');
-    $this->assertNoRaw('<script>alert("block_content");</script>');
+    $this->assertSession()->responseNotContains('<script>alert("block_content");</script>');
   }
 
 }
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
index 913c1ac1016022041e73a7ca74313c2923e58b94..f9f0284efb1ba55a4b5686a4aee3e3760b1adcd8 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
@@ -258,7 +258,7 @@ public function testBlockDelete() {
     $this->drupalGet('block/add/basic');
     $this->submitForm($edit2, 'Save');
 
-    $this->assertNoRaw('Error message');
+    $this->assertSession()->responseNotContains('Error message');
 
     // Create another block with no instances, and test we don't get a
     // confirmation message about deleting instances.
diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php
index fec5083a088b604e266934ce048f26c48cd1cb7e..e485efe98d6a791eea79325b8a44d9cd8a5c904e 100644
--- a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php
+++ b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php
@@ -101,11 +101,11 @@ public function testLoading() {
     // Verify that a single text format hidden input does not exist on the page.
     $this->assertSession()->elementNotExists('xpath', '//input[@type="hidden" and contains(@class, "editor")]');
     // Verify that CKEditor glue JS is absent.
-    $this->assertNoRaw($this->getModulePath('ckeditor') . '/js/ckeditor.js');
+    $this->assertSession()->responseNotContains($this->getModulePath('ckeditor') . '/js/ckeditor.js');
 
     // On pages where there would never be a text editor, CKEditor JS is absent.
     $this->drupalGet('user');
-    $this->assertNoRaw($this->getModulePath('ckeditor') . '/js/ckeditor.js');
+    $this->assertSession()->responseNotContains($this->getModulePath('ckeditor') . '/js/ckeditor.js');
 
     // The normal user:
     // - has access to 2 text formats;
diff --git a/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php b/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
index e7ae43df048ff882e70019b912f2267d0b18287b..7520cb5a5282f3d6123f500a4ed07df4618ed8cc 100644
--- a/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
+++ b/core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
@@ -55,7 +55,7 @@ public function testColorPreview() {
     $this->drupalGet($url);
     $this->assertSession()->pageTextContains('TEST COLOR PREVIEW');
 
-    $this->assertNoRaw('<script>alert("security filter test");</script>');
+    $this->assertSession()->responseNotContains('<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 e2072edb28388cea4095230a60bf696c4d20bdd1..d919d17eaa5dbbeeb4e69b835ed51599c92d85ad 100644
--- a/core/modules/color/tests/src/Functional/ColorTest.php
+++ b/core/modules/color/tests/src/Functional/ColorTest.php
@@ -215,7 +215,7 @@ public function testOverrideAndResetScheme() {
 
     $this->drupalGet('');
     // Make sure the color logo is not being used.
-    $this->assertNoRaw('files/color/bartik-');
+    $this->assertSession()->responseNotContains('files/color/bartik-');
     // Make sure the original bartik logo exists.
     $this->assertRaw('bartik/logo.svg');
 
@@ -231,7 +231,7 @@ public function testOverrideAndResetScheme() {
     // Make sure the color logo is being used.
     $this->assertRaw('files/color/bartik-');
     // Make sure the original bartik logo does not exist.
-    $this->assertNoRaw('bartik/logo.svg');
+    $this->assertSession()->responseNotContains('bartik/logo.svg');
 
     // Log in and set the color scheme back to default (delete config).
     $this->drupalLogin($this->bigUser);
@@ -243,7 +243,7 @@ public function testOverrideAndResetScheme() {
     $this->drupalLogout();
     $this->drupalGet('');
     // Make sure the color logo is not being used.
-    $this->assertNoRaw('files/color/bartik-');
+    $this->assertSession()->responseNotContains('files/color/bartik-');
     // Make sure the original bartik logo exists.
     $this->assertRaw('bartik/logo.svg');
   }
diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
index b197181aaf3a890fe0f2508a7336f87dbc85f3ad..d9ae7a1a524173a9ec4aa28ebe5fc503c86b584d 100644
--- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
@@ -158,7 +158,7 @@ public function testAnonymous() {
     $this->performCommentOperation($anonymous_comment3, 'delete');
 
     $this->drupalGet('admin/content/comment');
-    $this->assertNoRaw('comments[' . $anonymous_comment3->id() . ']');
+    $this->assertSession()->responseNotContains('comments[' . $anonymous_comment3->id() . ']');
     $this->drupalLogout();
 
     // Comment 3 was deleted.
diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
index ceb2108c1334401835f54ef6d54b68af9c64e4d3..7a0b96dccad85f7d3a23a27627c587b61f571c96 100644
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
@@ -351,7 +351,7 @@ public function testViewMode() {
     // mode this time.
     $comment_element = $this->cssSelect('.comment-wrapper');
     $this->assertTrue(!empty($comment_element));
-    $this->assertNoRaw('<p>' . $comment_text . '</p>');
+    $this->assertSession()->responseNotContains('<p>' . $comment_text . '</p>');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
index 8b8d78d7b3caa49c9d36afd08c43b58ac390877e..255a51d8d90ce3d6d49d89c24ec67d6d5f8cdc70 100644
--- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
@@ -324,7 +324,7 @@ public function testCommentFunctionality() {
     // Delete the comment.
     $this->performCommentOperation($comment1, 'delete');
     $this->drupalGet('admin/content/comment');
-    $this->assertNoRaw('comments[' . $comment1->id() . ']');
+    $this->assertSession()->responseNotContains('comments[' . $comment1->id() . ']');
 
     // Post another comment.
     $comment1 = $this->postComment($this->entity, $this->randomMachineName(), $this->randomMachineName());
diff --git a/core/modules/comment/tests/src/Functional/CommentRssTest.php b/core/modules/comment/tests/src/Functional/CommentRssTest.php
index 0ea4351205ae42cfd3e62e2dbdd808f1ed15b400..611a636d6103bb6626da6a66b9ba0c1910959130 100644
--- a/core/modules/comment/tests/src/Functional/CommentRssTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentRssTest.php
@@ -78,7 +78,7 @@ public function testCommentRss() {
     $this->node->set('comment', CommentItemInterface::HIDDEN);
     $this->node->save();
     $this->drupalGet('rss.xml');
-    $this->assertNoRaw($raw);
+    $this->assertSession()->responseNotContains($raw);
   }
 
 }
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
index 7a1525b1b2affadff68a823ac0cdd0c1be4337e6..1a96f247f6d03d16a9cfd5dc368ee73fe3ba3212 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
@@ -274,11 +274,11 @@ public function testPager() {
 
     // Item 51 should not be present.
     $this->assertRaw('Test config entity 50');
-    $this->assertNoRaw('Test config entity 51');
+    $this->assertSession()->responseNotContains('Test config entity 51');
 
     // Browse to the next page, test config entity 51 is on page 2.
     $this->clickLink('Page 2');
-    $this->assertNoRaw('Test config entity 50');
+    $this->assertSession()->responseNotContains('Test config entity 50');
     $this->assertRaw('dotted.default');
     $this->assertRaw('Test config entity 51');
   }
diff --git a/core/modules/config/tests/src/Functional/ConfigExportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportUITest.php
index bb711bb996e36f16c767ceb408b464e523c6bf4a..95d6ebdc0f32bc12ce957615bc1c40ee99c5bdc6 100644
--- a/core/modules/config/tests/src/Functional/ConfigExportUITest.php
+++ b/core/modules/config/tests/src/Functional/ConfigExportUITest.php
@@ -90,7 +90,7 @@ public function testExport() {
 
     // Check the single export form doesn't have "form-required" elements.
     $this->drupalGet('admin/config/development/configuration/single/export');
-    $this->assertNoRaw('js-form-required form-required');
+    $this->assertSession()->responseNotContains('js-form-required form-required');
 
     // Ensure the temporary file is not available to users without the
     // permission.
diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
index 5c653b74d3c06983811aea834a07d6d93c61e4aa..22d4b909c74bcca24635ba21aac83d21c34f3666 100644
--- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php
+++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
@@ -128,11 +128,11 @@ public function testImport() {
 
     // Import and verify that both do not appear anymore.
     $this->submitForm([], 'Import all');
-    $this->assertNoRaw('<td>' . $name);
-    $this->assertNoRaw('<td>' . $dynamic_name);
-    $this->assertNoRaw('<td>core.extension');
-    $this->assertNoRaw('<td>system.theme');
-    $this->assertNoRaw('<td>automated_cron.settings');
+    $this->assertSession()->responseNotContains('<td>' . $name);
+    $this->assertSession()->responseNotContains('<td>' . $dynamic_name);
+    $this->assertSession()->responseNotContains('<td>core.extension');
+    $this->assertSession()->responseNotContains('<td>system.theme');
+    $this->assertSession()->responseNotContains('<td>automated_cron.settings');
 
     $this->assertSession()->buttonNotExists('Import all');
 
@@ -199,9 +199,9 @@ public function testImport() {
 
     // Import and verify that both do not appear anymore.
     $this->submitForm([], 'Import all');
-    $this->assertNoRaw('<td>core.extension');
-    $this->assertNoRaw('<td>system.theme');
-    $this->assertNoRaw('<td>automated_cron.settings');
+    $this->assertSession()->responseNotContains('<td>core.extension');
+    $this->assertSession()->responseNotContains('<td>system.theme');
+    $this->assertSession()->responseNotContains('<td>automated_cron.settings');
 
     $this->rebuildContainer();
     $this->assertFalse(\Drupal::moduleHandler()->moduleExists('ban'), 'Ban module uninstalled during import.');
@@ -298,7 +298,7 @@ public function testImportDiff() {
 
     // Load the diff UI and verify that the diff reflects the change.
     $this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
-    $this->assertNoRaw('&amp;nbsp;');
+    $this->assertSession()->responseNotContains('&amp;nbsp;');
     $this->assertSession()->titleEquals("View changes of $config_name | Drupal");
 
     // The following assertions do not use
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
index 3fe24c72b47e2fbaf51a4ae64ee85ce0e5cec347..0fa289de80d78af1f3d8e003bde46ca514414fe8 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
@@ -682,7 +682,7 @@ public function testPluralConfigStringsSourceElements() {
           $this->assertRaw('edit-source-config-names-viewsviewfiles-display-default-display-options-fields-count-format-plural-string-' . $index);
         }
         else {
-          $this->assertNoRaw('edit-source-config-names-viewsviewfiles-display-default-display-options-fields-count-format-plural-string-' . $index);
+          $this->assertSession()->responseNotContains('edit-source-config-names-viewsviewfiles-display-default-display-options-fields-count-format-plural-string-' . $index);
         }
       }
     }
diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
index b91852918bd0bf32bbaa01aa0c4fca381e64321e..6340c5e2424370d6b51a1a683f7ca6b6c34f0006 100644
--- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
@@ -116,7 +116,7 @@ public function testSendPersonalContactMessage() {
     ];
     $this->assertRaw(new FormattableMarkup('@sender_name (@sender_email) sent @recipient_name an email.', $placeholders));
     // Ensure an unescaped version of the email does not exist anywhere.
-    $this->assertNoRaw($this->webUser->getEmail());
+    $this->assertSession()->responseNotContains($this->webUser->getEmail());
 
     // Test HTML mails.
     $mail_config = $this->config('system.mail');
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
index 3a301c9fa26c6445931e858408cf9c77c87e170f..800da5ec9f5bb0ce146b852c6bb49e82f4a09069 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
@@ -46,7 +46,7 @@ public function testEnable() {
 
     $this->drupalGet('admin/config/regional/content-language');
     // The node entity type should not be an option because it has no bundles.
-    $this->assertNoRaw('entity_types[node]');
+    $this->assertSession()->responseNotContains('entity_types[node]');
     // Enable content translation on entity types that have will have a
     // content_translation_uid.
     $edit = [
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
index c5f132bd2615c906e43dd37ed2b64d2eb1aa0eed..93486ebe200551a57d2fbe08396d46827bf54406 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
@@ -116,7 +116,7 @@ protected function doTestBasicTranslation() {
 
     // Assert that HTML is not escaped unexpectedly.
     if ($this->testHTMLEscapeForAllLanguages) {
-      $this->assertNoRaw('&lt;span class=&quot;translation-entity-all-languages&quot;&gt;(all languages)&lt;/span&gt;');
+      $this->assertSession()->responseNotContains('&lt;span class=&quot;translation-entity-all-languages&quot;&gt;(all languages)&lt;/span&gt;');
       $this->assertRaw('<span class="translation-entity-all-languages">(all languages)</span>');
     }
 
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 454574029c83bea47b1708517b9d6d29feaf0cc7..c4f5b021b2f1d17eb0a2f5de9272c976829fefe4 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -79,7 +79,7 @@ public function testDateField() {
       $id = $match[1];
       $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
       $this->assertRaw($date->format($date_format));
-      $this->assertNoRaw($date->format($time_format));
+      $this->assertSession()->responseNotContains($date->format($time_format));
 
       // Verify the date doesn't change if using a timezone that is UTC+12 when
       // the entity is edited through the form.
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index 628a8200f1350a4cefe8ecde3ddba1f9043c5cda..3f65bdb0fc8912e13d146ab4efc56db2b90c67cc 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -94,9 +94,9 @@ public function testDateRangeField() {
       $id = $match[1];
       $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
       $this->assertRaw($start_date->format($date_format));
-      $this->assertNoRaw($start_date->format($time_format));
+      $this->assertSession()->responseNotContains($start_date->format($time_format));
       $this->assertRaw($end_date->format($date_format));
-      $this->assertNoRaw($end_date->format($time_format));
+      $this->assertSession()->responseNotContains($end_date->format($time_format));
 
       // Verify the date doesn't change when entity is edited through the form.
       $entity = EntityTest::load($id);
@@ -500,9 +500,9 @@ public function testAlldayRangeField() {
     $id = $match[1];
     $this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
     $this->assertRaw($start_date->format($date_format));
-    $this->assertNoRaw($start_date->format($time_format));
+    $this->assertSession()->responseNotContains($start_date->format($time_format));
     $this->assertRaw($end_date->format($date_format));
-    $this->assertNoRaw($end_date->format($time_format));
+    $this->assertSession()->responseNotContains($end_date->format($time_format));
 
     /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
     $display_repository = \Drupal::service('entity_display.repository');
diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php
index 1dda6e86bcda557c95801c3b920c3ce8b94d11d5..95070c9a037ada590efe977a6b95e3a0c250a47d 100644
--- a/core/modules/dblog/tests/src/Functional/DbLogTest.php
+++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php
@@ -851,7 +851,7 @@ public function testOverviewLinks() {
     $this->assertSession()->statusCodeEquals(200);
     // Make sure HTML tags are filtered out.
     $this->assertRaw('title="alert(&#039;foo&#039;);Lorem');
-    $this->assertNoRaw("<script>alert('foo');</script>");
+    $this->assertSession()->responseNotContains("<script>alert('foo');</script>");
 
     // Make sure HTML tags are filtered out in admin/reports/dblog/event/ too.
     $this->generateLogEntries(1, ['message' => "<script>alert('foo');</script> <strong>Lorem ipsum</strong>"]);
@@ -859,7 +859,7 @@ public function testOverviewLinks() {
     $query->addExpression('MAX([wid])');
     $wid = $query->execute()->fetchField();
     $this->drupalGet('admin/reports/dblog/event/' . $wid);
-    $this->assertNoRaw("<script>alert('foo');</script>");
+    $this->assertSession()->responseNotContains("<script>alert('foo');</script>");
     $this->assertRaw("alert('foo'); <strong>Lorem ipsum</strong>");
   }
 
diff --git a/core/modules/editor/tests/src/Functional/EditorAdminTest.php b/core/modules/editor/tests/src/Functional/EditorAdminTest.php
index be112b1279d1f104e7f6c9bdd94524ca959aea0f..4aa07e3320045f4312ecd80e730168c0d8e47f00 100644
--- a/core/modules/editor/tests/src/Functional/EditorAdminTest.php
+++ b/core/modules/editor/tests/src/Functional/EditorAdminTest.php
@@ -216,7 +216,7 @@ protected function selectUnicornEditor() {
     $this->assertSame('Unicorn Editor', $options[1]->getText(), 'Option 2 in the Text Editor select is "Unicorn Editor".');
     $this->assertTrue($options[0]->hasAttribute('selected'), 'Option 1 ("None") is selected.');
     // Ensure the none option is selected.
-    $this->assertNoRaw('This option is disabled because no modules that provide a text editor are currently enabled.');
+    $this->assertSession()->pageTextNotContains('This option is disabled because no modules that provide a text editor are currently enabled.');
 
     // Select the "Unicorn Editor" editor and click the "Configure" button.
     $edit = [
diff --git a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php
index fd347167b8ec9de013369f599b611dd533dd9bf3..bc768e1327b5a03069938b0d5e0a111b1cf41d8f 100644
--- a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php
+++ b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php
@@ -90,7 +90,7 @@ public function testEditorUploadImageScale() {
     list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
     $this->assertEquals($image_file_width, $uploaded_image_file_width);
     $this->assertEquals($image_file_height, $uploaded_image_file_height);
-    $this->assertNoRaw((string) new FormattableMarkup('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+    $this->assertSession()->pageTextNotContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels.");
 
     // Case 2: max width smaller than uploaded image: image scaled down.
     $test_image = $testing_image_list[1];
@@ -126,7 +126,7 @@ public function testEditorUploadImageScale() {
     list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri);
     $this->assertEquals($image_file_width, $uploaded_image_file_width);
     $this->assertEquals($image_file_height, $uploaded_image_file_height);
-    $this->assertNoRaw((string) new FormattableMarkup('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', ['%dimensions' => $max_width . 'x' . $max_height]));
+    $this->assertSession()->pageTextNotContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels.");
 
     // Case 5: only max width dimension was provided and it was smaller than
     // uploaded image: image scaled down.
diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
index ef4efa8774296536a2335bde9e9d9daf33e6999f..fb431349b85974f62afb5b7ddb7838d4c9e5f297 100644
--- a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
+++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php
@@ -108,7 +108,7 @@ public function testBooleanField() {
     $this->drupalGet('entity_test/add');
     $this->assertSession()->fieldValueEquals("{$field_name}[value]", '');
     $this->assertSession()->pageTextContains($this->field->label());
-    $this->assertNoRaw($on);
+    $this->assertSession()->responseNotContains($on);
 
     // Submit and ensure it is accepted.
     $edit = [
diff --git a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
index bd7f0739456f7019b37a403cb17b2e790d3e6287..d1e4ee39de2808934f5bfea5dafaf70bad39fe2d 100644
--- a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
+++ b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php
@@ -95,7 +95,7 @@ public function fieldUIAddExistingField($bundle_path, $existing_storage_name, $l
     // contain HTML which will be auto-escaped by Twig.
     $this->assertRaw('field-config-edit-form');
     // Check that the page does not have double escaped HTML tags.
-    $this->assertNoRaw('&amp;lt;');
+    $this->assertSession()->responseNotContains('&amp;lt;');
 
     // Second step: 'Field settings' form.
     $this->submitForm($field_edit, 'Save settings');
diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
index 4299fff0410e3567156be4a0f0c55edf86ca9469..6628e2b663a8ecb25d34889f7059692ae3d233e4 100644
--- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php
@@ -87,7 +87,7 @@ public function testNodeDisplay() {
     $this->drupalGet('node/' . $nid . '/edit');
     $this->submitForm($edit, 'Save');
 
-    $this->assertNoRaw($default_output);
+    $this->assertSession()->responseNotContains($default_output);
 
     // Add a description and make sure that it is displayed.
     $description = $this->randomMachineName();
diff --git a/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/core/modules/filter/tests/src/Functional/FilterAdminTest.php
index d5bf2d8acad446e47c0e85fe24b5e239caa7b48a..b4a2bce29c5685b62d735219650749e0430dcaf0 100644
--- a/core/modules/filter/tests/src/Functional/FilterAdminTest.php
+++ b/core/modules/filter/tests/src/Functional/FilterAdminTest.php
@@ -206,7 +206,7 @@ public function testFilterAdmin() {
     // Check that the fallback format exists and cannot be disabled.
     $this->assertSame($plain, filter_fallback_format(), 'The fallback format is set to plain text.');
     $this->drupalGet('admin/config/content/formats');
-    $this->assertNoRaw('admin/config/content/formats/manage/' . $plain . '/disable');
+    $this->assertSession()->responseNotContains('admin/config/content/formats/manage/' . $plain . '/disable');
     $this->drupalGet('admin/config/content/formats/manage/' . $plain . '/disable');
     $this->assertSession()->statusCodeEquals(403);
 
@@ -457,7 +457,7 @@ public function testDisabledFormat() {
     // The format is not used anymore.
     $this->assertSession()->pageTextNotContains('filtered text');
     // The text is not displayed unfiltered or escaped.
-    $this->assertNoRaw($body_value);
+    $this->assertSession()->responseNotContains($body_value);
     $this->assertSession()->assertNoEscaped($body_value);
 
     // Visit the dblog report page.
@@ -473,7 +473,7 @@ public function testDisabledFormat() {
     $node->save();
     $this->drupalGet($node->toUrl());
     // The text is not displayed unfiltered or escaped.
-    $this->assertNoRaw($body_value);
+    $this->assertSession()->responseNotContains($body_value);
     $this->assertSession()->assertNoEscaped($body_value);
 
     // Visit the dblog report page.
diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
index 185f4f4e56d0b976fec8af5107631ca4b57853b7..f76f6fcfb5524f4363de428a48cb7ca66f8c1071 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
@@ -429,7 +429,7 @@ public function testImageFieldDefaultImage() {
     // Verify that no image style cache tags are found.
     $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:');
     // Default image should not be displayed.
-    $this->assertNoRaw($default_output);
+    $this->assertSession()->responseNotContains($default_output);
     // User supplied image should be displayed.
     $this->assertRaw($image_output);
 
diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php
index c6712dbec0c3e7abba28635dad7c46fe2349061a..22b03b0c08e5baf9a7e3817b0a24303bc03a811a 100644
--- a/core/modules/link/tests/src/Functional/LinkFieldTest.php
+++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php
@@ -300,7 +300,7 @@ public function testLinkTitle() {
 
       if ($title_setting === DRUPAL_DISABLED) {
         $this->assertSession()->fieldNotExists("{$field_name}[0][title]");
-        $this->assertNoRaw('placeholder="Enter the text for this link"');
+        $this->assertSession()->responseNotContains('placeholder="Enter the text for this link"');
       }
       else {
         $this->assertRaw('placeholder="Enter the text for this link"');
diff --git a/core/modules/locale/tests/src/Functional/LocaleExportTest.php b/core/modules/locale/tests/src/Functional/LocaleExportTest.php
index d336289c517e50662a81ecac43abe8e2dbc5a801..4a6a99114684d234f66e1a5ac245bf7cdd22d933 100644
--- a/core/modules/locale/tests/src/Functional/LocaleExportTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleExportTest.php
@@ -104,7 +104,7 @@ public function testExportTranslation() {
     // Ensure the customized translations exist in the file.
     $this->assertRaw('msgstr "janvier"');
     // Ensure no untranslated strings exist in the file.
-    $this->assertNoRaw('msgid "February"');
+    $this->assertSession()->responseNotContains('msgid "February"');
 
     // Export only untranslated French translations.
     $this->drupalGet('admin/config/regional/translate/export');
@@ -118,7 +118,7 @@ public function testExportTranslation() {
     // Ensure we have a translation file.
     $this->assertRaw('# French translation of Drupal');
     // Ensure no customized translations exist in the file.
-    $this->assertNoRaw('msgstr "janvier"');
+    $this->assertSession()->responseNotContains('msgstr "janvier"');
     // Ensure the untranslated strings exist in the file, and with right quotes.
     $this->assertRaw($this->getUntranslatedString());
   }
diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php
index a1dbe6e8b153b7db9768fd3a3cddbb75712ece2e..c40a11863bd65f54f915e2528e284a663ff3ebdc 100644
--- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php
+++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceOEmbedVideoTest.php
@@ -202,14 +202,14 @@ public function testMediaOEmbedVideoSource() {
     $this->drupalGet('media/oembed', ['query' => $query]);
     $assert_session->pageTextContains('By the power of Grayskull, Vimeo works!');
     $this->assertRaw('core/themes/stable/templates/content/media-oembed-iframe.html.twig');
-    $this->assertNoRaw('core/modules/media/templates/media-oembed-iframe.html.twig');
+    $this->assertSession()->responseNotContains('core/modules/media/templates/media-oembed-iframe.html.twig');
 
     // Test themes not inheriting from stable.
     \Drupal::service('theme_installer')->install(['stark']);
     $this->config('system.theme')->set('default', 'stark')->save();
     $this->drupalGet('media/oembed', ['query' => $query]);
     $assert_session->pageTextContains('By the power of Grayskull, Vimeo works!');
-    $this->assertNoRaw('core/themes/stable/templates/content/media-oembed-iframe.html.twig');
+    $this->assertSession()->responseNotContains('core/themes/stable/templates/content/media-oembed-iframe.html.twig');
     $this->assertRaw('core/modules/media/templates/media-oembed-iframe.html.twig');
 
     // Remove the 'view media' permission to test that this restricts access.
diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
index 6b5d5123da40d810e9dc98b22f1bf64e55d37f8a..fd9d1328c5ea86b873f53b83d3b97fd8ca7dd012 100644
--- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
+++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
@@ -268,7 +268,7 @@ public function deleteCustomMenu() {
 
     // Make sure there's no delete button on system menus.
     $this->drupalGet('admin/structure/menu/manage/main');
-    $this->assertNoRaw('edit-delete');
+    $this->assertSession()->responseNotContains('edit-delete');
 
     // Try to delete the main menu.
     $this->drupalGet('admin/structure/menu/manage/main/delete');
diff --git a/core/modules/node/tests/src/Functional/AssertButtonsTrait.php b/core/modules/node/tests/src/Functional/AssertButtonsTrait.php
index 42cbb0eaa70aa6f3746cacf3b322e8725a203739..1be59672f3289e2142f3d495aa0042fc672cf70c 100644
--- a/core/modules/node/tests/src/Functional/AssertButtonsTrait.php
+++ b/core/modules/node/tests/src/Functional/AssertButtonsTrait.php
@@ -35,7 +35,7 @@ public function assertButtons(array $buttons, $dropbutton = TRUE) {
     else {
       // Assert there is a save button.
       $this->assertSession()->buttonExists('Save');
-      $this->assertNoRaw('dropbutton-wrapper');
+      $this->assertSession()->responseNotContains('dropbutton-wrapper');
     }
   }
 
diff --git a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
index f7d3689de4ec73e4a44b0835be9f6214338800da..be68b22395c09506df7ff03dd56e11f65e0ca20e 100644
--- a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
+++ b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
@@ -71,7 +71,7 @@ public function testCommentPager() {
     $this->assertSession()->pageTextContains($node->label());
     $this->assertSession()->pageTextContains('Comments');
     $this->assertRaw('page=1');
-    $this->assertNoRaw('page=2');
+    $this->assertSession()->responseNotContains('page=2');
   }
 
   /**
@@ -103,7 +103,7 @@ public function testForumPager() {
     $this->drupalLogin($this->webUser);
     $this->drupalGet('forum/' . $tid);
     $this->assertRaw('page=1');
-    $this->assertNoRaw('page=2');
+    $this->assertSession()->responseNotContains('page=2');
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php b/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php
index ac5d8fc85093d6549e2a94746b325f552622cab5..10cbb14c5ef02c59c720cb4d9116613b75e56388 100644
--- a/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php
+++ b/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php
@@ -36,7 +36,7 @@ public function testNodeTitleXSS() {
     $this->drupalGet('node/add/page');
     $this->submitForm($edit, 'Preview');
     // Verify that harmful tags are escaped when previewing a node.
-    $this->assertNoRaw($xss);
+    $this->assertSession()->responseNotContains($xss);
 
     $settings = ['title' => $title];
     $node = $this->drupalCreateNode($settings);
@@ -44,10 +44,10 @@ public function testNodeTitleXSS() {
     $this->drupalGet('node/' . $node->id());
     // Titles should be escaped.
     $this->assertRaw('<title>' . Html::escape($title) . ' | Drupal</title>');
-    $this->assertNoRaw($xss);
+    $this->assertSession()->responseNotContains($xss);
 
     $this->drupalGet('node/' . $node->id() . '/edit');
-    $this->assertNoRaw($xss);
+    $this->assertSession()->responseNotContains($xss);
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index ac02282f1b2bab300a53f5a4e8b590febbb01257..e909f5db69ecce23698c2d725779c269dbdccbf9 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -269,7 +269,7 @@ public function testTranslationLinkTheme() {
     $this->submitForm($edit, 'Save configuration');
     $this->drupalGet('node/' . $article->id() . '/translations');
     // Verify that translation uses the frontend theme if edit is frontend.
-    $this->assertNoRaw('core/themes/seven/css/base/elements.css');
+    $this->assertSession()->responseNotContains('core/themes/seven/css/base/elements.css');
 
     // Assert presence of translation page itself (vs. DisabledBundle below).
     $this->assertSession()->statusCodeEquals(200);
diff --git a/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php
index 01275ec02110a6a6fad38b0af14da1a0aaf063cb..a9f22eed41e77432fa1514fd7430816f8d551acb 100644
--- a/core/modules/node/tests/src/Functional/PagePreviewTest.php
+++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php
@@ -326,7 +326,7 @@ public function testPagePreview() {
     $node_type->setPreviewMode(DRUPAL_REQUIRED);
     $node_type->save();
     $this->drupalGet('node/add/page');
-    $this->assertNoRaw('edit-submit');
+    $this->assertSession()->responseNotContains('edit-submit');
     $this->drupalGet('node/add/page');
     $this->submitForm([$title_key => 'Preview'], 'Preview');
     $this->clickLink('Back to content editing');
diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php
index 2f614ee603b078af73e865e2e2b194e6dd304fb8..aff2832b5fe50e16137360043f6377b658072a51 100644
--- a/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php
+++ b/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php
@@ -124,9 +124,7 @@ public function testNodeEditAccess() {
     $this->drupalGet('test-node-bulk-form');
     $this->submitForm($edit, 'Apply to selected items');
     // Test that the action message isn't shown.
-    $this->assertNoRaw(new FormattableMarkup('%action was applied to 1 item.', [
-      '%action' => 'Unpublish content',
-    ]));
+    $this->assertSession()->pageTextNotContains("Unpublish content was applied to 1 item.");
     // Re-load the node and check the status.
     $node = Node::load($node->id());
     $this->assertTrue($node->isPublished(), 'The node is still published.');
diff --git a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
index 0142da7efecb16ac52408e164f67a66967e69cb8..e3d732464eee3144359c73ee3507717afb992a10 100644
--- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
+++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
@@ -320,7 +320,7 @@ public function assertAllowedValuesInput($input_string, $result, $message) {
     $this->drupalGet($this->adminPath);
     $this->submitForm($edit, 'Save field settings');
     // Verify that the page does not have double escaped HTML tags.
-    $this->assertNoRaw('&amp;lt;');
+    $this->assertSession()->responseNotContains('&amp;lt;');
 
     if (is_string($result)) {
       $this->assertSession()->pageTextContains($result);
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
index 699bf0dc82c33cfa284792ff3dd3c372e4025343..64131a273aed74297b9e0085033e449ea0905199 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
@@ -128,13 +128,13 @@ public function testUserPermissions() {
     $this->drupalGet('node/1');
 
     // Library and in-place editors.
-    $this->assertNoRaw('core/modules/quickedit/js/quickedit.js');
-    $this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js');
+    $this->assertSession()->responseNotContains('core/modules/quickedit/js/quickedit.js');
+    $this->assertSession()->responseNotContains('core/modules/quickedit/js/editors/formEditor.js');
 
     // HTML annotation and title class do not exist for users without
     // permission to in-place edit.
-    $this->assertNoRaw('data-quickedit-entity-id="node/1"');
-    $this->assertNoRaw('data-quickedit-field-id="node/1/body/en/full"');
+    $this->assertSession()->responseNotContains('data-quickedit-entity-id="node/1"');
+    $this->assertSession()->responseNotContains('data-quickedit-field-id="node/1/body/en/full"');
     $this->assertSession()->elementNotExists('xpath', '//h1[contains(@class, "js-quickedit-page-title")]');
     $assert->linkNotExists('Quick edit');
 
@@ -191,8 +191,8 @@ public function testWithPendingRevision() {
     $this->drupalGet('node/add/article');
     $this->submitForm(['title[0][value]' => 'foo'], 'Preview');
     // Verify that quickedit is not active on preview.
-    $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"');
-    $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"');
+    $this->assertSession()->responseNotContains('data-quickedit-entity-id="node/' . $this->testNode->id() . '"');
+    $this->assertSession()->responseNotContains('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"');
 
     $this->drupalGet('node/' . $this->testNode->id());
     $this->assertRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"');
@@ -208,8 +208,8 @@ public function testWithPendingRevision() {
     $this->testNode->save();
 
     $this->drupalGet('node/' . $this->testNode->id());
-    $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"');
-    $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"');
+    $this->assertSession()->responseNotContains('data-quickedit-entity-id="node/' . $this->testNode->id() . '"');
+    $this->assertSession()->responseNotContains('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"');
   }
 
   /**
diff --git a/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php b/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php
index 18237617d54a5720ccf9776b9d2e5c0ba60bd382..2cd49c8a91091fe9087412030d12b0c682b04d9e 100644
--- a/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php
+++ b/core/modules/search/tests/src/Functional/SearchAdminThemeTest.php
@@ -99,7 +99,7 @@ protected function assertAdminTheme($is_admin) {
       $this->assertRaw('core/themes/' . $this->adminTheme);
     }
     else {
-      $this->assertNoRaw('core/themes/' . $this->adminTheme);
+      $this->assertSession()->responseNotContains('core/themes/' . $this->adminTheme);
     }
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php
index a578d9f27606e67f1e0a090a557a85dada9fb5dc..974d494ee21c124b682bf410e160142a29e713ae 100644
--- a/core/modules/search/tests/src/Functional/SearchCommentTest.php
+++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php
@@ -190,7 +190,7 @@ public function testSearchResultsComment() {
 
     // Verify the evil comment subject is escaped in search results.
     $this->assertRaw('&lt;script&gt;alert(&#039;<strong>subjectkeyword</strong>&#039;);');
-    $this->assertNoRaw('<script>');
+    $this->assertSession()->responseNotContains('<script>');
 
     // Search for the keyword near the evil script tag in the comment body.
     $edit = [
@@ -202,7 +202,7 @@ public function testSearchResultsComment() {
     // Verify that nearby script tag in the evil comment body is stripped from
     // search results.
     $this->assertRaw('<strong>nearbykeyword</strong>');
-    $this->assertNoRaw('<script>');
+    $this->assertSession()->responseNotContains('<script>');
 
     // Search for contents inside the evil script tag in the comment body.
     $edit = [
@@ -215,7 +215,7 @@ public function testSearchResultsComment() {
     //   https://www.drupal.org/node/2551135
 
     // Verify there is no script tag in search results.
-    $this->assertNoRaw('<script>');
+    $this->assertSession()->responseNotContains('<script>');
 
     // Hide comments.
     $this->drupalLogin($this->adminUser);
diff --git a/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php b/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php
index b160a311abf3765701721320661bc150e057a428..87157b4736dd5b4a552619caccf290a97cbc9a11 100644
--- a/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php
+++ b/core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php
@@ -92,7 +92,7 @@ public function testPhraseSearchPunctuation() {
     $edit = ['keys' => 'Enritchment'];
     $this->drupalGet('search/node');
     $this->submitForm($edit, 'Search');
-    $this->assertNoRaw('<strong>Enricþment</strong>');
+    $this->assertSession()->responseNotContains('<strong>Enricþment</strong>');
 
     $edit = ['keys' => 'æll'];
     $this->drupalGet('search/node');
@@ -102,7 +102,7 @@ public function testPhraseSearchPunctuation() {
     $edit = ['keys' => 'all'];
     $this->drupalGet('search/node');
     $this->submitForm($edit, 'Search');
-    $this->assertNoRaw('<strong>æll</strong>');
+    $this->assertSession()->responseNotContains('<strong>æll</strong>');
     // cSpell:enable
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php b/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php
index 774076b867be6cfe01045ca57cc8cc78abc50d86..52a482744c69471904bbd8e8c944bfbcb539b118 100644
--- a/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php
+++ b/core/modules/search/tests/src/Functional/SearchNodePunctuationTest.php
@@ -72,13 +72,13 @@ public function testPhraseSearchPunctuation() {
     $edit = ['keys' => '&'];
     $this->drupalGet('search/node');
     $this->submitForm($edit, 'Search');
-    $this->assertNoRaw('<strong>&</strong>amp;');
+    $this->assertSession()->responseNotContains('<strong>&</strong>amp;');
     $this->assertSession()->pageTextContains('You must include at least one keyword');
 
     $edit = ['keys' => '&amp;'];
     $this->drupalGet('search/node');
     $this->submitForm($edit, 'Search');
-    $this->assertNoRaw('<strong>&</strong>amp;');
+    $this->assertSession()->responseNotContains('<strong>&</strong>amp;');
     $this->assertSession()->pageTextContains('You must include at least one keyword');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Batch/PageTest.php b/core/modules/system/tests/src/Functional/Batch/PageTest.php
index f6abdc1f2a47e90af86d5594a926da2e10ac1922..5bc95543b51a09e34b08d14a9f4ed86d0551a453 100644
--- a/core/modules/system/tests/src/Functional/Batch/PageTest.php
+++ b/core/modules/system/tests/src/Functional/Batch/PageTest.php
@@ -79,7 +79,7 @@ public function testBatchProgressMessages() {
     // Check that the initial progress message appears correctly and is not
     // double escaped.
     $this->assertRaw('<div class="progress__description">Initializing.<br />&nbsp;</div>');
-    $this->assertNoRaw('&amp;nbsp;');
+    $this->assertSession()->responseNotContains('&amp;nbsp;');
     // Now also go to the next step.
     $this->maximumMetaRefreshCount = 1;
     $this->drupalGet('batch-test/test-title');
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php b/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php
index 12da4112a5eed326594311619b2f2664e53a89e7..b71cdc27205087fa311cf1b2c05ad8065a4d8f96 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php
@@ -50,11 +50,11 @@ public function testPager() {
 
     // Item 51 should not be present.
     $this->assertRaw('Test entity 50');
-    $this->assertNoRaw('Test entity 51');
+    $this->assertSession()->responseNotContains('Test entity 51');
 
     // Browse to the next page, test entity 51 is shown.
     $this->clickLink('Page 2');
-    $this->assertNoRaw('Test entity 50');
+    $this->assertSession()->responseNotContains('Test entity 50');
     $this->assertRaw('Test entity 51');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php
index eec3ee307e6ad73b8903606b6af023f29475dc7e..97467c81aaad1a3660fb7dea33b62ac6f40cf727 100644
--- a/core/modules/system/tests/src/Functional/Form/FormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormTest.php
@@ -333,7 +333,7 @@ public function testGetFormsCsrfToken() {
     $this->drupalLogin($account);
 
     $this->drupalGet(Url::fromRoute('form_test.get_form'));
-    $this->assertNoRaw('form_token');
+    $this->assertSession()->responseNotContains('form_token');
   }
 
   /**
@@ -351,7 +351,7 @@ public function testRequiredTextfieldNoTitle() {
     $edit = [];
     $this->drupalGet('form-test/validate-required-no-title');
     $this->submitForm($edit, 'Submit');
-    $this->assertNoRaw("The form_test_validate_required_form_no_title form was submitted successfully.");
+    $this->assertSession()->pageTextNotContains("The form_test_validate_required_form_no_title form was submitted successfully.");
 
     // Check the page for the error class on the textfield.
     $this->assertSession()->elementExists('xpath', '//input[contains(@class, "error")]');
@@ -411,7 +411,7 @@ public function testSelect() {
 
     // Verify that the options are escaped as expected.
     $this->assertSession()->assertEscaped('<strong>four</strong>');
-    $this->assertNoRaw('<strong>four</strong>');
+    $this->assertSession()->responseNotContains('<strong>four</strong>');
 
     // Posting without any values should throw validation errors.
     $this->submitForm([], 'Submit');
@@ -662,7 +662,7 @@ public function testNumber() {
             $this->assertRaw(new FormattableMarkup($message, $placeholders));
           }
           else {
-            $this->assertNoRaw(new FormattableMarkup($message, $placeholders));
+            $this->assertSession()->responseNotContains(new FormattableMarkup($message, $placeholders));
           }
         }
       }
diff --git a/core/modules/system/tests/src/Functional/Menu/MenuLinkSecurityTest.php b/core/modules/system/tests/src/Functional/Menu/MenuLinkSecurityTest.php
index 9de239b8bf13e71c56cfdf8de7be0d2c3a3b0f33..bb674dd7cae2ab730fbcbb43ede517c02c5ecabd 100644
--- a/core/modules/system/tests/src/Functional/Menu/MenuLinkSecurityTest.php
+++ b/core/modules/system/tests/src/Functional/Menu/MenuLinkSecurityTest.php
@@ -36,8 +36,8 @@ public function testMenuLink() {
     $this->drupalPlaceBlock('system_menu_block:tools');
 
     $this->drupalGet('<front>');
-    $this->assertNoRaw('<script>alert("Wild animals")</script>');
-    $this->assertNoRaw('<script>alert("Even more wild animals")</script>');
+    $this->assertSession()->responseNotContains('<script>alert("Wild animals")</script>');
+    $this->assertSession()->responseNotContains('<script>alert("Even more wild animals")</script>');
     $this->assertSession()->assertEscaped('<script>alert("Wild animals")</script>');
     $this->assertSession()->assertEscaped('<script>alert("Even more wild animals")</script>');
   }
diff --git a/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/core/modules/system/tests/src/Functional/Module/UninstallTest.php
index f3dcfa8796f6ecb0a766d56c9a584485317751f7..c02869a668df80c07283f0460f6d008524b34ce2 100644
--- a/core/modules/system/tests/src/Functional/Module/UninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/UninstallTest.php
@@ -126,7 +126,7 @@ public function testUninstallPage() {
     $this->submitForm([], 'Uninstall');
     $this->assertSession()->pageTextContains('The selected modules have been uninstalled.');
     // Check that the page does not have double escaped HTML tags.
-    $this->assertNoRaw('&lt;label');
+    $this->assertSession()->responseNotContains('&lt;label');
 
     // Make sure our unique cache entry is gone.
     $cached = \Drupal::cache()->get('uninstall_test');
diff --git a/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php b/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php
index 032d23a165df11fd567667f90803280315ffc663..4f8937388ed0040105d7ac3d1f482b6357269547 100644
--- a/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php
+++ b/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php
@@ -39,7 +39,7 @@ public function testPermissionAccess() {
     $this->drupalLogin($user);
     $this->drupalGet('router_test/test7');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertNoRaw('Access denied');
+    $this->assertSession()->responseNotContains('Access denied');
     $this->assertRaw('test7text');
   }
 
diff --git a/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php b/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
index 5fb4a5d4dd1886d4e277e806f932129a18a363d3..295466bc2f9b293b184598d21437b6b5de3d578a 100644
--- a/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
+++ b/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
@@ -47,7 +47,7 @@ public function testRemovingDefaultMetaTags() {
     \Drupal::service('module_installer')->install(['system_module_test']);
     $this->drupalGet('');
     foreach ($this->defaultMetaTags as $name => $metatag) {
-      $this->assertNoRaw($metatag);
+      $this->assertSession()->responseNotContains($metatag);
     }
   }
 
diff --git a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php
index 59658be618bb6865f6593f1a38b35d2171d965a2..7f27c054e0318e5a0881099cda3715cf8f457942 100644
--- a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php
+++ b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php
@@ -58,7 +58,7 @@ public function testErrorHandler() {
     $this->assertRaw('<pre class="backtrace">');
     // Ensure we are escaping but not double escaping.
     $this->assertRaw('&amp;');
-    $this->assertNoRaw('&amp;amp;');
+    $this->assertSession()->responseNotContains('&amp;amp;');
 
     // Set error reporting to display verbose notices.
     $this->config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save();
@@ -70,7 +70,7 @@ public function testErrorHandler() {
     $this->assertErrorMessage($error_notice);
     $this->assertErrorMessage($error_warning);
     $this->assertErrorMessage($error_user_notice);
-    $this->assertNoRaw('<pre class="backtrace">');
+    $this->assertSession()->responseNotContains('<pre class="backtrace">');
 
     // Set error reporting to not collect notices.
     $config->set('error_level', ERROR_REPORTING_DISPLAY_SOME)->save();
@@ -79,7 +79,7 @@ public function testErrorHandler() {
     $this->assertNoErrorMessage($error_notice);
     $this->assertErrorMessage($error_warning);
     $this->assertErrorMessage($error_user_notice);
-    $this->assertNoRaw('<pre class="backtrace">');
+    $this->assertSession()->responseNotContains('<pre class="backtrace">');
 
     // Set error reporting to not show any errors.
     $config->set('error_level', ERROR_REPORTING_HIDE)->save();
@@ -89,7 +89,7 @@ public function testErrorHandler() {
     $this->assertNoErrorMessage($error_warning);
     $this->assertNoErrorMessage($error_user_notice);
     $this->assertNoMessages();
-    $this->assertNoRaw('<pre class="backtrace">');
+    $this->assertSession()->responseNotContains('<pre class="backtrace">');
   }
 
   /**
@@ -161,7 +161,7 @@ public function assertErrorMessage(array $error) {
    */
   public function assertNoErrorMessage(array $error) {
     $message = new FormattableMarkup('%type: @message in %function (line ', $error);
-    $this->assertNoRaw($message);
+    $this->assertSession()->responseNotContains($message);
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/PageTitleTest.php b/core/modules/system/tests/src/Functional/System/PageTitleTest.php
index 12e1c8a538d4ff6edde4dfa33a11b8cc4390324e..5768af90b1c6450ed2d5c2e9451e0364f4cee0a8 100644
--- a/core/modules/system/tests/src/Functional/System/PageTitleTest.php
+++ b/core/modules/system/tests/src/Functional/System/PageTitleTest.php
@@ -98,14 +98,14 @@ public function testTitleXSS() {
 
     // Test the title, checking for the lack of the unfiltered version of the
     // title.
-    $this->assertNoRaw($title);
+    $this->assertSession()->responseNotContains($title);
     // Add </title> to make sure we're checking the title tag, rather than the
     // first 'heading' on the page.
     $this->assertRaw($title_filtered . '</title>');
 
     // Test the slogan.
     // Check the unfiltered version of the slogan is missing.
-    $this->assertNoRaw($slogan);
+    $this->assertSession()->responseNotContains($slogan);
     // Check for the filtered version of the slogan.
     $this->assertRaw($slogan_filtered);
   }
diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php
index d481a1d17d91a4ba5e05d304a61ad47bc249f17a..39b93b19939e23b8198338418fb52e0090533d85 100644
--- a/core/modules/system/tests/src/Functional/System/ThemeTest.php
+++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php
@@ -414,12 +414,12 @@ public function testUninstallingThemes() {
     $this->clickLink('Set as default');
 
     // Check that seven cannot be uninstalled as it is the admin theme.
-    $this->assertNoRaw('Uninstall Seven theme');
+    $this->assertSession()->responseNotContains('Uninstall Seven theme');
     // Check that bartik cannot be uninstalled as it is the default theme.
-    $this->assertNoRaw('Uninstall Bartik theme');
+    $this->assertSession()->responseNotContains('Uninstall Bartik theme');
     // Check that the classy theme cannot be uninstalled as it is a base theme
     // of seven and bartik.
-    $this->assertNoRaw('Uninstall Classy theme');
+    $this->assertSession()->responseNotContains('Uninstall Classy theme');
 
     // Install Stark and set it as the default theme.
     \Drupal::service('theme_installer')->install(['stark']);
@@ -435,7 +435,7 @@ public function testUninstallingThemes() {
     $this->assertRaw('Uninstall Seven theme');
     // Check that the classy theme still cannot be uninstalled as it is a
     // base theme of bartik.
-    $this->assertNoRaw('Uninstall Classy theme');
+    $this->assertSession()->responseNotContains('Uninstall Classy theme');
 
     // Change the default theme to stark, stark is second in the list.
     $this->clickLink('Set as default', 1);
@@ -445,7 +445,7 @@ public function testUninstallingThemes() {
 
     // Check that the classy theme still can't be uninstalled as neither of its
     // base themes have been.
-    $this->assertNoRaw('Uninstall Classy theme');
+    $this->assertSession()->responseNotContains('Uninstall Classy theme');
 
     // Uninstall each of the three themes starting with Bartik.
     $this->clickLink('Uninstall');
@@ -455,7 +455,7 @@ public function testUninstallingThemes() {
     $this->assertRaw('The <em class="placeholder">Seven</em> theme has been uninstalled');
 
     // Check that the classy theme still can't be uninstalled as it is hidden.
-    $this->assertNoRaw('Uninstall Classy theme');
+    $this->assertSession()->responseNotContains('Uninstall Classy theme');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php b/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php
index 2291b78dac770ecc44e6031da7b069226873a4d2..820554fa0714e454a879c18b3e21752768250af3 100644
--- a/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php
@@ -147,7 +147,7 @@ public function testThemedEntity() {
       foreach ($paths as $path) {
         $this->drupalGet($path);
         $this->assertSession()->statusCodeEquals(200);
-        $this->assertNoRaw($this->xssLabel);
+        $this->assertSession()->responseNotContains($this->xssLabel);
       }
     }
   }
diff --git a/core/modules/taxonomy/tests/src/Functional/RssTest.php b/core/modules/taxonomy/tests/src/Functional/RssTest.php
index 848616017b582a5bae2afc5ac36fd917d2cdf7a3..284f9f22b5e593bae0c1e762fd585d5ad776c07a 100644
--- a/core/modules/taxonomy/tests/src/Functional/RssTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/RssTest.php
@@ -143,7 +143,7 @@ public function testTaxonomyRss() {
     // Unpublish the article and check that it is not shown in the feed.
     $node->setUnpublished()->save();
     $this->drupalGet('taxonomy/term/all/feed');
-    $this->assertNoRaw($raw_xml);
+    $this->assertSession()->responseNotContains($raw_xml);
   }
 
 }
diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php
index c0ba0767ba545a487356fb9a600d74d696f7b0c8..38430d8fa8f484f7e0ec6554df56a895af1e3434 100644
--- a/core/modules/update/tests/src/Functional/UpdateContribTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php
@@ -74,7 +74,7 @@ public function testNoReleasesAvailable() {
     $this->assertSession()->responseContains('<h3>Modules</h3>');
     $this->assertSession()->pageTextNotContains('Update available');
     $this->assertSession()->pageTextContains('No available releases found');
-    $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString());
+    $this->assertSession()->responseNotContains(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString());
 
     $available = update_get_available();
     $this->assertFalse(isset($available['aaa_update_test']['fetch_status']), 'Results are cached even if no releases are available.');
@@ -118,7 +118,7 @@ public function testUpdateContribBasic() {
         'aaa_update_test' => '1_0',
       ]
     );
-    $this->assertNoRaw($project_link);
+    $this->assertSession()->responseNotContains($project_link);
 
     // A hidden and installed project not in the Testing package should appear.
     $system_info['aaa_update_test']['package'] = 'aaa_update_test';
@@ -190,7 +190,7 @@ public function testUpdateContribOrder() {
     $this->assertSession()->pageTextContains('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());
+    $this->assertSession()->responseNotContains(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString());
     // The other two should be listed as projects.
     $this->assertRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString());
     $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString());
@@ -279,7 +279,7 @@ public function testNormalUpdateAvailable() {
         // The XML test fixtures for this method all contain the '8.x-3.0'
         // release but because '8.x-3.0' is not in a supported branch it will
         // not be in the available updates.
-        $this->assertNoRaw('8.x-3.0');
+        $this->assertSession()->responseNotContains('8.x-3.0');
         // Set a CSS selector in order for assertions to target the 'Modules'
         // table and not Drupal core updates.
         $this->updateTableLocator = 'table.update:nth-of-type(2)';
@@ -405,8 +405,8 @@ public function testUpdateShowDisabledThemes() {
       }
       else {
         $this->assertSession()->pageTextNotContains('Uninstalled themes');
-        $this->assertNoRaw($base_theme_project_link);
-        $this->assertNoRaw($sub_theme_project_link);
+        $this->assertSession()->responseNotContains($base_theme_project_link);
+        $this->assertSession()->responseNotContains($sub_theme_project_link);
       }
     }
   }
@@ -497,7 +497,7 @@ public function testUpdateBrokenFetchURL() {
 
     // The other two should be listed as projects.
     $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString());
-    $this->assertNoRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString());
+    $this->assertSession()->responseNotContains(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString());
     $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString());
   }
 
diff --git a/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
index b8a3be824ab0e81ccc5342489ab71e26cc07c8ea..348927bf8a0f6ca442721b35f928aac0dbb44538 100644
--- a/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
+++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
@@ -100,7 +100,7 @@ public function testNormalUpdateAvailable() {
         // 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.
-        $this->assertNoRaw('8.2.0');
+        $this->assertSession()->responseNotContains('8.2.0');
         switch ($minor_version) {
           case 0:
             // Both stable and unstable releases are available.
diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php
index fa4513cf96d2703d07327a16be5eb691624adadc..b87998ff83f03b3335da7a1b9edda3f24f5aa8e6 100644
--- a/core/modules/user/tests/src/Functional/UserCreateTest.php
+++ b/core/modules/user/tests/src/Functional/UserCreateTest.php
@@ -81,7 +81,7 @@ public function testUserAdd() {
     $this->assertSession()->checkboxChecked('edit-status-1');
 
     // Test that browser autocomplete behavior does not occur.
-    $this->assertNoRaw('data-user-info-from-browser');
+    $this->assertSession()->responseNotContains('data-user-info-from-browser');
 
     // Test that the password strength indicator displays.
     $config = $this->config('user.settings');
diff --git a/core/modules/user/tests/src/Functional/UserPictureTest.php b/core/modules/user/tests/src/Functional/UserPictureTest.php
index e83d2a214dfcedb65bfe0a817e0e17fb50fd695e..cd32b252eb9c857e0e0c80328f6ee72633302851 100644
--- a/core/modules/user/tests/src/Functional/UserPictureTest.php
+++ b/core/modules/user/tests/src/Functional/UserPictureTest.php
@@ -145,7 +145,7 @@ public function testPictureOnNodeComment() {
       ->save();
 
     $this->drupalGet('node/' . $node->id());
-    $this->assertNoRaw(StreamWrapperManager::getTarget($file->getFileUri()));
+    $this->assertSession()->responseNotContains(StreamWrapperManager::getTarget($file->getFileUri()));
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php
index 373a2143812a66e3deb97374ea3ac6ab582c3199..1ab4de22a8051abd748ae600434bcc9f68c8af4b 100644
--- a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php
+++ b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php
@@ -93,7 +93,7 @@ public function testBulkForm() {
     $user_storage->resetCache([$account->id()]);
     $account = $user_storage->load($account->id());
     $this->assertTrue($account->isBlocked(), 'The user is blocked.');
-    $this->assertNoRaw($account->label());
+    $this->assertSession()->pageTextNotContains($account->label());
 
     // Remove the user status filter from the view.
     $view = Views::getView('test_user_bulk_form');
diff --git a/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php b/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php
index 3d434de1f90a952418616f8fc901057ac316aa0d..f2e87d53c9e4f24a15f1d51e52f28be48d5cef80 100644
--- a/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/tests/src/Functional/Views/HandlerFilterUserNameTest.php
@@ -172,7 +172,7 @@ public function testExposedFilter() {
     $options['query']['uid'] = implode(', ', $users);
 
     $this->drupalGet($path, $options);
-    $this->assertNoRaw('Unable to find user');
+    $this->assertSession()->pageTextNotContains('Unable to find user');
     // The actual result should contain all of the user ids.
     foreach ($this->accounts as $account) {
       $this->assertRaw($account->id());
@@ -184,7 +184,7 @@ public function testExposedFilter() {
     }, $this->accounts);
 
     $this->drupalGet($path, $options);
-    $this->assertNoRaw('Unable to find user');
+    $this->assertSession()->pageTextNotContains('Unable to find user');
     // The actual result should contain all of the user ids.
     foreach ($this->accounts as $account) {
       $this->assertRaw($account->id());
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
index d2e9324995b3bd67b2faf601ab19966b25d20ee2..9b8a1930b3edebe03f524c2ad15d1abe1051bb8c 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
@@ -243,7 +243,7 @@ public function testExposedBlock($display) {
     // Assert that the only occurrence of `$view->getTitle()` is the title tag
     // now that label has been removed.
     $this->drupalGet('test_exposed_block');
-    $this->assertNoRaw('<strong>Custom</strong> titlealert("hacked!");');
+    $this->assertSession()->responseNotContains('<strong>Custom</strong> titlealert("hacked!");');
     $this->assertSession()->elementContains('css', 'title', $view->getTitle());
     $this->assertSession()->pageTextMatchesCount(1, '/' . $view->getTitle() . '/');
 
@@ -397,9 +397,9 @@ public function testExposedSortAndItemsPerPage() {
     // Make sure we see the single-escaped string in the raw output.
     $this->assertRaw($escape_1);
     // But no double-escaped string.
-    $this->assertNoRaw($escape_2);
+    $this->assertSession()->responseNotContains($escape_2);
     // And not the raw label, either.
-    $this->assertNoRaw($expected_label);
+    $this->assertSession()->responseNotContains($expected_label);
 
     // Check that the custom field identifier is used in the URL query string.
     $this->submitForm(['sort_order' => 'DESC'], 'Apply');
diff --git a/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php b/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php
index fa452d2559913c1396c7933b007c7bf7b584fd1e..461346ba6db2004c33eaf2449544fd34b9dd84d9 100644
--- a/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php
@@ -210,7 +210,7 @@ public function testGrouping() {
     ];
 
     // Ensure that we don't find the caption containing unsafe markup.
-    $this->assertNoRaw($unsafe_markup);
+    $this->assertSession()->responseNotContains($unsafe_markup);
     // Ensure that the summary isn't shown.
     $this->assertEmpty($this->xpath('//caption/details'));
 
@@ -234,7 +234,7 @@ public function testGrouping() {
     ];
 
     // Ensure that we don't find the caption containing unsafe markup.
-    $this->assertNoRaw($unsafe_markup);
+    $this->assertSession()->responseNotContains($unsafe_markup);
 
     // Ensure that all expected captions are found.
     foreach ($expected_captions as $raw_caption) {
diff --git a/core/modules/views/tests/src/Functional/ViewsEscapingTest.php b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php
index fdffb7fec35734f4ee411793eb23977c1ec8aecd..440292961fbe028ec27ceeeec5d1ce4a00a7ebc0 100644
--- a/core/modules/views/tests/src/Functional/ViewsEscapingTest.php
+++ b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php
@@ -83,7 +83,7 @@ public function testViewsFieldHeaderEscaping() {
     $this->drupalGet('test_field_header_xss');
 
     // Assert that harmful tags are escaped in header label.
-    $this->assertNoRaw('<script>alert("XSS")</script>');
+    $this->assertSession()->responseNotContains('<script>alert("XSS")</script>');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
index 0ad459e2de78d37336edbc0becdcc8f729567410..346461ed65abd323079caa2745a509868a1e2e0a 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
@@ -45,7 +45,7 @@ public function testAttachmentUI() {
     $this->submitForm(['displays[page_1]' => 1], 'Apply');
     // Options summary should be escaped.
     $this->assertSession()->assertEscaped('<em>Page</em>');
-    $this->assertNoRaw('<em>Page</em>');
+    $this->assertSession()->responseNotContains('<em>Page</em>');
     $this->assertSession()->elementAttributeContains('xpath', '//a[@id = "views-attachment-1-displays"]', 'title', 'Page');
     $this->submitForm([], 'Save');
 
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php b/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
index 35269da794e4f66777a1a490d13ce73265f38ac9..0005722f2183d96b71a391872404cb73619249f5 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayFeedTest.php
@@ -75,7 +75,7 @@ protected function checkFeedViewUi($view_name) {
     $this->submitForm(['displays[page]' => 'page'], 'Apply');
     // Options summary should be escaped.
     $this->assertSession()->assertEscaped('<em>Page</em>');
-    $this->assertNoRaw('<em>Page</em>');
+    $this->assertSession()->responseNotContains('<em>Page</em>');
 
     $this->drupalGet('admin/structure/views/view/' . $view_name . '/edit/feed_1');
     $this->assertSession()->elementTextContains('xpath', '//*[@id="views-feed-1-displays"]', 'Page');
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayTest.php b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
index e09bd698d847161edd8cd5e3a4bc9ac1214d498e..8289f8ee5652824c002352bdd8c5952699fc2df5 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
@@ -228,15 +228,15 @@ public function testDisplayTitleInButtonsXss() {
       $this->drupalGet("admin/structure/views/view/{$view->id()}");
       $escaped = views_ui_truncate($input, 25);
       $this->assertSession()->assertEscaped($escaped);
-      $this->assertNoRaw($xss_markup);
+      $this->assertSession()->responseNotContains($xss_markup);
 
       $this->drupalGet("admin/structure/views/view/{$view->id()}/edit/page_1");
       $this->assertSession()->assertEscaped("View $escaped");
-      $this->assertNoRaw("View $xss_markup");
+      $this->assertSession()->responseNotContains("View $xss_markup");
       $this->assertSession()->assertEscaped("Duplicate $escaped");
-      $this->assertNoRaw("Duplicate $xss_markup");
+      $this->assertSession()->responseNotContains("Duplicate $xss_markup");
       $this->assertSession()->assertEscaped("Delete $escaped");
-      $this->assertNoRaw("Delete $xss_markup");
+      $this->assertSession()->responseNotContains("Delete $xss_markup");
     }
   }
 
@@ -254,7 +254,7 @@ public function testActionLinks() {
 
     // Ensure that the title is escaped as expected.
     $this->assertSession()->assertEscaped($display_title);
-    $this->assertNoRaw($display_title);
+    $this->assertSession()->responseNotContains($display_title);
 
     // Ensure that the dropdown buttons are displayed correctly.
     $this->assertSession()->buttonExists('Duplicate ' . $display_title);
@@ -269,7 +269,7 @@ public function testActionLinks() {
 
     // Ensure that the title is escaped as expected.
     $this->assertSession()->assertEscaped($display_title);
-    $this->assertNoRaw($display_title);
+    $this->assertSession()->responseNotContains($display_title);
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
index 62b8ba89da13b12d3747d636fb77c7c742675d7c..5cd30b04aed9907d2212932dc9aff4b1afb673fb 100644
--- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
@@ -303,7 +303,7 @@ public function testGroupedFilterAdminUiErrors() {
   protected function assertNoGroupedFilterErrors($message = '', $group = 'Other') {
     foreach ($this->groupFormUiErrors as $error) {
       if (empty($message)) {
-        return $this->assertNoRaw($error);
+        return $this->assertSession()->responseNotContains($error);
       }
     }
     return TRUE;
diff --git a/core/modules/views_ui/tests/src/Functional/FilterUITest.php b/core/modules/views_ui/tests/src/Functional/FilterUITest.php
index 1c57c22ed4e751e69d8fd20a4d8f1d93c2858396..a6c265bb3153aa89c3a39fae5e8388bbac69be9e 100644
--- a/core/modules/views_ui/tests/src/Functional/FilterUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/FilterUITest.php
@@ -80,7 +80,7 @@ public function testFiltersUI() {
 
     // Tests that we can create a new filter group from UI.
     $this->drupalGet('admin/structure/views/nojs/rearrange-filter/test_filter_groups/page');
-    $this->assertNoRaw('<span>Group 3</span>');
+    $this->assertSession()->elementNotExists('xpath', '//span[text()="Group 3"]');
 
     // Create 2 new groups.
     $this->submitForm([], 'Create new filter group');
@@ -96,7 +96,7 @@ public function testFiltersUI() {
     $this->submitForm([], 'Remove group 3');
 
     // Group 3 now does not exist.
-    $this->assertNoRaw('<span>Group 3</span>');
+    $this->assertSession()->elementNotExists('xpath', '//span[text()="Group 3"]');
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/PreviewTest.php b/core/modules/views_ui/tests/src/Functional/PreviewTest.php
index 08a93c8c3e6cd8db47c577984048250639b57512..dc69eed2d5cf5df4c2d0e150599c0be72a807257 100644
--- a/core/modules/views_ui/tests/src/Functional/PreviewTest.php
+++ b/core/modules/views_ui/tests/src/Functional/PreviewTest.php
@@ -93,7 +93,7 @@ public function testPreviewUI() {
     $this->assertSession()->pageTextContains('Query build time');
     $this->assertSession()->pageTextContains('Query execute time');
     $this->assertSession()->pageTextContains('View render time');
-    $this->assertNoRaw('<strong>Query</strong>');
+    $this->assertSession()->responseNotContains('<strong>Query</strong>');
 
     // Statistics and query.
     $settings->set('ui.show.sql_query.enabled', TRUE)->save();
diff --git a/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php
index e587f1003a60ecad53ba120e97d7f3b9164391f6..c6747386f500a7bb2c3828e445fab747a945857e 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php
@@ -32,7 +32,7 @@ public function testInstaller() {
    */
   protected function setUpSite() {
     // Test that the correct theme is being used.
-    $this->assertNoRaw('bartik');
+    $this->assertSession()->responseNotContains('bartik');
     $this->assertRaw('themes/seven/css/theme/install-page.css');
     parent::setUpSite();
   }
diff --git a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
index 5ca2024e86cf05abc35b945960d1d7ac79c3c9c9..73ff4100421e90f4b5b99a46c8ce7a8dcceb5281 100644
--- a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
@@ -76,6 +76,7 @@ public function testAssertRaw() {
    * @covers ::assertNoRaw
    */
   public function testAssertNoRaw() {
+    $this->expectDeprecation('AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738');
     $this->expectDeprecation('Calling AssertLegacyTrait::assertNoRaw() with more that one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738');
     $this->page->getText()->willReturn('foo bar bar');
     $this->assertNoRaw('qux', '\'qux\' should not be present.');
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index bd7330d365051184f033ee10829041ce2a4079cd..aec1092b5703f9e4ced47c7de69629c18f75fba3 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -121,7 +121,6 @@ public static function getSkippedDeprecations() {
       "The \"PHPUnit\Framework\TestSuite\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\TestSuites\TestSuiteBase\".",
       // Simpletest's legacy assertion methods.
       'AssertLegacyTrait::assertRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738',
-      'AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738',
       // PHPUnit 9.
       "The \"PHPUnit\TextUI\DefaultResultPrinter\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\Listeners\HtmlOutputPrinter\".",
     ];