reverted: --- b/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsLibraryItemEntityBrowserTest.php +++ a/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsLibraryItemEntityBrowserTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\paragraphs_library\FunctionalJavascript; use Drupal\language\Entity\ConfigurableLanguage; -use Drupal\paragraphs\Entity\ParagraphsType; use Drupal\Tests\entity_browser\FunctionalJavascript\EntityBrowserWebDriverTestBase; use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait; @@ -219,21 +218,6 @@ $save_button->press(); $this->waitForAjaxToFinish(); $this->assertSession()->fieldExists('paragraphs[0][subform][field_text][0][value]'); - - // Check the Library item unpublished indicator. - ParagraphsType::load('text') - ->setThirdPartySetting('paragraphs_library', 'allow_library_conversion', TRUE) - ->save(); - $this->drupalGet('node/add'); - $title = $this->assertSession()->fieldExists('Title'); - $title->setValue('Paragraph test'); - $this->getSession()->getPage()->pressButton('field_paragraphs_text_add_more'); - $this->waitForAjaxToFinish(); - $this->getSession()->getPage()->fillField('field_paragraphs[0][subform][field_text][0][value]', 'This is a reusable text UPDATED.'); - $dropdown = $this->assertSession()->elementExists('css', '.paragraphs-dropdown'); - $dropdown->click(); - $this->getSession()->getPage()->pressButton('Promote to library'); - $this->assertSession()->elementExists('css', '.paragraph-formatter .paragraphs-icon-view'); } } only in patch2: unchanged: --- a/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php +++ b/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\paragraphs_library\FunctionalJavascript; use Behat\Mink\Element\Element; +use Drupal\paragraphs\Entity\ParagraphsType; use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait; @@ -421,6 +422,31 @@ class ParagraphsContentModerationTest extends WebDriverTestBase { $assert_session->pageTextContains('Content types'); $assert_session->elementNotExists('css', 'a[href$="' . $this->workflow->id() . '/type/paragraph"]'); $assert_session->elementExists('css', 'a[href$="' . $this->workflow->id() . '/type/node"]'); + + // Check the library item is marked as unpublished. + $form_display = \Drupal::service('entity_display.repository')->getFormDisplay('node', 'paragraphed_moderated_test'); + $form_display = $form_display->setComponent('field_paragraphs', ['type' => 'paragraphs']); + $form_display->save(); + // Check the Library item unpublished indicator. + ParagraphsType::load('text') + ->setThirdPartySetting('paragraphs_library', 'allow_library_conversion', TRUE) + ->save(); + $this->drupalGet('node/add'); + $title = $this->assertSession()->fieldExists('Title'); + $title->setValue('Paragraph test'); + $element = $this->getSession()->getPage()->find('xpath', '//*[contains(@class, "dropbutton-toggle")]'); + $element->click(); + $button = $this->getSession()->getPage()->findButton('Add text'); + $button->press(); + $assert_session->assertWaitOnAjaxRequest(); + $this->getSession()->getPage()->fillField('field_paragraphs[0][subform][field_text][0][value]', 'This is a reusable text UPDATED.'); + $first_row = $this->assertSession()->elementExists('css', '#field-paragraphs-add-more-wrapper tr.draggable:nth-of-type(1)'); + $dropdown = $this->assertSession()->elementExists('css', '.paragraphs-dropdown', $first_row); + $dropdown->click(); + $this->getSession()->getPage()->pressButton('Promote to library'); + $assert_session->assertWaitOnAjaxRequest(); + $style_selector = $this->getSession()->getPage()->find('css', '.paragraph-formatter .paragraphs-icon-view'); + $this->assertTrue($style_selector->isVisible()); } /**