You are here

public function WebformCivicrmTestBase::fillCKEditor in Webform CiviCRM Integration 8.5

Fill CKEditor field.

Parameters

string $locator:

string $value:

2 calls to WebformCivicrmTestBase::fillCKEditor()
WebformCivicrmTestBase::addEmailHandler in tests/src/FunctionalJavascript/WebformCivicrmTestBase.php
Add email handler
WebformCivicrmTestBase::editContactElement in tests/src/FunctionalJavascript/WebformCivicrmTestBase.php
Edit contact element on the build form.

File

tests/src/FunctionalJavascript/WebformCivicrmTestBase.php, line 494

Class

WebformCivicrmTestBase

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

public function fillCKEditor($locator, $value) {
  $el = $this
    ->getSession()
    ->getPage()
    ->findField($locator);
  if (empty($el)) {
    throw new ExpectationException('Could not find WYSIWYG with locator: ' . $locator, $this
      ->getSession());
  }
  $fieldId = $el
    ->getAttribute('id');
  if (empty($fieldId)) {
    throw new Exception('Could not find an id for field with locator: ' . $locator);
  }
  $this
    ->getSession()
    ->executeScript("CKEDITOR.instances[\"{$fieldId}\"].setData(\"{$value}\");");
}