You are here

private function MediaBrowserContext::uploadNoJS in Lightning Media 8.2

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

Uploads a file in the media browser without using JavaScript.

Parameters

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

1 call to MediaBrowserContext::uploadNoJS()
MediaBrowserContext::upload in tests/contexts/MediaBrowserContext.behat.inc
Uploads a file in the media browser.

File

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

Class

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

Namespace

Acquia\LightningExtension\Context

Code

private function uploadNoJS($file) {
  $assert = $this
    ->assertSession();

  // Switch to the "Upload" tab of the media browser, which should be the
  // first button named "Upload" on the page.
  $assert
    ->elementExists('named', [
    'button',
    'Upload',
  ])
    ->press();
  $this
    ->getContext(MinkContext::class)
    ->attachFileToField('File', $file);
  $wrapper = $assert
    ->elementExists('css', '.js-form-managed-file');
  $assert
    ->elementExists('named', [
    'button',
    'Upload',
  ], $wrapper)
    ->press();
}