Commit ebc123fe authored by Romain Courteaud's avatar Romain Courteaud

[erp5_crm/html_style/hal_json_style] Make create_response usable in ERP5JS

Add Base_renderForm to bypass erp5_hal_json_style limitations: it is not possible to render a field in JSON by directly using it as a callable.

[erp5_crm_renderjs_ui_test] Test create response dialog
parent 455f35a8
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>action_type/object_action</string> <string>action_type/object_jio_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_jio_action</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -20,9 +20,9 @@ if response_event_notification_message: ...@@ -20,9 +20,9 @@ if response_event_notification_message:
# XXX this relies on formulator internals, we force the variables in request and # XXX this relies on formulator internals, we force the variables in request and
# re-render the form. # re-render the form.
request = container.REQUEST request = container.REQUEST
request.set('your_response_event_notification_message', '') request.form['your_response_event_notification_message'] = ''
request.set('your_response_event_title', temp_event.getTitle()) request.form['your_response_event_title'] = temp_event.getTitle()
request.set('your_response_event_text_content', temp_event.getTextContent()) request.form['your_response_event_text_content'] = temp_event.getTextContent()
request.set('your_response_event_resource', temp_event.getResource()) request.form['your_response_event_resource'] = temp_event.getResource()
return context.Event_viewCreateResponseDialog() return context.Base_renderForm('Event_viewCreateResponseDialog')
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Zuite" module="Products.Zelenium.zuite"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>renderjs_ui_crm_action_zuite</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="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>testCRMCreateResponse</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>Test Form View Editable Save Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/prepare_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/view_create_response_dialog" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'Re: erp5_crm_renderjs_ui_test_event_title',
'field_your_response_event_portal_type': 'Note',
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_your_response_event_portal_type': 'Letter',
'field_your_response_event_resource': '',
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
<!-- Header has a save button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Response Created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="response_configuration python: {'field_my_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_my_portal_type': 'Letter',
'field_my_resource': '',
'field_my_start_date': '2010-01-01T00:00:00',
'simulation_state': 'Draft',
'field_my_source_title': 'erp5_crm_renderjs_ui_test_agent_title',
'field_my_destination_title': 'erp5_crm_renderjs_ui_test_customer_title',
'field_my_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_response_content" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?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>testCRMCreateResponseFromNotificationMessage</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>Test Form View Editable Save Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/prepare_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/view_create_response_dialog" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'Re: erp5_crm_renderjs_ui_test_event_title',
'field_your_response_event_portal_type': 'Note',
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_your_response_event_portal_type': 'Letter',
'field_your_response_event_resource': '',
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': 'erp5_crm_renderjs_ui_test_notification_reference',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
<!-- Header has a save button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Response Created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="response_configuration python: {'field_my_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_my_portal_type': 'Letter',
'field_my_resource': '',
'field_my_start_date': '2010-01-01T00:00:00',
'simulation_state': 'Draft',
'field_my_source_title': 'erp5_crm_renderjs_ui_test_agent_title',
'field_my_destination_title': 'erp5_crm_renderjs_ui_test_customer_title',
'field_my_text_content': '<p>No pbl. We will solve your issue.</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_response_content" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?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>testCRMUpdateCreateResponseDialog</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>Test Form View Editable Save Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/prepare_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/view_create_response_dialog" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'Re: erp5_crm_renderjs_ui_test_event_title',
'field_your_response_event_portal_type': 'Note',
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_your_response_event_portal_type': 'Letter',
'field_your_response_event_resource': '',
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
<!-- Header has a save button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/update_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data received'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_your_response_event_portal_type': 'Letter',
'field_your_response_event_resource': '',
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?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>testCRMUpdateCreateResponseDialogFromNotificationMessage</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>Test Form View Editable Save Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/prepare_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/view_create_response_dialog" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'Re: erp5_crm_renderjs_ui_test_event_title',
'field_your_response_event_portal_type': 'Note',
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'erp5_crm_renderjs_ui_test_response_title',
'field_your_response_event_portal_type': 'Letter',
'field_your_response_event_resource': '',
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': 'erp5_crm_renderjs_ui_test_notification_reference',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
<!-- Header has a save button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/update_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data received'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_response_event_title': 'erp5_crm_renderjs_ui_test_notification_title',
'field_your_response_event_portal_type': 'Letter',
'field_your_response_event_resource': '',
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>No pbl. We will solve your issue.</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?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_crm_renderjs_ui_test</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from DateTime import DateTime
portal = context.getPortalObject()
person_portal_type = "Person"
customer_id = "erp5_crm_renderjs_ui_test_customer"
customer_title = "erp5_crm_renderjs_ui_test_customer_title"
agent_id = "erp5_crm_renderjs_ui_test_agent"
agent_title = "erp5_crm_renderjs_ui_test_agent_title"
module = portal.getDefaultModule(person_portal_type)
customer = module.newContent(
portal_type=person_portal_type,
id=customer_id,
title=customer_title
)
agent = module.newContent(
portal_type=person_portal_type,
id=agent_id,
title=agent_title
)
notification_message_portal_type = "Notification Message"
notification_message_id = "erp5_crm_renderjs_ui_test_notification"
notification_message_title = "erp5_crm_renderjs_ui_test_notification_title"
notification_message_reference = "erp5_crm_renderjs_ui_test_notification_reference"
notification_message_text_content = """No pbl.
We will solve your issue.
"""
module = portal.getDefaultModule(notification_message_portal_type)
notification_message = module.newContent(
portal_type=notification_message_portal_type,
id=notification_message_id,
title=notification_message_title,
reference=notification_message_reference,
text_content=notification_message_text_content
)
notification_message.validate()
event_portal_type = "Note"
event_id = "erp5_crm_renderjs_ui_test_event"
event_title = "erp5_crm_renderjs_ui_test_event_title"
event_text_content = """Hello,
I have an issue
"""
module = portal.getDefaultModule(event_portal_type)
event = module.newContent(
portal_type=event_portal_type,
id=event_id,
title=event_title,
text_content=event_text_content,
source_value=customer,
destination_value=agent,
)
portal.portal_workflow.doActionFor(event, 'initial_stop_action')
return "Event Created."
<?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>CRMRJSZuite_createEvent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
event_portal_type = "Note"
event_id = "erp5_crm_renderjs_ui_test_event"
# Delete event
module = portal.getDefaultModule(event_portal_type)
if getattr(module, event_id, None) is not None:
module.manage_delObjects([event_id])
notification_message_portal_type = "Notification Message"
notification_message_id = "erp5_crm_renderjs_ui_test_notification"
# Delete Notification Message
module = portal.getDefaultModule(notification_message_portal_type)
if getattr(module, notification_message_id, None) is not None:
module.manage_delObjects([notification_message_id])
person_portal_type = "Person"
customer_id = "erp5_crm_renderjs_ui_test_customer"
agent_id = "erp5_crm_renderjs_ui_test_agent"
# Delete person
module = portal.getDefaultModule(person_portal_type)
for person_id in (customer_id, agent_id):
if getattr(module, person_id, None) is not None:
module.manage_delObjects([person_id])
return "Deleted 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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CRMRJSZuite_deleteData</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.
"""
context.Zuite_setPreference('')
pref = context.portal_preferences.erp5_ui_test_preference
pref.setPreferredTextEditor('fck_editor')
return 'Set CRM 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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CRMRJSZuite_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="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_CommonTemplateForCRMRenderjsUi</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 CRM Renderjs ui Zuite</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
##############################################################################
#
# Copyright (c) 2011 Nexedi SARL and Contributors. All Rights Reserved.
# Kazuhiko <kazuhiko@nexedi.com>
# 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.
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestRenderJSUICRMAction(ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "renderjs_ui_crm_action_zuite"
def getBusinessTemplateList(self):
return (
'erp5_crm_renderjs_ui_test',
'erp5_crm',
'erp5_web_renderjs_ui',
'erp5_web_renderjs_ui_test',
'erp5_ui_test_core',
'erp5_test_result',
)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRenderJSUICRMAction))
return suite
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test 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>testFunctionalRJSCRMAction</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testFunctionalRJSCRMAction</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test 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>
RenderJS UI tests for Event Module.
\ No newline at end of file
Copyright (C) 2018 Nexedi SA
\ No newline at end of file
erp5_crm
erp5_web_renderjs_ui_test
\ No newline at end of file
GPL
\ No newline at end of file
portal_tests/renderjs_ui_crm_action_zuite
portal_tests/renderjs_ui_crm_action_zuite/**
\ No newline at end of file
erp5_crm_renderjs_ui_test
\ No newline at end of file
test.erp5.testFunctionalRJSCRMAction
\ No newline at end of file
erp5_full_text_mroonga_catalog
\ No newline at end of file
erp5_crm_renderjs_ui_test
\ No newline at end of file
0.1
\ No newline at end of file
# request.RESPONSE.setStatus(200)
form = getattr(context, form_id)
return context.ERP5Document_getHateoas(form=form, mode='form')
<?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>form_id</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_renderForm</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -153,6 +153,30 @@ ...@@ -153,6 +153,30 @@
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="update_dialog">
<tr>
<td colspan="3"><b>Update the dialog</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_dialog.html')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_dialog.html')]//button[@name='action_update' and @type='submit']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_dialog.html')]//button[@name='action_update' and @type='submit']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
</tal:block>
<tal:block metal:define-macro="search_in_form_list"> <tal:block metal:define-macro="search_in_form_list">
<tr> <tr>
<td colspan="3"><b tal:content="python: 'Submit a form list search: %s' % search_query"></b></td> <td colspan="3"><b tal:content="python: 'Submit a form list search: %s' % search_query"></b></td>
...@@ -842,4 +866,23 @@ ...@@ -842,4 +866,23 @@
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="wait_for_notification">
<tr>
<td colspan="3"><b>Wait for the notification message</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[@data-gadget-scope=\'notification\']//button[@class=\'%(class)s\' and text()=\'%(text)s\']' % notification_configuration"></td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[@data-gadget-scope=\'notification\']//button[@class=\'%(class)s\' and text()=\'%(text)s\']' % notification_configuration"></td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
</tal:block>
</tal:block> </tal:block>
\ No newline at end of file
<?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>form_id</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_renderForm</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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