You are here

protected function LayoutBuilderDisableInteractionsTest::assertContextualLinksClickable in Drupal 10

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

Confirms that Layout Builder contextual links remain active.

@internal

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php, line 218

Class

LayoutBuilderDisableInteractionsTest
Tests the Layout Builder disables interactions of rendered blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertContextualLinksClickable() : void {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet($this
    ->getUrl());
  $this
    ->clickContextualLink('.block-field-blocknodebundle-with-section-fieldbody [data-contextual-id^="layout_builder_block"]', 'Configure');
  $this
    ->assertNotEmpty($assert_session
    ->waitForElementVisible('css', '.ui-dialog-titlebar [title="Close"]'));

  // We explicitly wait for the off-canvas area to be fully resized before
  // trying to press the Close button, instead of waiting for the Close button
  // itself to become visible. This is to prevent a regularly occurring random
  // test failure.
  $this
    ->waitForOffCanvasArea();
  $page
    ->pressButton('Close');
  $assert_session
    ->assertNoElementAfterWait('css', '#drupal-off-canvas');

  // Run the steps a second time after closing dialog, which reverses the
  // order that behaviors.layoutBuilderDisableInteractiveElements and
  // contextual link initialization occurs.
  $this
    ->clickContextualLink('.block-field-blocknodebundle-with-section-fieldbody [data-contextual-id^="layout_builder_block"]', 'Configure');
  $this
    ->assertNotEmpty($assert_session
    ->waitForElementVisible('css', '#drupal-off-canvas'));
  $page
    ->pressButton('Close');
  $this
    ->markTestSkipped('Temporarily skipped due to random failures.');
  $assert_session
    ->assertNoElementAfterWait('css', '#drupal-off-canvas');
  $this
    ->assertContextualLinkRetainsMouseup();
}