You are here

protected function MediaLibraryTestBase::assertElementExistsAfterWait in Drupal 9

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

Waits for the specified selector and returns it if not empty.

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

Parameters

string $selector: The selector engine name. See ElementInterface::findAll() for the supported selectors.

string|array $locator: The selector locator.

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

Return value

\Behat\Mink\Element\NodeElement The page element node if found. If not found, the test fails.

8 calls to MediaLibraryTestBase::assertElementExistsAfterWait()
EntityReferenceWidgetTest::testFocusNotAppliedWithoutSelectionChange in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that disabled media items don't capture focus on page load.
EntityReferenceWidgetTest::testWidget in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that the Media library's widget works as expected.
FieldUiIntegrationTest::testFieldUiIntegration in core/modules/media_library/tests/src/FunctionalJavascript/FieldUiIntegrationTest.php
Tests field UI integration for media library widget.
MediaLibraryTestBase::assertMediaAdded in core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php
Asserts a media item was added, but not yet saved.
MediaLibraryTestBase::getSelectionArea in core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php
Gets the "Additional selected media" area after adding new media.

... See full list

File

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

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function assertElementExistsAfterWait($selector, $locator, $timeout = 10000) {
  $element = $this
    ->assertSession()
    ->waitForElement($selector, $locator, $timeout);
  $this
    ->assertNotEmpty($element);
  return $element;
}