You are here

public function PanelizerWizardTest::testChangeLayouts in Lightning Layout 8

Tests switching between defined layouts in the Panelizer wizard.

File

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

Class

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

Namespace

Drupal\Tests\lightning_layout\FunctionalJavascript

Code

public function testChangeLayouts() {
  $page = $this
    ->getSession()
    ->getPage();
  $assert_session = $this
    ->assertSession();
  $account = $this
    ->drupalCreateUser();
  $account
    ->addRole('landing_page_creator');
  $account
    ->addRole('layout_manager');
  $account
    ->save();
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet('/admin/structure/panelizer/edit/node__landing_page__full__two_column/content');
  $page
    ->clickLink('Add new block');
  $this
    ->waitForLink('Authored by')
    ->click();
  $this
    ->waitForField('region')
    ->selectOption('first');
  $this
    ->waitForButton('Add block')
    ->press();
  $this
    ->assertBlockExistsInRegion('Authored by', 'first');
  $page
    ->pressButton('Update and save');
  $edit_form = $this
    ->drupalCreateNode([
    'type' => 'landing_page',
  ])
    ->toUrl('edit-form');
  $this
    ->drupalGet($edit_form);
  $page
    ->selectFieldOption('Full content', 'Two Column');
  $page
    ->pressButton('Save');
  $assert_session
    ->pageTextContains('Authored by');
  $this
    ->drupalGet($edit_form);
  $page
    ->selectFieldOption('Full content', 'Single Column');
  $page
    ->pressButton('Save');
  $assert_session
    ->pageTextNotContains('Authored by');
}