Commit 6d888ca0 authored by Jérome Perrin's avatar Jérome Perrin

Fix remaining functional test failures and compatibility with firefox 68

Fix remaining functional test failures and drop a few more code that become unused now that we have a `setFile` command.

Because firefox 68 executes event handlers for events triggered on disabled elements ( https://phabricator.services.mozilla.com/D10000 ), Zelenium is also adapted to mimic the behaviour we had with firefox 52 (and chrome behavior) of not executing event hander.

TODO:
 * [x] `testContributeTab` sometimes displays Converted, sometimes Converting. I wonder if we can wait for something to make the test deterministic, otherwise we can assert a regexp.
 * [x] `erp5_web_renderjs_ui_test:testFunctionalRJSCore` ( discussed in 05b9c4af (comment 87278) )
 * [x] someone update test nodes to use new firefox.
 * [x] understand why with firefox 58 selenium sends clicks on disabled button.

/reviewed-on !922
parents 68d0c366 962c8808
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002-2010 Nexedi SA and Contributors. All Rights Reserved.
# Ivan Tyagov <ivan@nexedi.com>
# Rafael Monenrat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
from Products.ERP5Configurator import tests
def Zuite_getTestDocumentPath(self, filename):
"""
Get the full path of the document to be used into the test.
"""
return os.path.join(
os.path.abspath(
os.path.dirname(tests.__file__)),'test_data/%s' % filename)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ConfiguratorTestUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.ConfiguratorTestUtils</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1377844617.99</float>
<string>GMT+9</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -439,11 +439,6 @@ ...@@ -439,11 +439,6 @@
<td>//select[@name=&quot;field_your_default_address_region&quot;]</td> <td>//select[@name=&quot;field_your_default_address_region&quot;]</td>
<td>Europe/Western Europe/France</td> <td>Europe/Western Europe/France</td>
</tr> </tr>
<tr>
<td>select</td>
<td>//select[@name=&quot;field_your_group&quot;]</td>
<td>My company</td>
</tr>
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>//input[@name=&quot;next:method&quot;]</td> <td>//input[@name=&quot;next:method&quot;]</td>
...@@ -717,7 +712,7 @@ ...@@ -717,7 +712,7 @@
<tr> <tr>
<td>verifyValue</td> <td>verifyValue</td>
<td>//input[@name=&quot;field_your_default_address_city&quot;]</td> <td>//input[@name=&quot;field_your_default_address_city&quot;]</td>
<td>Lille</td> <td>Marcq en Baroeul</td>
</tr> </tr>
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
...@@ -1146,6 +1141,11 @@ ...@@ -1146,6 +1141,11 @@
<td>//input[@name=&quot;field_your_period_title&quot;]</td> <td>//input[@name=&quot;field_your_period_title&quot;]</td>
<td tal:content="python: DateTime().year()"></td> <td tal:content="python: DateTime().year()"></td>
</tr> </tr>
<tr>
<td>select</td>
<td>//select[@name=&quot;field_your_accounting_plan&quot;]</td>
<td>IAS-IFRS Compliant</td>
</tr>
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>//input[@name=&quot;next:method&quot;]</td> <td>//input[@name=&quot;next:method&quot;]</td>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>Zuite_getTestDocumentPath</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ConfiguratorTestUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_getConfiguratorFilenameLocation</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
extension.erp5.ConfiguratorTestUtils
\ No newline at end of file
...@@ -66,19 +66,19 @@ Wait for activities</span> ...@@ -66,19 +66,19 @@ Wait for activities</span>
<td>001</td> <td>001</td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Original Filename"]/../div[@class="input"]</td>
<td>tiolive-ERP5.Freedom.TioLive-001-en.odp</td> <td>tiolive-ERP5.Freedom.TioLive-001-en.odp</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Type"]/../div[@class="input"]</td>
<td>Presentation</td> <td>Presentation</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>Converted</td> <td>//label[normalize-space(text()) = "File State"]/../div[@class="input"]</td>
<td></td> <td>regexp:Convert(ing|ed)</td>
</tr> </tr>
<tr> <tr>
<td>storeEval</td> <td>storeEval</td>
...@@ -114,7 +114,7 @@ Wait for activities</span> ...@@ -114,7 +114,7 @@ Wait for activities</span>
</tr> </tr>
<tr> <tr>
<td>assertAbsoluteLocation</td> <td>assertAbsoluteLocation</td>
<td>regexp:${document_location}</td> <td>glob:${document_location}*</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -143,19 +143,19 @@ Wait for activities</span> ...@@ -143,19 +143,19 @@ Wait for activities</span>
<td>001</td> <td>001</td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Original Filename"]/../div[@class="input"]</td>
<td>tiolive-ERP5.Freedom.TioLive-001-en.odp</td> <td>tiolive-ERP5.Freedom.TioLive-001-en.odp</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Type"]/../div[@class="input"]</td>
<td>Presentation</td> <td>Presentation</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>Converted</td> <td>//label[normalize-space(text()) = "File State"]/../div[@class="input"]</td>
<td></td> <td>regexp:Convert(ing|ed)</td>
</tr> </tr>
<!-- Contribute PDF --> <!-- Contribute PDF -->
...@@ -200,9 +200,9 @@ Wait for activities</span> ...@@ -200,9 +200,9 @@ Wait for activities</span>
<td>001</td> <td>001</td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Type"]/../div[@class="input"]</td>
<td>PDF</td> <td>PDF</td>
<td></td>
</tr> </tr>
<!-- Contribute Image --> <!-- Contribute Image -->
...@@ -294,19 +294,19 @@ Wait for activities</span> ...@@ -294,19 +294,19 @@ Wait for activities</span>
<td>001</td> <td>001</td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Original Filename"]/../div[@class="input"]</td>
<td>tiolive-ERP5.Freedom.TioLive.Spreadsheet-001-en.ods</td> <td>tiolive-ERP5.Freedom.TioLive.Spreadsheet-001-en.ods</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Type"]/../div[@class="input"]</td>
<td>Spreadsheet</td> <td>Spreadsheet</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>Converted</td> <td>//label[normalize-space(text()) = "File State"]/../div[@class="input"]</td>
<td></td> <td>regexp:Convert(ing|ed)</td>
</tr> </tr>
<!-- Contribute Drawing --> <!-- Contribute Drawing -->
...@@ -351,19 +351,19 @@ Wait for activities</span> ...@@ -351,19 +351,19 @@ Wait for activities</span>
<td>001</td> <td>001</td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Original Filename"]/../div[@class="input"]</td>
<td>tiolive-ERP5.Freedom.TioLive.Drawing-001-en.odg</td> <td>tiolive-ERP5.Freedom.TioLive.Drawing-001-en.odg</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>//label[normalize-space(text()) = "Type"]/../div[@class="input"]</td>
<td>Drawing</td> <td>Drawing</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>assertText</td>
<td>Converted</td> <td>//label[normalize-space(text()) = "File State"]/../div[@class="input"]</td>
<td></td> <td>regexp:Convert(ing|ed)</td>
</tr> </tr>
<span metal:use-macro="container/Zuite_CommonTemplate/macros/wait_for_activities"> <span metal:use-macro="container/Zuite_CommonTemplate/macros/wait_for_activities">
......
...@@ -36,10 +36,36 @@ ...@@ -36,10 +36,36 @@
<td>Web Page created successfully</td> <td>Web Page created successfully</td>
<td></td> <td></td>
</tr> </tr>
<!-- gadget's iframe -->
<tr> <tr>
<td>waitForCondition</td> <td>waitForElementPresent</td>
<td>selenium.isElementPresent("//pre")</td> <td>//div[@data-gadget-scope="editor"]/iframe</td>
<td>60000</td> <td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]/iframe</td>
<td></td>
</tr>
<!-- ckeditor's iframe -->
<tr>
<td>waitForElementPresent</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div</td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>verifyTextPresent</td>
...@@ -52,6 +78,12 @@ ...@@ -52,6 +78,12 @@
<td></td> <td></td>
</tr> </tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<span metal:use-macro="container/Zuite_CommonTemplate/macros/wait_for_activities">Wait for activities</span> <span metal:use-macro="container/Zuite_CommonTemplate/macros/wait_for_activities">Wait for activities</span>
</tbody></table> </tbody></table>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testCheckPDFPreview</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>testCheckPDFPreview</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testCheckPDFPreview</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/KMZuite_CommonTemplate/macros/createKMWebSite" />
<tr>
<td>openAndWait</td>
<td>${base_url}/web_site_module/km_test_web_site</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=New Document</td>
<td></td>
</tr>
<tr>
<td>setFile</td>
<td>field_your_file</td>
<td>${base_url}/functional_test_data_folder/tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF-001-en.pdf tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF-001-en.pdf</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>successfully</td>
<td></td>
</tr>
<tr>
<td>storeAttribute</td>
<td>//ul[@class="breadcrumb"]//li[3]/a@href</td>
<td>file_url</td>
</tr>
<span metal:use-macro="container/Zuite_CommonTemplate/macros/wait_for_activities"> Wait for activities</span>
<tr>
<td>openAndWait</td>
<td>${file_url}?editable_mode:int=1</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>PDF</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_title</td>
<td>TioLive, ERP5, Freedom</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_reference</td>
<td>tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_version</td>
<td>001</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_language</td>
<td>en</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tiolive-ERP5.Freedom.TioLive.MultiplePages.PDF-001-en.pdf</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>PDF</td>
<td></td>
</tr>
<!-- Check PDFJS preview appears -->
<tr>
<td>clickAndWait</td>
<td>link=Preview</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='pageContainer1']</td>
<td></td>
</tr>
<tr>
<td>isElementPresent</td>
<td>//button[@id='zoomOut']</td>
<td></td>
</tr>
<tr>
<td>isElementPresent</td>
<td>//button[@id='zoomIn']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/KMZuite_CommonTemplate/macros/deleteKMWebSite" />
</tbody></table>
</body>
</html>
\ No newline at end of file
...@@ -86,27 +86,179 @@ ...@@ -86,27 +86,179 @@
<td>PDF</td> <td>PDF</td>
<td></td> <td></td>
</tr> </tr>
<!-- Check PDFJS preview appears --> <!-- Check PDF thumbnail preview works -->
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>link=Preview</td> <td>link=Thumbnails</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>verifyText</td>
<td>//div[@id='pageContainer1']</td> <td>//span[@class="listbox-current-page-start-number"]</td>
<td>1</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-stop-number"]</td>
<td>10</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>16 records</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@title='Thumbnail']</td>
<td></td>
</tr>
<!-- Check PDF thumbnail preview navigation-->
<tr>
<td>clickAndWait</td>
<td>//button[@class="listbox_next_page"]</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-start-number"]</td>
<td>11</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-stop-number"]</td>
<td>16</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>16 records</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@title='Thumbnail']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//button[@class="listbox_previous_page"]</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-start-number"]</td>
<td>1</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-stop-number"]</td>
<td>10</td>
</tr>
<tr>
<td>verifyText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>16 records</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@title='Thumbnail']</td>
<td></td>
</tr>
<!-- Go to PDF default big preview -->
<tr>
<td>clickAndWait</td>
<td>//tr[@class="listbox-data-line-1 DataB"]/td/div/a/img[@title='Thumbnail']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>2</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@alt='First']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>isElementPresent</td> <td>verifyElementPresent</td>
<td>//button[@id='zoomOut']</td> <td>//img[@alt='Previous']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>isElementPresent</td> <td>verifyElementPresent</td>
<td>//button[@id='zoomIn']</td> <td>//img[@alt='Next']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>verifyElementPresent</td>
<td>//img[@alt='Last']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[@class='pdf-preview-content']/img</td>
<td></td>
</tr>
<!-- Check if PDF thumbnail navigation works -->
<tr>
<td>clickAndWait</td>
<td>//img[@alt='Next']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>3</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='First']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>1</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='Last']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>16</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='First']</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>1</td>
</tr>
<!-- Type in test -->
<tr>
<td>type</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>5</td>
</tr>
<tr>
<td>keyPressAndWait</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>\13</td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="pdf_selection_index"]</td>
<td>5</td>
</tr>
<tal:block metal:use-macro="here/KMZuite_CommonTemplate/macros/deleteKMWebSite" /> <tal:block metal:use-macro="here/KMZuite_CommonTemplate/macros/deleteKMWebSite" />
</tbody></table> </tbody></table>
......
...@@ -80,19 +80,6 @@ Selenium.prototype.assertPortalStatusMessage = function(text) { ...@@ -80,19 +80,6 @@ Selenium.prototype.assertPortalStatusMessage = function(text) {
Assert.matches(text, actualValue); Assert.matches(text, actualValue);
}; };
Selenium.prototype.doType = function(locator, newText) {
if (typeof(netscape) != "undefined" && typeof(netscape.security.PrivilegeManager) != "undefined" ) {
// On old firefox versions, we enable privilege to upload file in javascript.
// The user needs to have signed.applets.codebase_principal_support set to true in about:config
// This is done in prefs.js generated by product/ERP5Type/tests/runFunctionalTest.py
// This approach no longer work in newer firefox versions https://developer.mozilla.org/en-US/docs/Bypassing_Security_Restrictions_and_Signing_Code
// Without this, tests dealing with file upload will fail
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
}
var element = this.page().findElement(locator);
this.page().replaceText(element, newText);
};
/* /*
* Get the location of the current page. This function is missing in * Get the location of the current page. This function is missing in
* Selenium 0.8 or later. * Selenium 0.8 or later.
......
...@@ -741,7 +741,6 @@ Selenium.prototype.doType = function(locator, value) { ...@@ -741,7 +741,6 @@ Selenium.prototype.doType = function(locator, value) {
* @param locator an <a href="#locators">element locator</a> * @param locator an <a href="#locators">element locator</a>
* @param value the value to type * @param value the value to type
*/ */
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
if (this.browserbot.controlKeyDown || this.browserbot.altKeyDown || this.browserbot.metaKeyDown) { if (this.browserbot.controlKeyDown || this.browserbot.altKeyDown || this.browserbot.metaKeyDown) {
throw new SeleniumError("type not supported immediately after call to controlKeyDown() or altKeyDown() or metaKeyDown()"); throw new SeleniumError("type not supported immediately after call to controlKeyDown() or altKeyDown() or metaKeyDown()");
} }
......
...@@ -2522,6 +2522,16 @@ SafariBrowserBot.prototype.modifyWindowToRecordPopUpDialogs = function(windowToM ...@@ -2522,6 +2522,16 @@ SafariBrowserBot.prototype.modifyWindowToRecordPopUpDialogs = function(windowToM
MozillaBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) { MozillaBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
var win = this.getCurrentWindow(); var win = this.getCurrentWindow();
if (eventType === "click" && element.disabled) {
// From firefox 68 (and maybe earlier), the event handlers are executed
// when using element.dispatchEvent on a disabled element, whereas they
// were not with firefox 52.
// To keep compatibility with tests using click on disabled elements,
// we don't dispatch events when elements are disabled. We only do this
// for click events, to minimize the potential side effects of such change.
LOG.debug("not triggering event " + eventType + " on disabled element " + element);
return
}
triggerEvent(element, 'focus', false); triggerEvent(element, 'focus', false);
// Add an event listener that detects if the default action has been prevented. // Add an event listener that detects if the default action has been prevented.
......
...@@ -506,12 +506,48 @@ objectExtend(HtmlTestCaseRow.prototype, { ...@@ -506,12 +506,48 @@ objectExtend(HtmlTestCaseRow.prototype, {
if (testFrame.currentTestCase.headerRow.trElement.textContent.indexOf("expected failure") === -1) { if (testFrame.currentTestCase.headerRow.trElement.textContent.indexOf("expected failure") === -1) {
var aElement = this.trElement.ownerDocument.createElement("a"); var aElement = this.trElement.ownerDocument.createElement("a");
aElement.textContent = ' (HTML)'; aElement.textContent = ' (HTML)';
/**
* encode a string to base64
* @param {string} str string to be encoded
* @return {string}
*/
function b64EncodeUnicode(str) { function b64EncodeUnicode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
return String.fromCharCode('0x' + p1); return String.fromCharCode('0x' + p1);
})); }));
} }
aElement.href = 'data:text/html;charset=utf-8;base64,' + b64EncodeUnicode(sel$('selenium_myiframe').contentWindow.document.body.innerHTML);
/**
* converts a Document to a base64 link containing the page content.
* @param {Document} doc the document
* @return {string}
*/
function convertDocumentToDataUrl(doc){
return 'data:text/html;charset=utf-8;base64,' + b64EncodeUnicode(doc.body.innerHTML);
}
/**
* converts all iframs to a base64 link containing the page content.
* @param {Document} doc the document
* @return {string}
*/
function recursiveConvertIframeToDataUrl(doc) {
doc.querySelectorAll('iframe').forEach(
function (frame) {
var frame_document;
try {
// iframe access might be refused because cross-origin
frame_document = frame.contentWindow.document;
} catch (e) {
console.warn("Ignored error while dumping iframe");
return
}
frame.src = recursiveConvertIframeToDataUrl(frame_document);
}
)
return convertDocumentToDataUrl(doc);
}
aElement.href = recursiveConvertIframeToDataUrl(sel$('selenium_myiframe').contentWindow.document);
this.trElement.cells[2].appendChild(aElement); this.trElement.cells[2].appendChild(aElement);
} }
}, },
......
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