Commit c09f11f5 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.

/reviewed-on nexedi/erp5!967
parent d02fa029
Pipeline #6352 failed with stage
in 0 seconds
...@@ -72,12 +72,10 @@ ...@@ -72,12 +72,10 @@
</tr> </tr>
<tr> <tr>
<td>type</td> <td>assertEval</td>
<td>//textarea[@name='field_my_lines_list']</td> <!-- type is not cross-browser compatible when there is new lines in input. -->
<td> <td>(selenium.browserbot.findElement("//textarea[@name='field_my_lines_list']").value = "Foo\nBar", "OK")</td>
Foo <td>OK</td>
Bar
</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
...@@ -208,23 +206,37 @@ Bar ...@@ -208,23 +206,37 @@ Bar
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>pause</td> <td>selectFrame</td>
<td>1000</td> <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[2]/td[2]//iframe</td>
<td></td> <td></td>
</tr> </tr>
<!-- Check for the value of diff in IFrame --> <!-- Check for the value of diff in IFrame -->
<tr> <tr>
<td>storeEval</td> <td>waitForText</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>//div[contains(@class, " d2h-del ")]</td>
<td>diff_content</td> <td>-</td>
</tr> </tr>
<tr> <tr>
<td>verifyEval</td> <td>waitForText</td>
<!-- Verify the value after removing the spaces and line breaks --> <td>//div[contains(@class, " d2h-ins ")]/span[@class="d2h-code-line-prefix"]</td>
<td>storedVars['diff_content'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td> <td>+</td>
<td>1-1+('FooBar',)</td>
</tr> </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> </tbody></table>
</body> </body>
</html> </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