You are here

public function LayoutBuilderUiTest::testReloadWithNoSections in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::testReloadWithNoSections()

Tests that after removing sections reloading the page does not re-add them.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php, line 66

Class

LayoutBuilderUiTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

public function testReloadWithNoSections() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();

  // Remove all of the sections from the page.
  $this
    ->drupalGet(static::FIELD_UI_PREFIX . '/display/default/layout');
  $page
    ->clickLink('Remove Section 1');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $page
    ->pressButton('Remove');
  $assert_session
    ->assertWaitOnAjaxRequest();

  // Assert that there are no sections on the page.
  $assert_session
    ->pageTextNotContains('Remove Section 1');
  $assert_session
    ->pageTextNotContains('Add block');

  // Reload the page.
  $this
    ->drupalGet(static::FIELD_UI_PREFIX . '/display/default/layout');

  // Assert that there are no sections on the page.
  $assert_session
    ->pageTextNotContains('Remove Section 1');
  $assert_session
    ->pageTextNotContains('Add block');
}