public function ParagraphsCollectionDemoTest::testConfiguration

Checks that generic container is created with all plugins enabled.

File

paragraphs_collection/modules/paragraphs_collection_demo/tests/src/Functional/ParagraphsCollectionDemoTest.php, line 28

Class

ParagraphsCollectionDemoTest
Test the demo for Paragraphs Collection.

Namespace

Drupal\Tests\paragraphs_collection_demo\Functional

Code

public function testConfiguration() {
  $this
    ->loginAsAdmin([
    'administer content types',
    'access administration pages',
    'access content overview',
  ]);

  // Check for pre-configured paragraph type.
  $this
    ->drupalGet('admin/structure/paragraphs_type/container');
  $this
    ->assertSession()
    ->pageTextContains('Container');
  $this
    ->assertSession()
    ->checkboxChecked('edit-behavior-plugins-style-enabled');
  $this
    ->assertSession()
    ->checkboxChecked('edit-behavior-plugins-style-settings-groups-general-group');
  $this
    ->assertSession()
    ->checkboxNotChecked('edit-behavior-plugins-style-settings-groups-slideshow-group');
  $options = $this
    ->xpath('//input[contains(@id, :id)]', [
    ':id' => 'edit-behavior-plugins-style-settings-groups',
  ]);
  $this
    ->assertCount(2, $options);

  // @todo When other plugins are available, add assertion.
  $this
    ->drupalGet('admin/structure/paragraphs_type/text');
  $this
    ->assertSession()
    ->checkboxChecked('edit-behavior-plugins-language-enabled');

  // Check that demo content has paragraph with enabled plugins.
  $this
    ->drupalGet('admin/content');
  $this
    ->clickLink('Paragraphs Collection Demo Article!');
  $this
    ->assertSession()
    ->responseContains('Paragraphs');
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->linkExists('Paragraphs Collection Demo Article!');
  $this
    ->assertSession()
    ->pageTextContains('This is content from the library. We can reuse it multiple times without duplicating it.');
}