function MediaLibraryTestBase::waitForElementTextContains

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

5 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.
WidgetOverflowTest::testWidgetOverflow in core/modules/media_library/tests/src/FunctionalJavascript/WidgetOverflowTest.php
Tests that the Media Library constrains the number of selected items.
WidgetUploadTest::testWidgetUpload in core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php
Tests that uploads in the 'media_library_widget' works as expected.
WidgetUploadTest::testWidgetUploadAdvancedUi in core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php
Tests that uploads in the widget's advanced UI 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 135

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

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