You are here

public function MediaBrowserContext::embed in Lightning Media 8.3

Same name and namespace in other branches
  1. 8 tests/contexts/MediaBrowserContext.behat.inc \Acquia\LightningExtension\Context\MediaBrowserContext::embed()
  2. 8.2 tests/contexts/MediaBrowserContext.behat.inc \Acquia\LightningExtension\Context\MediaBrowserContext::embed()

Enters an embed code in the media browser.

@When I enter embed code :code

Parameters

string $code: The embed code.

File

tests/contexts/MediaBrowserContext.behat.inc, line 150

Class

MediaBrowserContext
Contains step definitions for interacting with Lightning's media browser.

Namespace

Acquia\LightningExtension\Context

Code

public function embed($code) {

  // Activate the 'Create embed' tab. We cannot use the link text because it
  // may change between versions of Lightning (as in commit 48fa57e), but the
  // UUID won't.
  $this
    ->assertSession()
    ->elementExists('css', 'nav.eb-tabs ul li a[data-button-id="edit-tab-selector-8b142f33-59d1-47b1-9e3a-4ae85d8376fa"]')
    ->click();
  $this
    ->getSession()
    ->getPage()
    ->fillField('input', $code);

  // The change event, which triggers AJAX, is fired automatically after 600
  // milliseconds.
  sleep(1);
  $this
    ->awaitAjax();
  $this
    ->awaitExpression('jQuery("#entity").children().length');
}