You are here

public function MediaBrowserContext::upload in Lightning Media 8

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

Uploads a file in the media browser.

@When I upload :file

Parameters

string $file: The path to the file, relative to the test files directory.

File

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

Class

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

Namespace

Acquia\LightningExtension\Context

Code

public function upload($file) {

  /** @var MinkContext $mink_context */
  $mink_context = $this
    ->getContext(MinkContext::class);
  $mink_context
    ->clickLink('Upload');
  $mink_context
    ->attachFileToField('File', $file);
  $this
    ->awaitExpression('jQuery("#entity").children().length');
}