function OliveroMessagesTest::testDataDrupalSelectors

Same name in other branches
  1. 10 core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php \Drupal\FunctionalJavascriptTests\Theme\OliveroMessagesTest::testDataDrupalSelectors()
  2. 11.x core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php \Drupal\FunctionalJavascriptTests\Theme\OliveroMessagesTest::testDataDrupalSelectors()

Tests data-drupal-selector="messages" exists.

File

core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php, line 47

Class

OliveroMessagesTest
Runs OliveroMessagesTest in Olivero.

Namespace

Drupal\FunctionalJavascriptTests\Theme

Code

public function testDataDrupalSelectors() {
    $web_assert = $this->assertSession();
    $this->drupalGet('js_message_test_link');
    foreach (JSMessageTestController::getMessagesSelectors() as $messagesSelector) {
        $web_assert->elementExists('css', $messagesSelector);
        foreach (JSMessageTestController::getTypes() as $type) {
            $this->click('[id="add-' . $messagesSelector . '-' . $type . '"]');
            $selector = '[data-drupal-selector="messages"]';
            $msg_element = $web_assert->waitForElementVisible('css', $selector);
            $this->assertNotEmpty($msg_element, "Message element visible: {$selector}");
        }
    }
}

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