Commit f5eb9713 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui_test: test fields interactions on "New Support Request"

Possible services depend on the selected project.
parent 888adb89
Pipeline #12751 failed with stage
in 0 seconds
<?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>testAddSupportRequestWithMultipleProjectsAvailableForUser</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">Test adding a support request for users who have access to multiple projects</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_second_project" />
<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>
<!-- When there's more than one project, no project is selected by default -->
<tr>
<td>assertSelectedLabel</td>
<td>field_your_project</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_project"]/option[text() = "RobotMaking"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_project"]/option[text() = "Second Project"]</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<!-- for RobotMaking project, RequireAssistant is allowed, but BugReport is not -->
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "RequireAssistant"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "BugReport"]</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>field_your_project</td>
<td>Second Project</td>
</tr>
<!-- for Second Project project, everything is -->
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "BugReport"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "RequireAssistant"]</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>
<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>assertText</td>
<td>//div[@data-gadget-scope="field_my_source_project_title"]//p</td>
<td>Second Project</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@data-gadget-scope="field_my_resource"]//p</td>
<td>FeatureRequire</td>
<td></td>
</tr>
</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>testAddSupportRequestWithOnlyOneProjectAvailableForUser</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">Test adding a support request for users who can only access one project</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<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>
<!-- When there's only one project, this project is selected by default -->
<tr>
<td>waitForSelectedLabel</td>
<td>field_your_project</td>
<td>RobotMaking</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "FeatureRequire"]</td>
<td></td>
</tr>
<!-- this default project have a a sale supply line, defining that only FeatureRequire and
RequireAssistant services are available for this project -->
<tr>
<td>waitForElementPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "RequireAssistant"]</td>
<td></td>
</tr>
<!-- other services are not available here. -->
<tr>
<td>waitForElementNotPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "BugReport"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//select[@name="field_your_resource"]/option[text() = "CrashReport"]</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>
<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>assertText</td>
<td>//div[@data-gadget-scope="field_my_source_project_title"]//p</td>
<td>RobotMaking</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@data-gadget-scope="field_my_resource"]//p</td>
<td>FeatureRequire</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
...@@ -7,6 +7,9 @@ portal = context.getPortalObject() ...@@ -7,6 +7,9 @@ portal = context.getPortalObject()
test_project_set = set(( 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_001,
portal.project_module.erp5_officejs_support_request_ui_test_project_002)) portal.project_module.erp5_officejs_support_request_ui_test_project_002))
erp5_officejs_support_request_test_second_project = portal.project_module.get('erp5_officejs_support_request_test_second_project')
if erp5_officejs_support_request_test_second_project is not None:
test_project_set.add(erp5_officejs_support_request_test_second_project)
to_delete_list = [] to_delete_list = []
for brain in portal.portal_catalog( for brain in portal.portal_catalog(
...@@ -20,6 +23,10 @@ for brain in portal.portal_catalog( ...@@ -20,6 +23,10 @@ for brain in portal.portal_catalog(
to_delete_list.append(support_request.getId()) to_delete_list.append(support_request.getId())
portal.support_request_module.manage_delObjects(to_delete_list) portal.support_request_module.manage_delObjects(to_delete_list)
if erp5_officejs_support_request_test_second_project is not None:
portal.project_module.manage_delObjects(ids=[erp5_officejs_support_request_test_second_project.getId()])
event_to_delete_id_list = [] event_to_delete_id_list = []
for event in portal.event_module.contentValues(): for event in portal.event_module.contentValues():
if event.getFollowUp(portal_type='Support Request'): if event.getFollowUp(portal_type='Support Request'):
......
"""Create a second project for support request UI test.
All support request services can be used on this project.
"""
portal = context.getPortalObject()
portal.project_module.newContent(
id='erp5_officejs_support_request_test_second_project',
title='Second Project'
).validate()
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_createSupportRequestUITestSecondProject</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -30,4 +30,12 @@ ...@@ -30,4 +30,12 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block> </tal:block>
<tal:block metal:define-macro="create_second_project">
<tr><td>openAndWait</td>
<td>${base_url}/ERP5Site_createSupportRequestUITestSecondProject</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> </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