protected function ContextualLinkClickTrait::clickContextualLink in Drupal 9
Same name and namespace in other branches
- 8 core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinkClickTrait.php \Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait::clickContextualLink()
Clicks a contextual link.
Parameters
string $selector: The selector for the element that contains the contextual link.
string $link_locator: The link id, title, or text.
bool $force_visible: If true then the button will be forced to visible so it can be clicked.
20 calls to ContextualLinkClickTrait::clickContextualLink()
- BlockFormMessagesTest::testValidationMessage in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ BlockFormMessagesTest.php - Tests that validation messages are shown on the block form.
- ContentPreviewToggleTest::assertContextualLinks in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContentPreviewToggleTest.php - Checks if contextual links are working properly.
- ContextualLinksTest::testContextualLinksClick in core/
modules/ contextual/ tests/ src/ FunctionalJavascript/ ContextualLinksTest.php - Tests clicking contextual links.
- FieldTest::testFieldWithCkeditor in core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ FieldTest.php - Tests that quickeditor works correctly for field with CKEditor.
- InlineBlockPrivateFilesTest::replaceFileInBlock in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ InlineBlockPrivateFilesTest.php - Replaces the file in the block with another one.
1 method overrides ContextualLinkClickTrait::clickContextualLink()
- LayoutBuilderTest::clickContextualLink in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderTest.php - @todo Remove this in https://www.drupal.org/project/drupal/issues/2918718.
File
- core/
modules/ contextual/ tests/ src/ FunctionalJavascript/ ContextualLinkClickTrait.php, line 20
Class
- ContextualLinkClickTrait
- Functions for testing contextual links.
Namespace
Drupal\Tests\contextual\FunctionalJavascriptCode
protected function clickContextualLink($selector, $link_locator, $force_visible = TRUE) {
$page = $this
->getSession()
->getPage();
$page
->waitFor(10, function () use ($page, $selector) {
return $page
->find('css', "{$selector} .contextual-links");
});
if ($force_visible) {
$this
->toggleContextualTriggerVisibility($selector);
}
$element = $this
->getSession()
->getPage()
->find('css', $selector);
$element
->find('css', '.contextual button')
->press();
$element
->findLink($link_locator)
->click();
if ($force_visible) {
$this
->toggleContextualTriggerVisibility($selector);
}
}