You are here

protected function MediaLibraryTestBase::assertElementExistsAfterWait 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::assertElementExistsAfterWait()
  2. 9 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.

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