diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
index bd0453796fbe..31a11f83be37 100644
--- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
@@ -169,7 +169,7 @@ class CommentAnonymousTest extends CommentTestBase {
// NOTE: if authenticated user has permission to post comments, then a
// "Login or register to post comments" type link may be shown.
$this->drupalGet('node/' . $this->node->id());
- $this->assertNoPattern('@
', 'No image displayed when no image is attached and no default image specified.');
+ $this->assertSession()->responseNotMatches('
', 'No image displayed when no image is attached and no default image specified.');
$cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
$this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.');
diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php
index 3e90d8eb2c08..0f8f14e2d01c 100644
--- a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php
+++ b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php
@@ -189,7 +189,7 @@ class PageCacheTest extends BrowserTestBase {
// Fill the cache.
$this->drupalGet('');
// Verify the page is not printed twice when the cache is cold.
- $this->assertNoPattern('#assertSession()->responseNotMatches('#drupalGet('');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
@@ -213,7 +213,7 @@ class PageCacheTest extends BrowserTestBase {
$this->drupalGet('', [], ['If-Modified-Since' => $last_modified, 'If-None-Match' => NULL]);
// Verify the page is not printed twice when the cache is warm.
- $this->assertNoPattern('#assertSession()->responseNotMatches('#assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
diff --git a/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php b/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php
index ea87a7cd4466..7c4a9fe8971b 100644
--- a/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php
+++ b/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php
@@ -99,13 +99,13 @@ class StatisticsLoggingTest extends BrowserTestBase {
// Verify that logging scripts are not found on a non-node page.
$this->drupalGet('node');
$settings = $this->getDrupalSettings();
- $this->assertNoPattern($expected_library, 'Statistics library JS not found on node page.');
+ $this->assertSession()->responseNotMatches($expected_library, 'Statistics library JS not found on node page.');
$this->assertFalse(isset($settings['statistics']), 'Statistics settings not found on node page.');
// Verify that logging scripts are not found on a non-existent node page.
$this->drupalGet('node/9999');
$settings = $this->getDrupalSettings();
- $this->assertNoPattern($expected_library, 'Statistics library JS not found on non-existent node page.');
+ $this->assertSession()->responseNotMatches($expected_library, 'Statistics library JS not found on non-existent node page.');
$this->assertFalse(isset($settings['statistics']), 'Statistics settings not found on node page.');
// Verify that logging scripts are found on a valid node page.
diff --git a/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php b/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
index 2be4d79ad541..49c2edc81943 100644
--- a/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
+++ b/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
@@ -61,7 +61,7 @@ class NoJavaScriptAnonymousTest extends BrowserTestBase {
// Ensure no other JavaScript file exists on the page, while ignoring the
// HTML5 shiv.
- $this->assertNoPattern('/(?assertSession()->responseNotMatches('/(?drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
- $this->assertNoPattern('|