You are here

public function DropzoneJsEbWidgetTest::testUploadFile in DropzoneJS 8.2

Tests the add widget with iframe form.

File

tests/src/FunctionalJavascript/DropzoneJsEbWidgetTest.php, line 53

Class

DropzoneJsEbWidgetTest
Test dropzonejs EB Widget.

Namespace

Drupal\Tests\dropzonejs\FunctionalJavascript

Code

public function testUploadFile() {
  $this
    ->drupalGet('node/add/dropzonejs_test');
  $this
    ->getSession()
    ->getPage()
    ->clickLink('Select entities');
  $this
    ->waitForAjaxToFinish();
  $this
    ->getSession()
    ->switchToIFrame('entity_browser_iframe_dropzonejs_eb_test');
  $this
    ->dropFile();
  $this
    ->waitForAjaxToFinish();
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Select entities');

  // Switch back to the main page.
  $this
    ->getSession()
    ->switchToIFrame();
  $this
    ->waitForAjaxToFinish();

  // For some reason we have to wait here for the markup to show up regardless
  // of the waitForAjaxToFinish above.
  sleep(2);
  $this
    ->assertSession()
    ->elementContains('xpath', '//div[contains(@class, "entities-list")]/div[contains(@class, "label")]', 'notalama.jpg');
}