function ContextualLinksTest::testContextualLinks

Same name in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::testContextualLinks()
  2. 10 core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::testContextualLinks()
  3. 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/ContextualLinksTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ContextualLinksTest::testContextualLinks()

Tests that the contextual links inside Layout Builder are removed.

File

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

Class

ContextualLinksTest
Test contextual links compatibility with the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

public function testContextualLinks() {
    // Skipped due to frequent random test failures.
    $page = $this->getSession()
        ->getPage();
    $this->drupalGet('node/1/layout');
    // Add a block that includes an entity contextual link.
    $this->addBlock('Test Block View: Teaser block');
    // Add a block that includes a views contextual link.
    $this->addBlock('Recent content');
    // Ensure the contextual links are correct before the layout is saved.
    $this->assertCorrectContextualLinksInUi();
    // Ensure the contextual links are correct when the Layout Builder is loaded
    // after being saved.
    $page->hasButton('Save layout');
    $page->pressButton('Save layout');
    $this->drupalGet('node/1/layout');
    $this->assertCorrectContextualLinksInUi();
    $this->drupalGet('node/1');
    $this->assertCorrectContextualLinksInNode();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.