You are here

public function ParagraphsCollectionDemoTest::testConfiguration in Paragraphs Collection 8

Checks that generic container is created with all plugins enabled.

File

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
    ->assertFieldChecked('edit-behavior-plugins-style-enabled');
  $this
    ->assertFieldChecked('edit-behavior-plugins-style-settings-groups-general-group');
  $this
    ->assertNoFieldChecked('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
    ->assertFieldChecked('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
    ->assertText('Paragraphs');
  $this
    ->drupalGet('');
  $this
    ->assertResponse(200);
  $this
    ->assertLink('Paragraphs Collection Demo Article!');
  $this
    ->assertSession()
    ->pageTextContains('This is content from the library. We can reuse it multiple times without duplicating it.');
}