You are here

public function VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 9.0.x

Same name and namespace in other branches
  1. 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField()
  2. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField()
  3. 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField()
  4. 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField()
  5. 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickOnCommandButtonInTheRichTextEditorField()

Click a command button in the rich text editor.

Varbase Context #varbase.

Example 1: When I click on "bold" command button in the rich text editor field "Body" Example 2: When I click on "media" command button in the rich text editor field "Body".

@When /^I click on "([^"]*)" command button in the rich text editor field "([^"]*)"$/

File

tests/features/bootstrap/VarbaseContext.php, line 546

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iClickOnCommandButtonInTheRichTextEditorField($selectorCommand, $locator) {
  $el = $this
    ->getSession()
    ->getPage()
    ->findField($locator);
  $fieldId = $el
    ->getAttribute('id');
  if (empty($fieldId)) {
    throw new \Exception('Could not find an id for the rich text editor field : ' . $locator);
  }
  $this
    ->getSession()
    ->executeScript("CKEDITOR.instances[\"{$fieldId}\"].execCommand( '{$selectorCommand}' );");
}