You are here

public function PanelsInPlaceEditorTest::testPerEntityCustomization in Lightning Layout 8

Tests that one-off entity-specific customizations can be done OOTB.

File

tests/src/FunctionalJavascript/PanelsInPlaceEditorTest.php, line 30

Class

PanelsInPlaceEditorTest
Tests Lightning Layout's integration with the Panels in-place editor.

Namespace

Drupal\Tests\lightning_layout\FunctionalJavascript

Code

public function testPerEntityCustomization() {
  $assert_session = $this
    ->assertSession();

  // The 'access user profiles' permission is needed to see the view we are
  // going to place in the layout.
  $account = $this
    ->drupalCreateUser([
    'access user profiles',
  ]);
  $account
    ->addRole('landing_page_creator');
  $account
    ->save();
  $this
    ->drupalLogin($account);
  $node = $this
    ->drupalCreateNode([
    'type' => 'landing_page',
  ]);
  $this
    ->drupalGet($node
    ->toUrl());
  $plugin_id = 'views_block:who_s_online-who_s_online_block';
  $this
    ->getBlockForm($plugin_id, 'Lists (Views)')
    ->pressButton('Add');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $this
    ->saveLayout();
  $this
    ->getSession()
    ->reload();
  $assert_session
    ->elementExists('css', "[data-block-plugin-id='{$plugin_id}']");
}