public function PluginsTest::testModalDisplay in Entity Browser 8
Same name and namespace in other branches
- 8.2 tests/src/FunctionalJavascript/PluginsTest.php \Drupal\Tests\entity_browser\FunctionalJavascript\PluginsTest::testModalDisplay()
Tests Entity browser modal display plugin.
File
- tests/src/ FunctionalJavascript/ PluginsTest.php, line 185 
Class
- PluginsTest
- Tests the entity_browser plugins.
Namespace
Drupal\Tests\entity_browser\FunctionalJavascriptCode
public function testModalDisplay() {
  $modal_display_config = [
    'width' => '650',
    'height' => '500',
    'link_text' => 'Select entities',
  ];
  $this
    ->getEntityBrowser('test_entity_browser_file', 'modal', 'single', 'no_display', $modal_display_config);
  $image = $this
    ->createFile('lama');
  $this
    ->drupalGet('node/add/article');
  $this
    ->assertSession()
    ->buttonExists('Select entities');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Select entities');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->getSession()
    ->switchToIFrame('entity_browser_iframe_test_entity_browser_file');
  $this
    ->getSession()
    ->getPage()
    ->checkField('entity_browser_select[file:' . $image
    ->id() . ']');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Select entities');
  $this
    ->getSession()
    ->switchToIFrame();
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->assertSession()
    ->pageTextContains('lama');
}