You are here

private function CkEditorMediaBrowserTest::open in Lightning Media 8.2

Opens the CKeditor media browser.

5 calls to CkEditorMediaBrowserTest::open()
CkEditorMediaBrowserTest::testDocumentEmbed in tests/src/ExistingSiteJavascript/CkEditorMediaBrowserTest.php
Tests that the image embed plugin is not used to embed a document.
CkEditorMediaBrowserTest::testEditEmbed in tests/src/ExistingSiteJavascript/CkEditorMediaBrowserTest.php
Tests that the entity embed dialog opens when editing a pre-existing embed.
CkEditorMediaBrowserTest::testExposedFilters in tests/src/ExistingSiteJavascript/CkEditorMediaBrowserTest.php
Tests exposed filters in the media browser.
CkEditorMediaBrowserTest::testImageEmbed in tests/src/ExistingSiteJavascript/CkEditorMediaBrowserTest.php
Tests that the image embed plugin is used to embed an image.
CkEditorMediaBrowserTest::testUnlimitedCardinality in tests/src/ExistingSiteJavascript/CkEditorMediaBrowserTest.php
Tests that cardinality is never enforced in the media browser.

File

tests/src/ExistingSiteJavascript/CkEditorMediaBrowserTest.php, line 311

Class

CkEditorMediaBrowserTest
@group lightning @group lightning_media

Namespace

Drupal\Tests\lightning_media\ExistingSiteJavascript

Code

private function open() {

  // Assert that at least one CKeditor instance is initialized.
  $session = $this
    ->getSession();
  $status = $session
    ->wait(10000, 'Object.keys( CKEDITOR.instances ).length > 0');
  $this
    ->assertTrue($status);

  // Assert that we have a valid list of CKeditor instance IDs.
  $editors = $session
    ->evaluateScript('Object.keys( CKEDITOR.instances )');
  $this
    ->assertInternalType('array', $editors);

  /** @var string[] $editors */
  $editors = array_filter($editors);
  $this
    ->assertNotEmpty($editors);

  // Assert that the editor is ready.
  $editor = reset($editors);
  $status = $session
    ->wait(10000, "CKEDITOR.instances['{$editor}'].status === 'ready'");
  $this
    ->assertTrue($status);
  $status = $session
    ->evaluateScript("CKEDITOR.instances['{$editor}'].execCommand('editdrupalentity', { id: 'media_browser' });");
  $this
    ->assertNotEmpty($status);
  sleep(3);
}