You are here

public function MediaBrowserContext::createFromEmbedCode in Lightning Media 8.2

Same name and namespace in other branches
  1. 8.3 tests/contexts/MediaBrowserContext.behat.inc \Acquia\LightningExtension\Context\MediaBrowserContext::createFromEmbedCode()

Creates a media item in the media browser using an embed code.

@When I create media named :title using the embed code :embed_code

Parameters

string $title: The label of the created media item.

string $embed_code: The embed code from which to create the media item.

File

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

Class

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

Namespace

Acquia\LightningExtension\Context

Code

public function createFromEmbedCode($title, $embed_code) {

  /** @var MinkContext $mink_context */
  $mink_context = $this
    ->getContext(MinkContext::class);
  $mink_context
    ->assertAtPath('/entity-browser/iframe/media_browser');
  $assert = $this
    ->assertSession();
  $assert
    ->elementExists('named', [
    'button',
    'Create embed',
  ])
    ->press();
  $assert
    ->fieldExists('input')
    ->setValue($embed_code);
  $assert
    ->elementExists('named', [
    'button',
    'Update',
  ])
    ->press();
  $assert
    ->fieldExists('Name')
    ->setValue($title);
  $assert
    ->elementExists('named', [
    'button',
    'Place',
  ])
    ->press();
}