You are here

public function MediaEntityBrowserTest::testMediaBrowser in Media Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/MediaEntityBrowserTest.php \Drupal\Tests\media_entity_browser\FunctionalJavascript\MediaEntityBrowserTest::testMediaBrowser()

Test the media entity browser.

File

tests/src/FunctionalJavascript/MediaEntityBrowserTest.php, line 52

Class

MediaEntityBrowserTest
A test for the media entity browser.

Namespace

Drupal\Tests\media_entity_browser\FunctionalJavascript

Code

public function testMediaBrowser() {
  $this
    ->drupalGet('entity-browser/iframe/media_entity_browser');
  $this
    ->clickLink('Choose existing media');
  $this
    ->assertSession()
    ->elementExists('css', '.view-media-entity-browser-view');
  $this
    ->assertSession()
    ->elementExists('css', '.image-style-media-entity-browser-thumbnail');
  $this
    ->assertSession()
    ->elementNotExists('css', '.views-row.checked');
  $this
    ->getSession()
    ->getPage()
    ->find('css', '.views-row')
    ->press();
  $this
    ->assertSession()
    ->elementExists('css', '.views-row.checked');
  $this
    ->assertSession()
    ->buttonExists('Select media');
}