You are here

protected function ContextualLinksTest::assertCorrectContextualLinksInNode in Drupal 10

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

Asserts the contextual links are correct on the canonical entity route.

@internal

File

core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php, line 142

Class

ContextualLinksTest
Test contextual links compatibility with the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertCorrectContextualLinksInNode() : void {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->assertNotEmpty($assert_session
    ->waitForElementVisible('css', '[data-contextual-id]'));

  // Ensure that no Layout Builder contextual links are visible on node view.
  $this
    ->assertEmpty($page
    ->findAll('css', '[data-contextual-id*=\'layout_builder_block:\']'));

  // Ensure that the contextual links that are hidden in Layout Builder UI
  // are visible on node view.
  $this
    ->assertNotEmpty($page
    ->findAll('css', '.layout-content [data-contextual-id]'));
}