You are here

public function EmbedButtonTest::testMediaEmbedDialog in D7 Media 8

Tests that the entity embed dialog is working.

File

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

Class

EmbedButtonTest
Ensures that embedding functionality works perfectly.

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

public function testMediaEmbedDialog() {

  // Find the button and click it to see if the modal opens.
  $this
    ->drupalGet('node/add/page');
  $this
    ->find('.cke_button__media')
    ->click();
  $this
    ->wait();
  $this
    ->assertSession()
    ->pageTextContains('Select media to embed');

  // Test for the button in the basic_html editor.
  $this
    ->drupalGet('entity-embed/dialog/basic_html/media');
  $this
    ->assertEquals(200, $this
    ->getSession()
    ->getStatusCode());
  $this
    ->assertSession()
    ->pageTextContains('Select media to embed');

  // Test for the button in the full_html editor.
  $this
    ->drupalGet('entity-embed/dialog/full_html/media');
  $this
    ->assertEquals(200, $this
    ->getSession()
    ->getStatusCode());
  $this
    ->assertSession()
    ->pageTextContains('Select media to embed');
  $this
    ->drupalGet('entity-browser/iframe/media_embed');
  $this
    ->assertEquals(200, $this
    ->getSession()
    ->getStatusCode());
  $filter = $this
    ->getSession()
    ->getPage()
    ->find('css', 'input[name="name"]');
  $this
    ->assertTrue($filter, "Found filter");
}