Commit de08a3d2 authored by Jess's avatar Jess
Browse files

Issue #3268368 by lauriii, xjm, Wim Leers: Robustify and restore...

Issue #3268368 by lauriii, xjm, Wim Leers: Robustify and restore \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaLibraryTest::testButton

(cherry picked from commit be839ae7)
parent 57269e46
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -146,14 +146,13 @@ function (ConstraintViolation $v) {
   * Tests using drupalMedia button to embed media into CKEditor 5.
   */
  public function testButton() {
    $this->markTestSkipped();
    $media_preview_selector = '.ck-content .ck-widget.drupal-media .media';
    $this->drupalGet('/node/add/blog');
    $this->waitForEditor();
    $this->pressEditorButton('Insert Drupal Media');
    $assert_session = $this->assertSession();
    $page = $this->getSession()->getPage();
    $this->assertNotEmpty($assert_session->waitForId('drupal-modal'));
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-modal #media-library-content'));

    // Ensure that the tab order is correct.
    $tabs = $page->findAll('css', '.media-library-menu__link');
@@ -194,7 +193,8 @@ public function testButton() {
    $this->drupalGet('/node/add/blog');
    $this->waitForEditor();
    $this->pressEditorButton('Insert Drupal Media');
    $assert_session->waitForElement('css', '.js-media-library-item')->click();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-modal #media-library-content'));
    $assert_session->elementExists('css', '.js-media-library-item')->click();
    $assert_session->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Insert selected');
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', $media_preview_selector, 1000));
    $xpath = new \DOMXPath($this->getEditorDataAsDom());
@@ -245,7 +245,7 @@ public function testAllowedMediaTypes() {
      $this->pressEditorButton('Insert Drupal Media');

      $assert_session = $this->assertSession();
      $this->assertNotEmpty($assert_session->waitForId('media-library-wrapper'));
      $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-modal #media-library-wrapper'));

      if (empty($allowed_media_types) || count($allowed_media_types) === 2) {
        $assert_session->elementExists('css', 'li.media-library-menu-image');
@@ -277,7 +277,7 @@ public function testAlt() {
    $this->drupalGet('/node/add/blog');
    $this->waitForEditor();
    $this->pressEditorButton('Insert Drupal Media');
    $this->assertNotEmpty($assert_session->waitForId('drupal-modal'));
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-modal #media-library-content'));
    $assert_session->elementExists('css', '.js-media-library-item')->click();
    $assert_session->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Insert selected');
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.ck-widget.drupal-media img'));