You are here

protected function ContextualLinksTest::assertCorrectContextualLinksInNode in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::assertCorrectContextualLinksInNode()
  2. 10 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.

1 call to ContextualLinksTest::assertCorrectContextualLinksInNode()
ContextualLinksTest::testContextualLinks in core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php
Tests that the contextual links inside Layout Builder are removed.

File

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

Class

ContextualLinksTest
Test contextual links compatibility with the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertCorrectContextualLinksInNode() {
  $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]'));
}