function MessageCommandTest::waitForMessageVisible

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php \Drupal\FunctionalJavascriptTests\Ajax\MessageCommandTest::waitForMessageVisible()
  2. 8.9.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php \Drupal\FunctionalJavascriptTests\Ajax\MessageCommandTest::waitForMessageVisible()
  3. 11.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php \Drupal\FunctionalJavascriptTests\Ajax\MessageCommandTest::waitForMessageVisible()

Asserts that a message of the expected type appears.

Parameters

string $message: The expected message.

string $selector: The selector for the element in which to check for the expected message.

string $type: The expected type.

1 call to MessageCommandTest::waitForMessageVisible()
MessageCommandTest::testMessageCommand in core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php
Tests AJAX MessageCommand use in a form.

File

core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php, line 182

Class

MessageCommandTest
Tests adding messages via AJAX command.

Namespace

Drupal\FunctionalJavascriptTests\Ajax

Code

protected function waitForMessageVisible($message, $selector = '[data-drupal-messages]', $type = 'status') {
    $this->assertNotEmpty($this->assertSession()
        ->waitForElementVisible('css', $selector . ' .messages--' . $type . ':contains("' . $message . '")'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.