diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
index 2086e2783c0d9b1e5e16df68ba01e1cf37d3cb3f..fa49e03706e00493e85092be2bee87d8aa0349f7 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
@@ -726,4 +726,25 @@ private function buildJavascriptStatusMessageSelector(?string $message = NULL, ?
     return $this->buildStatusMessageSelector($message, $type) . ' | ' . $js_selector;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function statusMessageContains(string $message, ?string $type = NULL): void {
+    $selector = $this->buildStatusMessageSelector($message, $type);
+    $this->waitForElement('xpath', $selector);
+    parent::statusMessageContains($message, $type);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function statusMessageNotContains(string $message, ?string $type = NULL): void {
+    $selector = $this->buildStatusMessageSelector($message, $type);
+    // Wait for a second for the message to not exist.
+    $this->waitForHelper(1000, function (Element $page) use ($selector) {
+      return !$page->find('xpath', $selector);
+    });
+    parent::statusMessageNotContains($message, $type);
+  }
+
 }