You are here

public function CKEditorIntegrationTest::testDrupalImageDialog in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::testDrupalImageDialog()

Tests if the Image button appears and works as expected.

File

core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 140

Class

CKEditorIntegrationTest
Tests the integration of CKEditor.

Namespace

Drupal\Tests\ckeditor\FunctionalJavascript

Code

public function testDrupalImageDialog() {
  $session = $this
    ->getSession();
  $web_assert = $this
    ->assertSession();
  $this
    ->drupalGet('node/add/page');
  $session
    ->getPage();

  // Asserts the Image button is present in the toolbar.
  $web_assert
    ->elementExists('css', '#cke_edit-body-0-value .cke_button__drupalimage');

  // Asserts the image dialog opens when clicking the Image button.
  $this
    ->click('.cke_button__drupalimage');
  $this
    ->assertNotEmpty($web_assert
    ->waitForElement('css', '.ui-dialog'));
  $web_assert
    ->elementContains('css', '.ui-dialog .ui-dialog-titlebar', 'Insert Image');
}