public function VarbaseContext::appendTheRichTextEditorField in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.7
Same name and namespace in other branches
- 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::appendTheRichTextEditorField()
- 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::appendTheRichTextEditorField()
- 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::appendTheRichTextEditorField()
- 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::appendTheRichTextEditorField()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::appendTheRichTextEditorField()
#varbase : To append text at the end of a rich text editor field WYSIWYG with content using the name of the field.
Example #1: When I append after the rich text editor field "Body" with "Test Body text" Example #2: When I append the rich text editor field "Body" with "Test Body text"
@When /^(?:|I )append(?:| after) the rich text editor field "([^"]*)" with "([^"]*)"$/
File
- tests/
features/ bootstrap/ VarbaseContext.php, line 499
Class
- VarbaseContext
- Defines application features from the specific context.
Code
public function appendTheRichTextEditorField($locator, $value) {
$el = $this
->getSession()
->getPage()
->findField($locator);
$fieldId = $el
->getAttribute('id');
if ($fieldId == NULL) {
// If the WYSIWYG is in an ifream with no id.
$iFreamID = $this
->_getAttributeByOtherAttributeValue('id', 'title', "Rich Text Editor, " . $el
->getAttribute('id'), 'iframe');
if (!empty($iFreamID)) {
$fieldId = $iFreamID;
}
}
if (empty($fieldId)) {
throw new Exception('Could not find an id for the rich text editor field : ' . $locator);
}
$this
->getSession()
->executeScript("CKEDITOR.instances[\"{$fieldId}\"].setData(CKEDITOR.instances[\"{$fieldId}\"].getData()+\"{$value}\");");
}