Commit dc96746e authored by Aaron Wells's avatar Aaron Wells

Behat step for entering text into a dynamically named TinyMCE field

Bug 1540722: Use "And I fill in <text> in WYSIWYG editor", and it
just uses the first TinyMCE on the page.

behatnotneeded: Tested in subsequent commit

Change-Id: I69368751aaf7256bc6cedaa8e4ab3a5413c68f87
parent 35058650
......@@ -887,11 +887,21 @@ class BehatGeneral extends BehatBase {
}
/**
* Fills in WYSIWYG editor with specified id.
* Fills in WYSIWYG editor with specified id. (If no ID is specified, uses the first
* TinyMCE editor on the page.
*
* @Given /^(?:|I )fill in "(?P<text>[^"]*)" in WYSIWYG editor "(?P<iframe>[^"]*)"$/
* TODO: Is there a better, more human-readable way we could specify the TinyMCE editor
* to use? Like, tie it to the label for the pieform element?
*
* @Given /^(?:|I )fill in "(?P<text>[^"]*)" in WYSIWYG editor(?:| "(?P<iframe>[^"]*)")$/
*/
public function iFillInInWYSIWYGEditor($text, $iframe) {
public function iFillInInWYSIWYGEditor($text, $iframe = null) {
if ($iframe == null) {
// Use the first TinyMCE iframe on the page
// TODO: May have to change this when upgrading TinyMCE. Is there a TinyMCE
// Javascript API we could use instead?
$iframe = $this->find('css', '.mce-edit-area > iframe')->getAttribute('id');
}
try {
$this->getSession()->switchToIFrame($iframe);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment