diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php index a5d8163e15..8799253935 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php @@ -366,14 +366,13 @@ public function testLayoutNoDialog() { */ protected function clickContextualLink($selector, $link_locator, $force_visible = TRUE) { $assert_session = $this->assertSession(); - $page = $this->getSession()->getPage(); if ($force_visible) { $this->getSession()->executeScript("jQuery('{$selector} .contextual button').removeClass('visually-hidden');"); $assert_session->waitForElementVisible('css', '.contextual button'); } - $element = $page->find('css', $selector); + $element = $this->getSession()->getPage()->find('css', $selector); $link = $element->findLink($link_locator); if (!$link) { $this->fail("Link $link_locator was found"); @@ -381,6 +380,7 @@ protected function clickContextualLink($selector, $link_locator, $force_visible else { // If the link is not visible, click the contextual link button first. if (!$link->isVisible()) { + // Mink press() works unstable, so the trigger('click') is used here. $this->getSession()->executeScript("jQuery('$selector .contextual button').trigger('click');"); $assert_session->waitForLink($link_locator); }