You are here

public function DropzoneContext::attachFileToDropzone in Lightning Media 8

Same name and namespace in other branches
  1. 8.2 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.

File

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

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);
}