Commit 556a18fa authored by Jérome Perrin's avatar Jérome Perrin

web_renderjs_ui_test: more robust way of waiting for CKEditor

To answer question in the comment:
> How to inspect inside another iframe?

use selectFrame (after waiting for the frame to be added in the DOM of course).

Reference of selenium commands: https://web.archive.org/web/20160807232621/http://release.seleniumhq.org/selenium-core/1.0.1/reference.html#selectFrame (I'm not sure it's still on the web)
parent f2361768
......@@ -1128,15 +1128,35 @@
<tr>
<td colspan="3"><b>Verify CKEditor Text Content</b></td>
</tr>
<!-- Wait for ckeditor to be loaded :/ How to inspect inside another iframe? -->
<!-- Wait for ckeditor to be loaded -->
<tr>
<td>pause</td>
<td>2000</td>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr><!-- gadget iframe -->
<td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//iframe</td>
<td></td>
</tr>
<tr><!-- CKEditor iframe -->
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//body</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.querySelector('iframe').contentWindow.document.querySelector('iframe').contentWindow.document.body.innerHTML</td>
<td>selenium.browserbot.getCurrentWindow().document.body.innerHTML</td>
<td>_macro_verify_ckeditor_text_content_temporary_var</td>
</tr>
<tr>
......@@ -1144,6 +1164,11 @@
<td>storedVars['_macro_verify_ckeditor_text_content_temporary_var']</td>
<td tal:content="python: text_content"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
......@@ -1157,17 +1182,42 @@
<tr>
<td colspan="3"><b>Type CKEditor Text Content</b></td>
</tr>
<!-- Wait for ckeditor to be loaded :/ How to inspect inside another iframe? -->
<!-- Wait for ckeditor to be loaded -->
<tr>
<td>pause</td>
<td>20000</td>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr><!-- gadget iframe -->
<td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//iframe</td>
<td></td>
</tr>
<tr><!-- CKEditor iframe -->
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//body</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td tal:content="python: 'document.querySelector(\'#selenium_myiframe\').contentWindow.document.querySelector(\'iframe\').contentWindow.document.querySelector(\'iframe\').contentWindow.document.body.innerHTML = \'{}\''.format(text_content.replace('\n', '\\n').replace('\'', '\\\''))"></td>
<td tal:content="python: 'selenium.browserbot.getCurrentWindow().document.body.innerHTML = \'{}\''.format(text_content.replace('\n', '\\n').replace('\'', '\\\''))"></td>
<td>_macro_type_ckeditor_text_content_temporary_var</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
......
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