You are here

public function FeatureContext::iClickTheButtonInTheWysiwygEditor in Bear 7

@When /^I click the "([^"]*)" button in the "([^"]*)" WYSIWYG editor$/

File

tests/features/bootstrap/FeatureContext.php, line 282

Class

FeatureContext
Defines application features from the specific context.

Code

public function iClickTheButtonInTheWysiwygEditor($action, $instanceId) {
  $driver = $this
    ->getSession()
    ->getDriver();
  $instance = $this
    ->getWysiwygInstance($instanceId);
  $toolbarElement = $this
    ->getWysiwygToolbar($instanceId);

  // Click the action button.
  $button = $toolbarElement
    ->find("xpath", "//span[@class='cke_toolgroup']/a[@title='{$action}']");
  if (!$button) {
    throw new \Exception(sprintf('Button "%s" was not found on the page %s', $action, $this
      ->getSession()
      ->getCurrentUrl()));
  }
  $button
    ->click();
  $driver
    ->wait(1000, TRUE);
}