You are here

protected function MediaLibraryTestBase::waitForElementTextContains in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::waitForElementTextContains()
  2. 9 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::waitForElementTextContains()

Asserts that text appears in an element after a wait.

@todo replace with whatever gets added in https://www.drupal.org/node/3061852

Parameters

string $selector: The CSS selector of the element to check.

string $text: The text that should appear in the element.

int $timeout: Timeout in milliseconds, defaults to 10000.

File

core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php, line 133

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function waitForElementTextContains($selector, $text, $timeout = 10000) {
  $element = $this
    ->assertSession()
    ->waitForElement('css', "{$selector}:contains('{$text}')", $timeout);
  $this
    ->assertNotEmpty($element);
}