public function WysiwygSubContext::iClickTheButtonInTheWysiwygEditor in Panopoly 7
Same name and namespace in other branches
- 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc \WysiwygSubContext::iClickTheButtonInTheWysiwygEditor()
@When I click the :action button in the :instanceId WYSIWYG editor
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc, line 110 - Provide Behat step-definitions for WYSIWYG editor.
Class
Code
public function iClickTheButtonInTheWysiwygEditor($action, $instanceId) {
$driver = $this
->getSession()
->getDriver();
$instance = $this
->getWysiwygInstance($instanceId);
$editorType = $this
->getSession()
->evaluateScript("return {$instance}.editor");
$toolbarElement = $this
->getWysiwygToolbar($instanceId, $editorType);
// Click the action button.
$button = $toolbarElement
->find("xpath", "//a[starts-with(@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);
}