You are here

public function OliveroMessagesTest::testDataDrupalSelectors in Drupal 9

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}");
    }
  }
}