diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php index b1a083f65a24751131f558c5ffea5b9503ea3bc2..1d5f9aa2e54e80b648916963fc58d84a45d09917 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); + } + }