You are here

private function EntityBrowserTrait::waitForEntityBrowser in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Traits/EntityBrowserTrait.php \Drupal\Tests\lightning_media\Traits\EntityBrowserTrait::waitForEntityBrowser()

Waits for an entity browser frame to load.

Parameters

string $id: The machine name of the entity browser.

bool $switch: (optional) Whether to switch into the entity browser's frame once it has loaded. Defaults to TRUE.

6 calls to EntityBrowserTrait::waitForEntityBrowser()
CKEditorMediaBrowserTest::open in tests/src/FunctionalJavascript/CKEditorMediaBrowserTest.php
Opens the CKeditor media browser.
EmbeddedMediaTest::open in tests/src/FunctionalJavascript/EmbeddedMediaTest.php
Opens the media browser.
ImageBrowserCardinalityTest::openImageBrowser in modules/lightning_media_image/tests/src/FunctionalJavascript/ImageBrowserCardinalityTest.php
Opens a modal image browser.
ImageBrowserTest::testUpload in tests/src/FunctionalJavascript/ImageBrowserTest.php
Tests uploading an image in the image browser.
MediaBrowserWidgetDisambiguationTest::setUp in tests/src/FunctionalJavascript/MediaBrowserWidgetDisambiguationTest.php

... See full list

File

tests/src/Traits/EntityBrowserTrait.php, line 41

Class

EntityBrowserTrait
Contains methods for interacting with entity browsers in frames.

Namespace

Drupal\Tests\lightning_media\Traits

Code

private function waitForEntityBrowser($id, $switch = TRUE) {
  $frame = 'entity_browser_iframe_' . $id;
  $this
    ->assertJsCondition("window.{$frame} !== undefined");
  $this
    ->assertJsCondition("window.{$frame}.document.readyState === 'complete'");
  if ($switch) {
    $this
      ->getSession()
      ->switchToIFrame($frame);
    $this->currentEntityBrowser = $id;
  }
}