Commit 68081daf authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui_test: Add test to make sure we have all...

erp5_officejs_support_request_ui_test: Add test to make sure we have all expected actions to access support request web site

* Check if each portal_type has the expected view action
* add test to cover all possible attachments in a Support Request
parent cfc93a86
<?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>testAddSupportRequestAttachment</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>
<head>
<title tal:content="template/title">The title</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Support Request Zuite</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>click</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>type</td>
<td>//input[@name='field_your_title']</td>
<td>test</td>
</tr>
<tr>
<td>select</td>
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>FeatureRequire</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>field_your_resource</td>
<td>FeatureRequire</td>
</tr>
<tal:block tal:define="text_content string:Post test">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
</tal:block>
<tr>
<td>setFile</td>
<td>field_your_file</td>
<td>portal_skins/erp5_officejs_support_request_test/test_support_request_text.pdf test_support_request_text.pdf</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New Support Request 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" />
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Post Comment"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Comments:</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>//ol[@id="post_list"]//li/p</td>
<td>Post test</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Reference</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Project</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Begin Date</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Support Type</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>State</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Submitted</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//ol[@id="post_list"]/li/a</td>
<td>test_support_request_text.pdf</td>
</tr>
<tr>
<td>store</td>
<td>javascript{selenium.browserbot.currentWindow.location.href}</td>
<td>current_location</td>
</tr>
<tr>
<td>storeText</td>
<td>//p[@id="field_my_reference"]</td>
<td>current_reference</td>
</tr>
<tal:block tal:repeat="filename python: ['test_support_request_presentation.pptx',
'test_support_request_spreadsheet.xlsx',
'test_support_request_docx.docx',
'test_support_request_txt.txt']">
<tr>
<td>setFile</td>
<td>attachment</td>
<td tal:content="string: portal_skins/erp5_officejs_support_request_test/${filename} ${filename}"></td>
</tr>
<tal:block tal:define="text_content string:Post test ${filename}">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
</tal:block>
<tr>
<td>click</td>
<td>//input[@data-i18n="[value]Post Comment"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='notification' and @class='visible']//button[@class='success' and text()='Comment added']</td>
<td></td>
</tr>
<tr>
<td>openAndWait</td>
<td tal:content="string: ${here/portal_url}/Zuite_waitForActivities"></td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${current_location}</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td tal:content="string:Post test ${filename}"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>attachment</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Home"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Home"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="document_table"]/table/tbody/tr[1]/td[2]/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@class="document_table"]/table/tbody/tr[1]/td[2]/a</td>
<td></td>
</tr>
<tal:block tal:repeat="filename python: ['test_support_request_text.pdf',
'test_support_request_presentation.pptx',
'test_support_request_spreadsheet.xlsx',
'test_support_request_docx.docx',
'test_support_request_txt.txt']">
<tr>
<td>waitForElementPresent</td>
<td tal:content="string: //a[contains(text(), '${filename}')]"></td>
<td></td>
</tr>
<tr>
<td>click</td>
<td tal:content="string: //a[contains(text(), '${filename}')]"></td>
<td></td>
</tr>
<tr tal:define="title python: filename.split('.')[0]">
<td>waitForElementPresent</td>
<td tal:content="python: '//div[@class=\'ui-header\']/h1/a[contains(text(), \'{}\')]'.format(title)"></td>
<td></td>
</tr>
<tr tal:define="title python: filename.split('.')[0]">
<td>click</td>
<td tal:content="python: '//div[@class=\'ui-header\']/h1/a[contains(text(), \'{}\')]'.format(title)"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[contains(text(), '${current_reference}')]</td>
<td></td>
</tr>
</tal:block>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
......@@ -19,11 +19,6 @@
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Generate RSS"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='wrap1']</td>
......
......@@ -21,19 +21,45 @@
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Generate RSS"]</td>
<td>//a[@data-i18n="Support Requests"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@data-i18n="[value]Generate RSS"]</td>
<td>//a[@data-i18n="Support Requests"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@value="RSS Link"]</td>
<td>//a[contains(text(), "Actions")]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), "Actions")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), "Generate RSS")]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), "Generate RSS")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[contains(text(), "Copy to Clipboard")]</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>//div[@data-gadget-scope="text_field"]/input</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/support_request_module/SupportRequestModule_viewLastSupportRequestListAsRss</td>
</tr>
<!--
Firefox RSS compatibility issue:
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>test_support_request_docx.docx</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/octet-stream</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>test_support_request_presentation.pptx</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/octet-stream</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>test_support_request_spreadsheet.xlsx</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/octet-stream</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>test_support_request_text.pdf</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/pdf</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>test_support_request_txt.txt</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>test_support_request_text.txt</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -94,6 +94,39 @@ class SupportRequestTestCase(ERP5TypeTestCase, object):
class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
def test_existing_portal_type_action_to_support_request(self):
view_categorie_list = ["object_view", "object_jio_view",
"object_web_view", "object_jio_search"]
portal_type_list = [
p for p in self.portal.getPortalDocumentTypeList() \
if p not in ("Sound", "Video", "Web Page", 'Video', 'Web Illustration',
'Web Manifest', 'Web Page', 'Web Script', 'Web Style',
'Web Table')]
# Should not happens but we never know
assert portal_type_list, portal_type_list
for portal_type_str in portal_type_list:
portal_type = self.portal.portal_types[portal_type_str]
action_list = portal_type.objectValues(portal_type="Action Information")
filtered_action_list = [action.getReference() \
for action in sorted(action_list, key=lambda x: x.getFloatIndex()) \
if action.getActionType() in view_categorie_list
]
self.assertTrue(any(a in ("preview", "web_view") for a in filtered_action_list),
"missing preview or web_view in {} {}".format(portal_type_str, filtered_action_list))
for portal_type_str in ["Support Request", "Support Request Module"]:
portal_type = self.portal.portal_types[portal_type_str]
action_list = portal_type.objectValues(portal_type="Action Information")
filtered_action_list = [action.getReference() \
for action in sorted(action_list, key=lambda x: x.getFloatIndex()) \
if action.getActionType() in view_categorie_list
]
self.assertIn("officejs_support_request_view",
filtered_action_list,
"missing officejs_support_request_view in {}".format(portal_type_str))
def test_submit_support_request(self):
self.getWebSite().SupportRequestModule_createSupportRequest(
description='<b>Help !!!</b>',
......@@ -463,7 +496,7 @@ class TestSupportRequestRSSSOneEvent(SupportRequestRSSTestCase, DefaultTestRSSMi
def test_RSS_with_token(self):
self.login(self.user.getUserId())
# get rss link url
self.portal.support_request_module.SupportRequestModule_generateRSSLinkUrl()
self.getWebSite().support_request_module.SupportRequestModule_generateRSSLinkUrl()
restricted_access_url = self.portal.REQUEST.form["your_rss_url"]
parsed_url = urlparse.urlparse(restricted_access_url)
restricted_access_url = restricted_access_url.replace(
......
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