You are here

public function DashboardsIntegrationTest::testDashboardsWithRestrictionsEnabled in Layout Builder Restrictions 8.2

Verify that Layout Builder Restrictions does not break Dashboards.

File

tests/src/FunctionalJavascript/DashboardsIntegrationTest.php, line 42

Class

DashboardsIntegrationTest
Demonstrate that Layout Builder Restrictions works with Dashboards.

Namespace

Drupal\Tests\layout_builder_restrictions\FunctionalJavascript

Code

public function testDashboardsWithRestrictionsEnabled() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet('admin/structure/dashboards/add');
  $page
    ->fillField('Administrative Label', 'Charlie');
  $this
    ->assertNotEmpty($assert_session
    ->waitForText('Machine name: charlie'));
  $page
    ->pressButton('Save');
  $this
    ->drupalGet('dashboards/charlie/layout');
  $page
    ->clickLink('Add section');
  $this
    ->assertNotEmpty($assert_session
    ->waitForElementVisible('css', '.layout-selection'));
  $page
    ->clickLink('One column');
  $this
    ->assertNotEmpty($assert_session
    ->waitForText('Configure section'));
  $page
    ->pressButton('Add section');
  $this
    ->assertNotEmpty($assert_session
    ->waitForText('You have unsaved changes'));
  $page
    ->clickLink('Add block');
  $this
    ->assertNotEmpty($assert_session
    ->waitForText('Choose a block'));
}