From 94b98082a3168d8a7bbbc3275e10983a86bd03ff Mon Sep 17 00:00:00 2001 From: David Woloszyn Date: Thu, 12 Jan 2023 14:19:54 +1100 Subject: [PATCH] MDL-75913 behat: Switch to TinyMCE editor iframe --- .../tiny/tests/behat/behat_editor_tiny.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/editor/tiny/tests/behat/behat_editor_tiny.php b/lib/editor/tiny/tests/behat/behat_editor_tiny.php index f0213ba7649..9c6e60f78b5 100644 --- a/lib/editor/tiny/tests/behat/behat_editor_tiny.php +++ b/lib/editor/tiny/tests/behat/behat_editor_tiny.php @@ -461,4 +461,21 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito $this->execute('behat_general::i_click_on', [$button, 'NodeElement']); } } + + /** + * Switch to the TinyMCE iframe using a selector. + * + * @param string $editorlocator + * + * @When /^I switch to the "(?P(?:[^"]|\\")*)" TinyMCE editor iframe$/ + */ + public function switch_to_tiny_iframe(string $editorlocator): void { + $this->require_tiny_tags(); + + // Get the iframe name for this editor. + $iframename = $this->get_editor_iframe_name($editorlocator); + + // Switch to it. + $this->execute('behat_general::switch_to_iframe', [$iframename]); + } }