DropzoneJsEbWidgetTest.php in DropzoneJS 8.2
File
tests/src/FunctionalJavascript/DropzoneJsEbWidgetTest.php
View source
<?php
namespace Drupal\Tests\dropzonejs\FunctionalJavascript;
use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
class DropzoneJsEbWidgetTest extends DropzoneJsWebDriverTestBase {
use FieldUiTestTrait;
public static $modules = [
'node',
'media',
'menu_ui',
'path',
'dropzonejs_test',
];
protected static $userPermissions = [
'access dropzonejs_eb_test entity browser pages',
'create dropzonejs_test content',
'dropzone upload files',
'access content',
];
protected function setUp() {
parent::setUp();
$account = $this
->drupalCreateUser(static::$userPermissions);
$this
->drupalLogin($account);
}
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');
$this
->getSession()
->switchToIFrame();
$this
->waitForAjaxToFinish();
sleep(2);
$this
->assertSession()
->elementContains('xpath', '//div[contains(@class, "entities-list")]/div[contains(@class, "label")]', 'notalama.jpg');
}
}