public function WysiwygSubContext::iClickTheButtonInTheWysiwygEditor in Panopoly 8.2
Same name and namespace in other branches
- 7 modules/panopoly/panopoly_test/behat/steps/panopoly_test_wysiwyg.behat.inc \WysiwygSubContext::iClickTheButtonInTheWysiwygEditor()
Clicks a button in a WYSIWYG editor.
@When I click the :action button in the :instanceId WYSIWYG editor
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test_wysiwyg.behat.inc, line 193 - Provide Behat step-definitions for WYSIWYG editor.
Class
- WysiwygSubContext
- Behat subcontext for testing WYSIWYG.
Code
public function iClickTheButtonInTheWysiwygEditor($action, $instanceId) {
$driver = $this
->getSession()
->getDriver();
$editorType = $this
->getEditorType($instanceId);
$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);
}