You are here

public function EmbedButtonAdminTest::testCKEditorButtonConflict in Embed 8

File

tests/src/FunctionalJavascript/EmbedButtonAdminTest.php, line 175

Class

EmbedButtonAdminTest
Tests the administrative UI.

Namespace

Drupal\Tests\embed\FunctionalJavascript

Code

public function testCKEditorButtonConflict() {
  $page = $this
    ->getSession()
    ->getPage();
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/content/embed/button/add');
  $button_label = $this
    ->randomMachineName();
  $button_id = strtolower($button_label);
  $page
    ->fillField('label', $button_label);
  $this
    ->assertNotEmpty($assert_session
    ->waitForText("Machine name: {$button_id}"));
  $assert_session
    ->elementExists('css', '#edit-label-machine-name-suffix')
    ->pressButton('Edit');
  $id = $assert_session
    ->waitForField('id');
  $this
    ->assertNotEmpty($id);
  $id
    ->setValue('DrupalImage');
  $edit = [
    'type_id' => 'embed_test_default',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
}