function JSWebAssert::statusMessageContainsAfterWait
Same name in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::statusMessageContainsAfterWait()
- 10 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::statusMessageContainsAfterWait()
Asserts that a status message containing given string exists after wait.
Parameters
string $message: The partial message to assert.
string|null $type: The optional message type: status, error, or warning.
int $timeout: Optional timeout in milliseconds, defaults to 10000.
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php, line 640
Class
- JSWebAssert
- Defines a class with methods for asserting presence of elements during tests.
Namespace
Drupal\FunctionalJavascriptTestsCode
public function statusMessageContainsAfterWait(string $message, ?string $type = NULL, int $timeout = 10000) : void {
$selector = $this->buildJavascriptStatusMessageSelector($message, $type);
$status_message_element = $this->waitForElement('xpath', $selector, $timeout);
if ($type) {
$failure_message = sprintf('A status message of type "%s" containing "%s" does not appear on this page, but it should.', $type, $message);
}
else {
$failure_message = sprintf('A status message containing "%s" does not appear on this page, but it should.', $type);
}
// There is no Assert::isNotNull() method, so we make our own constraint.
$constraint = new LogicalNot(new IsNull());
Assert::assertThat($status_message_element, $constraint, $failure_message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.