How do I test a CKEditor text format field with Behat/Mink? I am using an @javascript test in Behat on CircleCI to check my Drupal 8 site.
When I use the standard I fill in &quot;my field&quot; with &quot;value&quot; step, it works for fields with the plain text format, but it fails for fields that use CKEditor.
How can I fill in fields on CKEditor?
This doesn't yet have official support in the Drupal Extension.  The linked thread has some examples that use traits.
However, I found this gist by johnennewdeeson to be a faster, easier solution for me, just cut and paste into FeatureContext.php:
  /**
   * @Then I fill in wysiwyg on field :locator with :value
   */
  public function iFillInWysiwygOnFieldWith($locator, $value) {
    $el = $this-&gt;getSession()-&gt;getPage()-&gt;findField($locator);

    if (empty($el)) {
      throw new ExpectationException('Could not find WYSIWYG with locator: ' . $locator, $this-&gt;getSession());
    }

    $fieldId = $el-&gt;getAttribute('id');

    if (empty($fieldId)) {
      throw new Exception('Could not find an id for field with locator: ' . $locator);
    }

    $this-&gt;getSession()
      -&gt;executeScript(&quot;CKEDITOR.instances[\&quot;$fieldId\&quot;].setData(\&quot;$value\&quot;);&quot;);
  }