You are here

protected function MediaLibraryTestBase::waitForElementTextContains in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::waitForElementTextContains()
  2. 10 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.

2 calls to MediaLibraryTestBase::waitForElementTextContains()
EntityReferenceWidgetTest::testWidget in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that the Media library's widget works as expected.
WidgetViewsTest::testWidgetViews in core/modules/media_library/tests/src/FunctionalJavascript/WidgetViewsTest.php
Tests that the views in the Media library's widget work as expected.

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