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

officejs_support_request_ui_test: test for worklists

parent f2264935
<?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>testWorklist</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>Worklists on support request front page</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<title tal:content="template/title">Worklists on support request front page</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">Worklists on support request front page</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//h1[@data-i18n="[value]Support Requests WorkList"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//section[@class="document_list"]//li[1]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Open")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td> <!-- document count -->
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Open")]/span[text() = "1"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Close")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Close")]/span[text() = "1"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Suspended Support Requests")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Suspended Support Requests")]/span[text() = "1"]</td>
<td></td>
</tr>
<!-- clicking on one worklist open the module -->
<tr>
<td>click</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Suspended Support Requests")]/span[text() = "1"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//h1/a[@data-i18n="Support Request Module"]</td>
<td></td>
</tr>
<!-- The module is filtered according to worklist definition, so it shows one document -->
<tr>
<td>waitForElementPresent</td>
<td>//h1[@data-i18n="Support Requests"]//span[text() = "(1)"]</td>
<td></td>
</tr>
<!-- Query editor buttons are also present -->
<tr>
<td>waitForElementPresent</td>
<td>div.search_parsed_value > button:nth-of-type(3)</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
"""Cleanup the data from support request module.
So that test are isolated.
"""
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
portal = context.getPortalObject()
test_project_set = set((
portal.project_module.erp5_officejs_support_request_ui_test_project_001,
portal.project_module.erp5_officejs_support_request_ui_test_project_002))
to_delete_list = []
for brain in portal.portal_catalog(
portal_type="Support Request",
simulation_state=NegatedQuery(Query(simulation_state=("cancelled",)))):
support_request = brain.getObject()
if support_request.getId().startswith('erp5_officejs_support_request_ui_test_'):
continue # business template data
assert support_request.getSourceProjectValue() in test_project_set, \
"Support request %s have unexpected project." % support_request.absolute_url()
to_delete_list.append(support_request.getId())
portal.support_request_module.manage_delObjects(to_delete_list)
# Clear worklist cache
portal.portal_caches.clearAllCache()
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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_cleanupSupportRequestUITestDataSet</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create some data for support request UI test.
Logged in user needs to be Assignee / Assignor on the support requests
included in business template.
"""
portal = context.getPortalObject()
for support_request in portal.support_request_module.contentValues():
if support_request.getId().startswith('erp5_officejs_support_request_ui_test'):
support_request.manage_addLocalRoles(
portal.portal_membership.getAuthenticatedMember().getId(),
['Assignee', 'Assignor'])
support_request.reindexObject()
portal.portal_caches.clearAllCache()
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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_createSupportRequestUITestDataSet</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>Zuite_SupportRequestUITemplate</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>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="cleanup_module">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr><td>openAndWait</td>
<td>${base_url}/ERP5Site_cleanupSupportRequestUITestDataSet</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Done.</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tal:block metal:define-macro="create_data">
<tr><td>openAndWait</td>
<td>${base_url}/ERP5Site_createSupportRequestUITestDataSet</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Done.</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
</tal:block>
\ 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