Commit ac5f90c9 authored by Jérome Perrin's avatar Jérome Perrin

web_renderjs_ui_test: fix flaky testFormViewHistoricalRevisionLink

This test was using a blind `pause` instead of an explicit waitFor*, so
it was failing when machine was not fast enough.

Also refactor the test a bit to simplify the assertion by first
selecting the iframe we are going to inspect and make the test
compatible with both chrome and firefox - they behave differently when
interpreting new lines in selenium test tables.
parent 4c25f638
Pipeline #6331 passed with stage
in 0 seconds
......@@ -72,12 +72,10 @@
</tr>
<tr>
<td>type</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>
Foo
Bar
</td>
<td>assertEval</td>
<!-- type is not cross-browser compatible when there is new lines in input. -->
<td>(selenium.browserbot.findElement("//textarea[@name='field_my_lines_list']").value = "Foo\nBar", "OK")</td>
<td>OK</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
......@@ -208,23 +206,37 @@ Bar
<td></td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td>selectFrame</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[2]/td[2]//iframe</td>
<td></td>
</tr>
<!-- Check for the value of diff in IFrame -->
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//div[@data-gadget-scope='field_listbox']//table/tbody/tr[2]/td[2]//iframe", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.contentWindow.document.body.textContent</td>
<td>diff_content</td>
<td>waitForText</td>
<td>//div[contains(@class, " d2h-del ")]</td>
<td>-</td>
</tr>
<tr>
<td>verifyEval</td>
<!-- Verify the value after removing the spaces and line breaks -->
<td>storedVars['diff_content'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>1-1+('FooBar',)</td>
<td>waitForText</td>
<td>//div[contains(@class, " d2h-ins ")]/span[@class="d2h-code-line-prefix"]</td>
<td>+</td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[contains(@class, " d2h-ins ")]/span[@class="d2h-code-line-ctn"]/ins[1]</td>
<td>('Foo',</td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[contains(@class, " d2h-ins ")]/span[@class="d2h-code-line-ctn"]/ins[2]</td>
<td>'Bar')</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
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