Commit e1effdd1 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Migrate erp5_ui_test_core to BM format

parent ef3b67c8
from time import sleep
def waitForActivities(self, count=1000):
"""
We wait until all activities are finished
RuntimeError is raised in case there is no way
to finish activities.
"""
activity_tool = self.getPortalObject().portal_activities
for x in xrange(count):
x = activity_tool.getMessageList()
if not x:
return 'Done.'
if all(x.processing_node == -2 for x in x):
break
activity_tool.process_timer(None, None)
sleep(1)
raise RuntimeError('tic is looping forever.')
def UpdateImage(image):
image._update_image_info()
def urlread(url, safe_return=0):
import urllib
try:
return urllib.urlopen(url).read()
except IOError, e:
if safe_return:
# Return an Selenium test code that will obviously fail. This
# prevent zelenium test run get Stalled.
return """<html><body><table><tr><td>assertTextPresent</td>
<td>An error occurred when dowload %s : %s </td>
<td></td><tr></body></html>""" % (url , e)
raise IOError(e)
def editZPT(zpt, text):
zpt.pt_edit(text, 'text/html')
"""
Add the test at the end of the webpage (overwrite the current test if there's already one) and hide it
"""
def appendTestToWebPage(text, test_text):
import lxml.html
root = lxml.html.fromstring(text)
test_root = lxml.html.fromstring(test_text)
test_root = test_root.xpath('//table')[0]
tutorial_test = lxml.html.fromstring('<table></table>')
tutorial_test.tag = test_root.tag
for att in test_root.attrib.keys():
tutorial_test.attrib[att] = test_root.attrib[att]
tutorial_test.append(test_root[1])
hidden_list = [tutorial_test] + tutorial_test.xpath('//span')
for element in hidden_list:
element.attrib['style']='display:none;'
table_list = root.xpath('//table[@id="SELENIUM-TEST"]')
if(len(table_list) == 0):
root.append(tutorial_test)
else:
root.replace(table_list[0], tutorial_test)
return lxml.html.tostring(root).replace('\n','').replace("\'","'")
from App.config import getConfiguration
import os
def prepareReportDirectory(self, expected_filename):
"""
Remove existing report with the given filename if any. This must be called
before a report button is clicked
"""
filename_path = os.path.join(getConfiguration().instancehome, 'var',
expected_filename)
if os.path.exists(filename_path):
os.remove(filename_path)
return 'Done'
def isReportGenerated(self, expected_filename):
"""
Check that the report has been generated. Firefox will not prompt for PDF
files as defined in ERP5Type.tests.ERP5TypeFunctionalTestCase.Firefox in
getPrefJs() method
"""
filename_path = os.path.join(getConfiguration().instancehome, 'var',
expected_filename)
if os.path.isfile(filename_path):
os.remove(filename_path)
return 'Done'
return 'Report not generated!'
<?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>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.ERP5Zuite</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>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
##############################################################################
#
# Copyright (c) 2002-2009 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <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.
#
##############################################################################
from ExtensionClass import pmc_init_of
from Products.ERP5Type.tests.utils import DummyMailHostMixin
def setupDummyMailHost(self):
"""Replace Original Mail Host by Dummy Mail Host in a non-persistent way
and reset the list of already sent messages.
Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost
"""
mailhost = self.getPortalObject().MailHost
cls = mailhost.__class__
if not issubclass(cls, DummyMailHostMixin):
cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__
pmc_init_of(cls)
mailhost.reset()
return True
<?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>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>MailHostUtils</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.MailHostUtils</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>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</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">AAAAAAAAAAM=</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<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">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<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>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002-2009 Nexedi SA and Contributors. All Rights Reserved.
# Ivan Tyagov <ivan@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.ERP5 import tests
def Zuite_getTestDocumentsHome(self):
"""
Get test documents folder as string.
"""
return os.path.join(
os.path.abspath(
os.path.dirname(tests.__file__)),'test_data')
<?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>SeleniumTestUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.SeleniumTestUtils</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>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_ui_test_core</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""User the cache tool in order to clear the cache"""
context.portal_caches.clearAllCache()
return "Cleared."
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_clearCache</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
context.Base_doLanguage(select_language)
# Don't redirect. Base_doLanguage tries to redirect to the same page
# and then selenium main page is loaded again in the bottom frame of
# the original selenium main page and one more selenium test starts
# running in another frame. This happens recursively.
context.REQUEST.RESPONSE.setStatus(200)
return 'done'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>select_language</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_setLanguageWithoutRedirect</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>setupDummyMailHost</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>MailHostUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_setupDummyMailHost</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
for error_entry in context.error_log.getLogEntries():
for key in error_entry:
if key not in ["tb_text", "tb_html", 'req_html']:
print '%s : %s' % (key, error_entry[key])
print '------------- Traceback ------------'
print error_entry["tb_text"]
print "="*79
return printed
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ErrorLog_reportErrorList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Get the Message List from DummyMailHost.
This is used by functional tests to get all
emails sent by the instance. This will prevent
the instance spam mailing lists during the
Functional Tests.
"""
if getattr(context.MailHost, "getMessageList", None) is None:
return "ERROR: MailHost is not a DummyMailHost"
message_list = context.MailHost.getMessageList()
for mail in message_list:
for part in mail:
print part
print "="*79
print ""
print "Total messages: %s" %len(message_list)
# If messages "looks like html", zope will set content type to text/html,
# and the assertTextPresent from selenium will be applied after the emails
# are interpreted as html.
# For example, the email "Name <email@example.com>" would be interpreted as
# an html entity and we cannot use assertTextPresent on it.
# To prevent that, we force content type to text.
container.REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain;charset=utf-8')
return printed
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>MailHost_reportMessageList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal_tests = container.portal_tests
if test_zuite_relative_url is not None:
# we care for a specific test zuite
portal_tests = portal_tests.restrictedTraverse(test_zuite_relative_url,\
portal_tests)
# remove test results from previous test runs
portal_tests.manage_delObjects([x.getId() \
for x in portal_tests.objectValues('Zuite Results')])
print "OK"
return printed
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>test_zuite_relative_url=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestTool_cleanUpTestResults</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Clean up test results from previous test runs</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal_tests = container.portal_tests
if test_zuite_relative_url is not None:
# we care for a specific test zuite
portal_tests = portal_tests.restrictedTraverse(test_zuite_relative_url,
portal_tests)
results = portal_tests.objectValues('Zuite Results')
#results.sort()
if not results:
return None
return results[len(results) - 1].getId()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>test_zuite_relative_url=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestTool_getLatestReportId</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal_tests = container.portal_tests
if test_zuite_relative_url is not None:
# we care for a specific test zuite
portal_tests = portal_tests.restrictedTraverse(test_zuite_relative_url,
portal_tests)
results = portal_tests.objectValues('Zuite Results')
if not results:
return None
# Selenium results tests are just named "testTable.1", "testTable.2" and so forth.
# We replace this by the path of the test, this way we can easily see which test has failed.
html = results[len(results) - 1].index_html()
for idx, test_case in enumerate(portal_tests.listTestCases()):
html = html.replace('>testTable.%s</a>' % (idx + 1), '>%s</a>' % test_case['path'])
return html
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>test_zuite_relative_url=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestTool_getResults</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
return portal.getSkinNameFromRequest(context.REQUEST) or \
portal.portal_skins.getDefaultSkin()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>skin_name=\'\'</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestTool_getSkinName</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# This script is called when you invoke a browser with "?auto=true" to portal_tests.
# FIXME: this script should send the result by email.
get = request.form.get
# Summary.
result = ['Report on Functional Tests', '']
result.append('Passed: %s' % (get('result').lower() == 'passed' and 'Yes' or 'No'))
result.append('Total Time: %s' % get('totalTime'))
result.append('Passed Tests: %s' % get('numTestPasses'))
result.append('Failed Tests: %s' % get('numTestFailures'))
result.append('Passed Commands: %s' % get('numCommandPasses'))
result.append('Failed Commands: %s' % get('numCommandFailures'))
result.append('Commands with Errors: %s' % get('numCommandErrors'))
result.append('')
# Details.
table_list = []
for key in request.form.keys():
if key.startswith('testTable'):
prefix, num = key.split('.')
table_list.append((prefix, int(num)))
table_list.sort()
for table in table_list:
key = '%s.%d' % table
html = get(key)
# Ugly, but get the title somehow.
i = html.index('<td')
start = html.index('>', i) + 1
end = html.index('<', start)
title = html[start:end]
# Count passes and failures.
num_passed_commands = html.count('bgcolor="#cfffcf"', end)
num_failed_commands = html.count('bgcolor="#ffcfcf"', end)
result.append('%s: %d passed, %d failed' % (title, num_passed_commands, num_failed_commands))
return '\n'.join(result)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>request</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestTool_reportResult</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if skin_name:
context.REQUEST.RESPONSE.setCookie('portal_skin', skin_name)
else:
context.REQUEST.RESPONSE.expireCookie('portal_skin')
return context.REQUEST.RESPONSE.redirect(context.absolute_url())
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>skin_name=\'\'</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestTool_setSkinNameCookie</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>description</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>text</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Common Template for PTZuite, it will reuse parts of the Listbox Zuite</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_CommonTemplate</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>Common Template for All Zuite</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="init">
<tr>
<td>setTimeout</td>
<td>90000</td>
<td></td>
</tr>
<tr>
<td>store</td>
<td tal:content="python:here.getPortalObject().absolute_url()">http://example.com/erp5</td>
<td>base_url</td>
</tr>
<tr> <!-- reset language to en, in case previous test failed and left the language changed -->
<td>open</td>
<td>${base_url}/Base_setLanguageWithoutRedirect?select_language=en</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="wait_for_activities">
<!-- Wait for activities to finish -->
<tr>
<td>openAndWait</td>
<td>${base_url}/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="expected_failure_for_anonymous_selection">
<tal:block tal:condition="here/portal_selections/isAnonymous"> (expected failure)</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
"""
Include a page template contains a into a Zuite
"""
if REQUEST:
raise RuntimeError("You can not call this script from the URL")
assert context.getPortalType() == "Test Tool", "bad context"
if test_id is None or test_id == '':
test_id = ''.join(list(filter(lambda a: a not in ["'",'_', '-','.',' ','~', ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', '(', ')', '*','+',';','='], title)))
if test_id not in context.objectIds():
factory = context.manage_addProduct['PageTemplates']
factory.manage_addPageTemplate(test_id, title=title, text=text, REQUEST=None)
test = getattr(context, test_id, None)
else:
test = getattr(context, test_id, None)
context.Zuite_editZPT(test, text)
test.setTitle(text)
return test
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>test_id, title, text, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_addTest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Create a zuite or return an existing one after remove his contents.
"""
assert context.getPortalType() == "Test Tool", "bad context"
if REQUEST:
raise RuntimeError("You can not call this script from the URL")
if zuite_id is None:
raise ValueError("Zuite_id cannot be None!")
if zuite_id not in context.objectIds():
factory = context.portal_tests.manage_addProduct['Zelenium']
factory.manage_addZuite(id=zuite_id)
zuite = getattr(context.portal_tests, zuite_id)
if zuite.getMetaType() != "ERP5 Test Tool":
raise ValueError("Zuite is not a ERP5 Test Tool")
zuite.manage_delObjects(zuite.objectIds())
return zuite
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>zuite_id, REQUEST=None</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_addZuite</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
test_list is composed by [(full_test_html , title), ]
"""
zuite = context.getPortalObject().portal_tests.Zuite_addZuite(zuite_id)
for text, title in test_list:
zuite.Zuite_addTest(None, title, text)
return zuite.Base_redirect("core/TestRunner.html?auto=true&test=..%2Ftest_suite_html&resultsUrl=..%2FpostResults")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>test_list, zuite_id</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_createAndLaunchSeleniumTest</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Display Selenium Test</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>editZPT</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_editZPT</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Edit Page Template</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
request = context.REQUEST
now = DateTime()
expire_timeout_days = 1
session_id = request.get('session_id', None)
if session_id is None or not session_id.startswith("erp5zuite"):
## first call so generate session_id and send back via cookie
session_id = 'erp5zuite_' + context.REQUEST.other['AUTHENTICATED_USER'].getIdOrUserName()
request.RESPONSE.setCookie('erp5_session_id', session_id, expires=(now +expire_timeout_days).fCommon(), path='/')
session = context.portal_sessions[session_id]
if not session.has_key('tempfolder') or session['tempfolder'] == '':
session['tempfolder'] = context.Zuite_createTempFolder() + '/'
return session['tempfolder'] + str(context.portal_ids.generateNewId(id_generator='zuite', id_group=context.getId(), default=1)) + '.png'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_generateFilename</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test_documents_home = context.Zuite_getTestDocumentsHome()
return '%s/%s' %(test_documents_home, filename)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>filename</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_getFilenameLocation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Get object's uid.
"""
return context.portal_catalog.getResultValue(**kw).getUid()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_getObjectUid</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_getTestDocumentsHome</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SeleniumTestUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_getTestDocumentsHome</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>isReportGenerated</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_isReportGenerated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zuite_isReportGenerated</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>prepareReportDirectory</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_prepareReportDirectory</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zuite_prepareReportDirectory</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Generate a Zuite (if necessary), create/update the test and redirect to the selenium test created/updated
url, web_page or web_page_reference must be set for it to work (or the context should be the Web Page in question)
"""
test_list = []
count = 0
portal = context.getPortalObject()
for url in url_list:
count += 1
if "http" not in url:
# local content
data = portal.restrictedTraverse(url).TestPage_viewSeleniumTest()
else:
data = context.Zuite_urlRead(url, safe_return=1)
test_list.append((data, '%s %s' % (count, url)),)
return context.Zuite_createAndLaunchSeleniumTest(test_list=test_list,
zuite_id=zuite_id)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>url_list, zuite_id=\'tutorial_zuite\'</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_runSeleniumTest</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Display Selenium Test</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Set subversion working copy list and enable preference.
This script is called by Products.ERP5Type.tests.runFunctionalTest to set
subversion working copy paths and conversion server address.
It's not meant to be called by zelenium tests directly.
"""
pref = getattr(context.portal_preferences, "erp5_ui_test_preference", None)
if pref is None:
pref = context.portal_preferences.newContent(id="erp5_ui_test_preference",
portal_type="Preference",
priority=1)
pref.setPreferredSubversionWorkingCopyList(tuple(working_copy_list.split(',')))
pref.setPreferredHtmlStyleUnsavedFormWarning(False)
if pref.getPreferenceState() == 'disabled':
pref.enable()
return 'Set Preference Successfully.'
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>working_copy_list</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_setPreference</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Set Test Runner Preferences</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>UpdateImage</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_updateImage</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zuite_updateImage</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Upload a screenshot taken by the test to ERP5
"""
from Products.ERP5Type.Log import log
data_uri = context.REQUEST.form.get('data_uri', 'default')
image_module = getattr(context, "image_module", None)
if image_module is None:
return "erp5_dms is not Installed"
image = image_module.getPortalObject().WebSection_getDocumentValue(
name=image_reference)
if image is None or image.getPortalType() != "Image":
# Image is an embedded file or not an image
return "Image: " + str(image_reference) + " not found"
image.setContentType('image/png')
data_text = data_uri.read()
data = data_text.decode('base64')
image.edit(data=data,
filename=str(image_reference) + '.png',
content_type = 'image/png')
context.Zuite_updateImage(image)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>data_uri, image_reference</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_uploadScreenshot</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>urlread</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_urlRead</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Fetch content from Url</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Zuite_runSeleniumTest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>your_description</string>
<string>your_url_list</string>
<string>your_zuite_id</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_viewZeleniumTestLauncher</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Zuite_runZeleniumTestview</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Run Zelenium Test</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StringField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_description</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>noLabel</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>Include a URL for a HTML that contains a Selenium Test Code, in case of Test Page use TestPage_getSeleniumTest at the end of URL.</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Information</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>height</string>
<string>title</string>
<string>width</string>
</list>
</value>
</item>
<item>
<key> <string>delegated_message_list</string> </key>
<value>
<list>
<string>external_validator_failed</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_url_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>Input at least one and only ONE of those three fields.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Type the url of the page containing the Zelenium Test. (for external webpages only)</string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>120</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_lines_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>External URLs</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>90</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>description</string>
<string>required</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_zuite_id</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>tutorial_zuite</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Enter the id of the Zuite containing your test.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zuite ID</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
web_page_context = context.getPortalType() in ['Test Page', 'Web Page']
if web_page_context:
no_web_page = False
form_id = 'view'
else:
no_web_page = not request.has_key('web_page') or request['web_page'] is None or not request['web_page']
form_id = 'Zuite_viewZeleniumTestLauncher'
no_reference = not request.has_key('web_page_reference') or request['web_page_reference'] is None or not request['web_page_reference']
no_url = not request.has_key('url') or request['url'] is None or not request['url']
if no_web_page and no_url and no_reference:
if validator:
return 0
else:
return dict(result = False, form_id = form_id, portal_status_message=context.Base_translateString("External Url (url), ERP5 Web Page Path (web_page) and ERP5 Web Page Reference (web_page_reference): were omitted, one of them must be set."))
elif not (no_url or no_web_page) or not (no_reference or no_web_page):
if validator:
return 0
elif web_page_context:
return dict(result=False,
form_id=form_id,
portal_status_message=context.Base_translateString("url, web_page and web_page_reference don't need to be set in Web Page context."))
else:
return dict(result=False,
form_id=form_id,
portal_status_message=context.Base_translateString("You have to choose between External Url (url), ERP5 Web Page Path (web_page) and ERP5 Web Page Reference (web_page_reference). Only ONE of them must be set."))
if validator:
return 1
else:
return dict(result = True)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>editor, request, validator = True</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_viewZeleniumTestLauncherValidator</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>waitForActivities</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_waitForActivities</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Wait activities</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/**
* Selenium extensions for the ERP5 project
*/
/**
* Checks the element referenced by `locator` is a float equals to `text`.
* Values are converted to float, to be format-independant (ie. 1 000 = 1000.0)
*/
Selenium.prototype.assertFloat = function(locator, text) {
var actualValueText = getText(this.page().findElement(locator));
var actualValue = parseFloat(actualValueText.replace(/ /g, "").replace(/&nbsp;/g, ""));
var expectedValue = parseFloat(text.replace(/ /g, "").replace(/&nbsp;/g, ""));
if (isNaN(actualValue)) {
Assert.fail("Actual value "+ actualValueText +
" cannot be parsed as float");
}
Assert.matches(expectedValue.toString(), actualValue.toString());
};
/**
* like assertFloat, but for the value of <input elements.
*/
Selenium.prototype.assertFloatValue = function(locator, text) {
var actualValueText = getInputValue(this.page().findElement(locator));
var actualValue = parseFloat(actualValueText.replace(/ /g, "").replace(/&nbsp;/g, ""));
var expectedValue = parseFloat(text.replace(/ /g, "").replace(/&nbsp;/g, ""));
if (isNaN(actualValue)) {
Assert.fail("Actual value "+ actualValueText +
" cannot be parsed as float");
}
Assert.matches(expectedValue.toString(), actualValue.toString());
};
/**
* Checks the portal status message.
*/
Selenium.prototype.assertPortalStatusMessage = function(text) {
var psm_locator = "//div[@id='transition_message']";
var actualValue = getText(this.page().findElement(psm_locator));
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
* Selenium 0.8 or later.
*/
Selenium.prototype.getAbsoluteLocation = function() {
return this.page().location || this.browserbot.getCurrentWindow().location;
};
Selenium.prototype.doPhantomRender = function(filename) {
if (window.page && window.page.render) {
page.render(filename);
}
};
Selenium.prototype.assertElementPositionRangeTop = function(locator, range){
var positionTop = parseFloat(this.getElementPositionTop(locator));
/* example of range 450..455 */
var rangeList = range.split("..");
var minimumPositionTop = parseFloat(rangeList[0]);
var maximumPositionTop = parseFloat(rangeList[1]);
if (positionTop < minimumPositionTop || positionTop > maximumPositionTop ){
Assert.fail(positionTop + " is not between " + minimumPositionTop + " and " + maximumPositionTop);
}
};
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>user-extensions.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2013-09-03 arnaud.fontaine
* ZODB Components: Workflow History must always be kept, so avoid an extra step for developers.
2013-08-28 arnaud.fontaine
* ZODB Components: Migrate Documents, Extensions and Tests.
2013-04-05 arnaud.fontaine
* Implement Extensions to be able to check whether a report has been generated.
2011-10-11 Xavier
* Selenium core updated (2.6.0)
* captureEntirePageScreenshot is available to take screenshots with Selenium (Firefox only)
* captureEntirePageScreenshotAndUpload is available to upload the screenshots to the instance
* showOptions/hideOptions functions to help displaying drop down menus
2011-11-01 Cedric
* Add phantomRender Selenium user extension.
2010-06-07 yusei
* Remove short title.
2009-11-08 Rafael
* added Script for getMessageList from DummyMailHost
2009-04-20 Kazuhiko
* add Zuite_CommonTemplate that should a common template for all functional tests.
* add TestTool_getSkinName and TestTool_setSkinNameCookie so as to unify functional tests for normal skin and mobile skin.
2009-02-03 Kazuhiko
* define getAbsoluteLocation() in user-extensions.js for compatible with Zelenium based of Selenium 0.8 or later.
2008-10-01 fabien
* initial version
\ No newline at end of file
Copyright (C) 2008 Nexedi SA
\ No newline at end of file
erp5_core
erp5_xhtml_style
\ No newline at end of file
Framework for user interface tests.
WARNING: This business template contain extremely unsafe code and should not be installed on a production environment.
\ No newline at end of file
GPL
\ No newline at end of file
fabien
\ No newline at end of file
extension.erp5.ERP5Zuite
extension.erp5.MailHostUtils
extension.erp5.SeleniumTestUtils
\ No newline at end of file
erp5_ui_test_core
\ No newline at end of file
erp5_ui_test_core
\ No newline at end of file
5.4.7
\ 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