You are here

public function DropzoneContext::attachFileToDropzone in Lightning Media 8.2

Same name and namespace in other branches
  1. 8 tests/contexts/DropzoneContext.behat.inc \Acquia\LightningExtension\Context\DropzoneContext::attachFileToDropzone()

Attaches a file to a dropzone.

@When I attach the file :file to the dropzone

Parameters

string $file: The file to attach, relative to the file directory configured for Mink.

1 call to DropzoneContext::attachFileToDropzone()
DropzoneContext::uploadMultiple in tests/contexts/DropzoneContext.behat.inc
Uploads multiple files into the media library using Dropzone.

File

tests/contexts/DropzoneContext.behat.inc, line 27

Class

DropzoneContext
Contains step definitions for interacting with DropzoneJS widgets.

Namespace

Acquia\LightningExtension\Context

Code

public function attachFileToDropzone($file) {
  $this
    ->getSession()
    ->executeScript('Dropzone.instances[0].hiddenFileInput.name = "file"');
  $this
    ->getContext(MinkContext::class)
    ->attachFileToField('file', $file);

  // @todo: React when the upload actually completes.
  sleep(3);
}