You are here

public function PanelizerWizardTest::testBlockPlacement in Lightning Layout 8

Saving a panelized entity should not affect blocks placed via IPE.

File

tests/src/FunctionalJavascript/PanelizerWizardTest.php, line 29

Class

PanelizerWizardTest
Tests Lightning Layout's integration with Panelizer's wizard.

Namespace

Drupal\Tests\lightning_layout\FunctionalJavascript

Code

public function testBlockPlacement() {
  $user = $this
    ->createUser([], NULL, TRUE);
  $page = $this
    ->createNode([
    'type' => 'landing_page',
    'uid' => $user
      ->id(),
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet($page
    ->toUrl());

  // Add a Who's online block to the page.
  $this
    ->getBlockForm('views_block:who_s_online-who_s_online_block', 'Lists (Views)')
    ->pressButton('Add');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->saveLayout();
  $this
    ->assertSession()
    ->elementExists('css', '[data-block-plugin-id="views_block:who_s_online-who_s_online_block"]');

  // Save the page via edit form, assert the block is still there.
  $this
    ->drupalGet($page
    ->toUrl('edit-form'));
  $this
    ->assertSession()
    ->buttonExists('Save')
    ->click();
  $this
    ->assertSession()
    ->elementExists('css', '[data-block-plugin-id="views_block:who_s_online-who_s_online_block"]');
}